Skip to content

Cannot read property 'start' of undefined on project with existing eslintrc #631

@brunoparga

Description

@brunoparga

Description and reproduction of the issue

I get the following output whenever I run eslint.

$ npx eslint --fix --ext .ts,.js,.html . 

Oops! Something went wrong! :(

ESLint: 7.32.0

TypeError: Cannot read property 'start' of undefined
    at Linter._verifyWithoutProcessors ([project]/node_modules/eslint/lib/linter/linter.js:1198:54)
    at Linter._verifyWithConfigArray ([project]/node_modules/eslint/lib/linter/linter.js:1280:21)
    at Linter.verify ([project]/node_modules/eslint/lib/linter/linter.js:1235:25)
    at Linter.verifyAndFix ([project]/node_modules/eslint/lib/linter/linter.js:1428:29)
    at verifyText ([project]/node_modules/eslint/lib/cli-engine/cli-engine.js:240:48)
    at CLIEngine.executeOnFiles ([project]/node_modules/eslint/lib/cli-engine/cli-engine.js:808:28)
    at ESLint.lintFiles ([project]/node_modules/eslint/lib/eslint/eslint.js:563:23)
    at Object.execute ([project]/node_modules/eslint/lib/cli.js:301:36)
    at main ([project]/node_modules/eslint/bin/eslint.js:132:52)
    at Object.<anonymous> ([project]/node_modules/eslint/bin/eslint.js:136:2)

I am not sure if the issue is with the parser or not, as it happens when I target any kinds of files. My apologies if the issue should have been created under another package. Other issues that mention the same output, like #372, did not cut it for me as I did not, prior to installing this package, have a tslint.json - it had already been removed.

I will try to create a reproduction repo if just reading about the issue doesn't help you solve the issue. It's a bit hard now because this package is a "nice to have" rather than a requirement, at work.

For reference, here is my .eslintrc.yml:

env:
  browser: true
  es6: true
extends:
  - 'eslint:recommended'
  - 'plugin:@typescript-eslint/recommended'
  - 'plugin:cypress/recommended'
  - 'plugin:@angular-eslint/eslint-plugin/recommended'
  - 'plugin:@angular-eslint/eslint-plugin-template/recommended'
globals:
  Atomics: readonly
  SharedArrayBuffer: readonly
parser: '@angular-eslint/template-parser'
parserOptions:
  ecmaVersion: 2018
  sourceType: module
plugins:
  - '@typescript-eslint/eslint-plugin'
  - angular
  - cypress
settings:
  "import/parsers":
    "@angular-eslint/template-parser": [".ts"]
    "@typescript-eslint": [".ts"]
  "import/resolver":
    typescript: {}
rules:
  no-console:
    - error
    - allow:
      - warn
      - error
  indent:
    - error
    - 4
  linebreak-style:
    - error
    - unix
  quotes:
    - error
    - single
  semi:
    - error
    - never
  comma-dangle:
    - error
    - always-multiline
  no-useless-constructor: 0
  lines-between-class-members:
    - error
    - always
    - exceptAfterSingleLine: true
  eqeqeq:
    - error
    - always
  no-param-reassign: 0
  class-methods-use-this: 0
  "@typescript-eslint/camelcase": 0
  "@typescript-eslint/explicit-function-return-type": 0
  "@typescript-eslint/explicit-module-boundary-types": 0
  camelcase: 0
  no-undef: 0
  "@typescript-eslint/no-explicit-any": 0
  "@typescript-eslint/no-empty-function": ["error", { "allow": ["private-constructors"] }]
  "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
  "@typescript-eslint/no-use-before-define": 0

Versions

package version
@angular-eslint/template-parser 4.3.0
ESLint 7.32.0
node 14.15.4
# Please run `npx ng version` in your project and paste the full output here:

Angular CLI: 11.2.14
Node: 14.15.4
OS: linux x64

Angular: 11.2.14
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker
Ivy Workspace: No

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.14
@angular-devkit/build-angular   0.1102.14
@angular-devkit/core            11.2.14
@angular-devkit/schematics      11.0.7
@angular/cdk                    11.0.4
@angular/flex-layout            11.0.0-beta.33
@nguniversal/express-engine     11.0.1
@schematics/angular             11.0.7
@schematics/update              0.1102.14
rxjs                            6.6.7
typescript                      4.1.6
  • I have updated to the latest supported version of the packages and checked my ng version output per the instructions given here.
    (This is with the understanding that version 12 of this package wouldn't work with Angular 11)

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: template-parserESLint custom parser which enables linting Angular TemplatestriageThis issue needs to be looked at and categorized by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions