diff --git a/desktop/angular/.eslintrc.json b/desktop/angular/.eslintrc.json new file mode 100644 index 00000000..4a0b4c0e --- /dev/null +++ b/desktop/angular/.eslintrc.json @@ -0,0 +1,51 @@ +{ + "root": true, + "ignorePatterns": [ + "projects/**/*" + ], + "overrides": [ + { + "files": [ + "*.ts" + ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@angular-eslint/recommended", + "plugin:@angular-eslint/template/process-inline-templates" + ], + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "app", + "style": "camelCase" + } + ], + "@angular-eslint/component-selector": [ + "error", + { + "type": "element", + "prefix": "app", + "style": "kebab-case" + } + ], + "@typescript-eslint/no-explicit-any": "off" + } + }, + { + "files": [ + "*.html" + ], + "extends": [ + "plugin:@angular-eslint/template/recommended", + "plugin:@angular-eslint/template/accessibility" + ], + "rules": { + "@angular-eslint/template/click-events-have-key-events": "off", + "@angular-eslint/template/interactive-supports-focus": "off" + } + } + ] +} diff --git a/desktop/angular/src/app/shared/netquery/textql/lexer.ts b/desktop/angular/src/app/shared/netquery/textql/lexer.ts index 008cbd6e..a3f2fe93 100644 --- a/desktop/angular/src/app/shared/netquery/textql/lexer.ts +++ b/desktop/angular/src/app/shared/netquery/textql/lexer.ts @@ -43,7 +43,7 @@ export class Lexer { } /** reads a number token */ - private readNumber(): Token { + private readNumber(): Token | null { const start = this._input.pos; let has_dot = false; @@ -59,9 +59,10 @@ export class Lexer { return isDigit(ch); }); - if (!this._input.eof() && isIdentChar(this._input.peek())) { - this._input.revert(number.length + 1); - this._input.croak("invalid number character") + if (!this._input.eof() && !isWhitespace(this._input.peek())) { + this._input.revert(number.length); + + return null; } return { @@ -182,13 +183,11 @@ export class Lexer { return this.readString('\'', true); } - try { - if (isDigit(ch)) { - return this.readNumber(); + if (isDigit(ch)) { + const number = this.readNumber(); + if (number !== null) { + return number; } - } catch (err) { - // we ignore that error here as it may only happen for unqoted strings - // that start with a number. } if (ch === ':') {