Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'loc' of null error when using babel-eslint as a custom parser #21

Closed
Robula opened this issue Nov 9, 2017 · 12 comments
Closed

'loc' of null error when using babel-eslint as a custom parser #21

Robula opened this issue Nov 9, 2017 · 12 comments

Comments

@Robula
Copy link

Robula commented Nov 9, 2017

  • Node Version: 8.9.1
  • eslint Version: 4.10.0
  • vue-eslint-parser Version: 2.0.1-beta.2
  • babel-eslint Version: 8.0.2

This is directly related to the issue I created here vuejs/eslint-plugin-vue#189.

I have discovered that the above issue is not resident in eslint-plugin-vue and that the issue likely lies with the interactions between babel-eslint and vue-eslint-parser.

As described in vuejs/eslint-plugin-vue#189 the combination of vue-eslint-parser and babel-eslint produces a error when running the linter.

Example

screen shot 2017-11-09 at 15 18 42

@mysticatea
Copy link
Member

Thank you for the report.

Hmmm, but I still cannot reproduce it. I'm seeing no errors.

image

@Robula
Copy link
Author

Robula commented Nov 11, 2017

@mysticatea Could you try changing @Component() to

@Component({
    mounted: {}
})

and rerun the linter please?

@mysticatea
Copy link
Member

Sure, but I got the same result.

Could you run npm ls and share the result?

@mysticatea
Copy link
Member

mysticatea commented Nov 11, 2017

This is mine
sandbox@1.0.0 C:\Users\t-nagashima.MSS\dev\sandbox
+-- babel-eslint@8.0.2
| +-- @babel/code-frame@7.0.0-beta.31
| | +-- chalk@2.3.0 deduped
| | +-- esutils@2.0.2 deduped
| | `-- js-tokens@3.0.2
| +-- @babel/traverse@7.0.0-beta.31
| | +-- @babel/code-frame@7.0.0-beta.31 deduped
| | +-- @babel/helper-function-name@7.0.0-beta.31
| | | +-- @babel/helper-get-function-arity@7.0.0-beta.31
| | | | `-- @babel/types@7.0.0-beta.31 deduped
| | | +-- @babel/template@7.0.0-beta.31
| | | | +-- @babel/code-frame@7.0.0-beta.31 deduped
| | | | +-- @babel/types@7.0.0-beta.31 deduped
| | | | +-- babylon@7.0.0-beta.31 deduped
| | | | `-- lodash@4.17.4 deduped
| | | +-- @babel/traverse@7.0.0-beta.31 deduped
| | | `-- @babel/types@7.0.0-beta.31 deduped
| | +-- @babel/types@7.0.0-beta.31 deduped
| | +-- babylon@7.0.0-beta.31 deduped
| | +-- debug@3.1.0 deduped
| | +-- globals@10.3.0
| | +-- invariant@2.2.2
| | | `-- loose-envify@1.3.1
| | |   `-- js-tokens@3.0.2 deduped
| | `-- lodash@4.17.4 deduped
| +-- @babel/types@7.0.0-beta.31
| | +-- esutils@2.0.2 deduped
| | +-- lodash@4.17.4 deduped
| | `-- to-fast-properties@2.0.0
| `-- babylon@7.0.0-beta.31
+-- eslint@4.11.0
| +-- ajv@5.3.0
| | +-- co@4.6.0
| | +-- fast-deep-equal@1.0.0
| | +-- fast-json-stable-stringify@2.0.0
| | `-- json-schema-traverse@0.3.1
| +-- babel-code-frame@6.26.0
| | +-- chalk@1.1.3
| | | +-- ansi-styles@2.2.1
| | | +-- escape-string-regexp@1.0.5 deduped
| | | +-- has-ansi@2.0.0
| | | | `-- ansi-regex@2.1.1 deduped
| | | +-- strip-ansi@3.0.1
| | | | `-- ansi-regex@2.1.1
| | | `-- supports-color@2.0.0
| | +-- esutils@2.0.2 deduped
| | `-- js-tokens@3.0.2 deduped
| +-- chalk@2.3.0
| | +-- ansi-styles@3.2.0
| | | `-- color-convert@1.9.1
| | |   `-- color-name@1.1.3
| | +-- escape-string-regexp@1.0.5
| | `-- supports-color@4.5.0
| |   `-- has-flag@2.0.0
| +-- concat-stream@1.6.0
| | +-- inherits@2.0.3
| | +-- readable-stream@2.3.3
| | | +-- core-util-is@1.0.2
| | | +-- inherits@2.0.3 deduped
| | | +-- isarray@1.0.0 deduped
| | | +-- process-nextick-args@1.0.7
| | | +-- safe-buffer@5.1.1
| | | +-- string_decoder@1.0.3
| | | | `-- safe-buffer@5.1.1 deduped
| | | `-- util-deprecate@1.0.2
| | `-- typedarray@0.0.6
| +-- cross-spawn@5.1.0
| | +-- lru-cache@4.1.1
| | | +-- pseudomap@1.0.2
| | | `-- yallist@2.1.2
| | +-- shebang-command@1.2.0
| | | `-- shebang-regex@1.0.0
| | `-- which@1.3.0
| |   `-- isexe@2.0.0
| +-- debug@3.1.0
| | `-- ms@2.0.0
| +-- doctrine@2.0.0
| | +-- esutils@2.0.2 deduped
| | `-- isarray@1.0.0
| +-- eslint-scope@3.7.1
| | +-- esrecurse@4.2.0
| | | +-- estraverse@4.2.0 deduped
| | | `-- object-assign@4.1.1 deduped
| | `-- estraverse@4.2.0 deduped
| +-- espree@3.5.2
| | +-- acorn@5.2.1
| | `-- acorn-jsx@3.0.1
| |   `-- acorn@3.3.0
| +-- esquery@1.0.0
| | `-- estraverse@4.2.0 deduped
| +-- estraverse@4.2.0
| +-- esutils@2.0.2
| +-- file-entry-cache@2.0.0
| | +-- flat-cache@1.3.0
| | | +-- circular-json@0.3.3
| | | +-- del@2.2.2
| | | | +-- globby@5.0.0
| | | | | +-- array-union@1.0.2
| | | | | | `-- array-uniq@1.0.3
| | | | | +-- arrify@1.0.1
| | | | | +-- glob@7.1.2 deduped
| | | | | +-- object-assign@4.1.1 deduped
| | | | | +-- pify@2.3.0 deduped
| | | | | `-- pinkie-promise@2.0.1 deduped
| | | | +-- is-path-cwd@1.0.0
| | | | +-- is-path-in-cwd@1.0.0
| | | | | `-- is-path-inside@1.0.0
| | | | |   `-- path-is-inside@1.0.2 deduped
| | | | +-- object-assign@4.1.1 deduped
| | | | +-- pify@2.3.0
| | | | +-- pinkie-promise@2.0.1
| | | | | `-- pinkie@2.0.4
| | | | `-- rimraf@2.6.2
| | | |   `-- glob@7.1.2 deduped
| | | +-- graceful-fs@4.1.11
| | | `-- write@0.2.1
| | |   `-- mkdirp@0.5.1 deduped
| | `-- object-assign@4.1.1
| +-- functional-red-black-tree@1.0.1
| +-- glob@7.1.2
| | +-- fs.realpath@1.0.0
| | +-- inflight@1.0.6
| | | +-- once@1.4.0 deduped
| | | `-- wrappy@1.0.2
| | +-- inherits@2.0.3 deduped
| | +-- minimatch@3.0.4 deduped
| | +-- once@1.4.0
| | | `-- wrappy@1.0.2 deduped
| | `-- path-is-absolute@1.0.1
| +-- globals@9.18.0
| +-- ignore@3.3.7
| +-- imurmurhash@0.1.4
| +-- inquirer@3.3.0
| | +-- ansi-escapes@3.0.0
| | +-- chalk@2.3.0 deduped
| | +-- cli-cursor@2.1.0
| | | `-- restore-cursor@2.0.0
| | |   +-- onetime@2.0.1
| | |   | `-- mimic-fn@1.1.0
| | |   `-- signal-exit@3.0.2
| | +-- cli-width@2.2.0
| | +-- external-editor@2.0.5
| | | +-- iconv-lite@0.4.19
| | | +-- jschardet@1.6.0
| | | `-- tmp@0.0.33
| | |   `-- os-tmpdir@1.0.2
| | +-- figures@2.0.0
| | | `-- escape-string-regexp@1.0.5 deduped
| | +-- lodash@4.17.4 deduped
| | +-- mute-stream@0.0.7
| | +-- run-async@2.3.0
| | | `-- is-promise@2.1.0
| | +-- rx-lite@4.0.8
| | +-- rx-lite-aggregates@4.0.8
| | | `-- rx-lite@4.0.8 deduped
| | +-- string-width@2.1.1
| | | +-- is-fullwidth-code-point@2.0.0
| | | `-- strip-ansi@4.0.0 deduped
| | +-- strip-ansi@4.0.0 deduped
| | `-- through@2.3.8
| +-- is-resolvable@1.0.0
| | `-- tryit@1.0.3
| +-- js-yaml@3.10.0
| | +-- argparse@1.0.9
| | | `-- sprintf-js@1.0.3
| | `-- esprima@4.0.0
| +-- json-stable-stringify-without-jsonify@1.0.1
| +-- levn@0.3.0
| | +-- prelude-ls@1.1.2
| | `-- type-check@0.3.2
| |   `-- prelude-ls@1.1.2 deduped
| +-- lodash@4.17.4
| +-- minimatch@3.0.4
| | `-- brace-expansion@1.1.8
| |   +-- balanced-match@1.0.0
| |   `-- concat-map@0.0.1
| +-- mkdirp@0.5.1
| | `-- minimist@0.0.8
| +-- natural-compare@1.4.0
| +-- optionator@0.8.2
| | +-- deep-is@0.1.3
| | +-- fast-levenshtein@2.0.6
| | +-- levn@0.3.0 deduped
| | +-- prelude-ls@1.1.2 deduped
| | +-- type-check@0.3.2 deduped
| | `-- wordwrap@1.0.0
| +-- path-is-inside@1.0.2
| +-- pluralize@7.0.0
| +-- progress@2.0.0
| +-- require-uncached@1.0.3
| | +-- caller-path@0.1.0
| | | `-- callsites@0.2.0
| | `-- resolve-from@1.0.1
| +-- semver@5.4.1
| +-- strip-ansi@4.0.0
| | `-- ansi-regex@3.0.0
| +-- strip-json-comments@2.0.1
| +-- table@4.0.2
| | +-- ajv@5.3.0 deduped
| | +-- ajv-keywords@2.1.1
| | +-- chalk@2.3.0 deduped
| | +-- lodash@4.17.4 deduped
| | +-- slice-ansi@1.0.0
| | | `-- is-fullwidth-code-point@2.0.0 deduped
| | `-- string-width@2.1.1 deduped
| `-- text-table@0.2.0
`-- vue-eslint-parser@2.0.1-beta.2
  +-- debug@3.1.0 deduped
  +-- eslint-scope@3.7.1 deduped
  +-- espree@3.5.2 deduped
  +-- esquery@1.0.0 deduped
  `-- lodash@4.17.4 deduped

@Robula
Copy link
Author

Robula commented Nov 11, 2017

Sure, here you go
Robs-MBP:vep-issue robfinbow$ npm ls
/Users/robfinbow/DEV/vep-issue
├─┬ babel-eslint@8.0.2
│ ├─┬ @babel/code-frame@7.0.0-beta.31
│ │ ├── chalk@2.3.0 deduped
│ │ ├── esutils@2.0.2 deduped
│ │ └── js-tokens@3.0.2
│ ├─┬ @babel/traverse@7.0.0-beta.31
│ │ ├── @babel/code-frame@7.0.0-beta.31 deduped
│ │ ├─┬ @babel/helper-function-name@7.0.0-beta.31
│ │ │ ├─┬ @babel/helper-get-function-arity@7.0.0-beta.31
│ │ │ │ └── @babel/types@7.0.0-beta.31 deduped
│ │ │ ├─┬ @babel/template@7.0.0-beta.31
│ │ │ │ ├── @babel/code-frame@7.0.0-beta.31 deduped
│ │ │ │ ├── @babel/types@7.0.0-beta.31 deduped
│ │ │ │ ├── babylon@7.0.0-beta.31 deduped
│ │ │ │ └── lodash@4.17.4 deduped
│ │ │ ├── @babel/traverse@7.0.0-beta.31 deduped
│ │ │ └── @babel/types@7.0.0-beta.31 deduped
│ │ ├── @babel/types@7.0.0-beta.31 deduped
│ │ ├── babylon@7.0.0-beta.31 deduped
│ │ ├── debug@3.1.0 deduped
│ │ ├── globals@10.3.0
│ │ ├─┬ invariant@2.2.2
│ │ │ └─┬ loose-envify@1.3.1
│ │ │   └── js-tokens@3.0.2 deduped
│ │ └── lodash@4.17.4 deduped
│ ├─┬ @babel/types@7.0.0-beta.31
│ │ ├── esutils@2.0.2 deduped
│ │ ├── lodash@4.17.4 deduped
│ │ └── to-fast-properties@2.0.0
│ └── babylon@7.0.0-beta.31
├─┬ eslint@4.10.0
│ ├─┬ ajv@5.3.0
│ │ ├── co@4.6.0
│ │ ├── fast-deep-equal@1.0.0
│ │ ├── fast-json-stable-stringify@2.0.0
│ │ └── json-schema-traverse@0.3.1
│ ├─┬ babel-code-frame@6.26.0
│ │ ├─┬ chalk@1.1.3
│ │ │ ├── ansi-styles@2.2.1
│ │ │ ├── escape-string-regexp@1.0.5 deduped
│ │ │ ├─┬ has-ansi@2.0.0
│ │ │ │ └── ansi-regex@2.1.1 deduped
│ │ │ ├─┬ strip-ansi@3.0.1
│ │ │ │ └── ansi-regex@2.1.1
│ │ │ └── supports-color@2.0.0
│ │ ├── esutils@2.0.2 deduped
│ │ └── js-tokens@3.0.2 deduped
│ ├─┬ chalk@2.3.0
│ │ ├─┬ ansi-styles@3.2.0
│ │ │ └─┬ color-convert@1.9.1
│ │ │   └── color-name@1.1.3
│ │ ├── escape-string-regexp@1.0.5
│ │ └─┬ supports-color@4.5.0
│ │   └── has-flag@2.0.0
│ ├─┬ concat-stream@1.6.0
│ │ ├── inherits@2.0.3
│ │ ├─┬ readable-stream@2.3.3
│ │ │ ├── core-util-is@1.0.2
│ │ │ ├── inherits@2.0.3 deduped
│ │ │ ├── isarray@1.0.0 deduped
│ │ │ ├── process-nextick-args@1.0.7
│ │ │ ├── safe-buffer@5.1.1
│ │ │ ├─┬ string_decoder@1.0.3
│ │ │ │ └── safe-buffer@5.1.1 deduped
│ │ │ └── util-deprecate@1.0.2
│ │ └── typedarray@0.0.6
│ ├─┬ cross-spawn@5.1.0
│ │ ├─┬ lru-cache@4.1.1
│ │ │ ├── pseudomap@1.0.2
│ │ │ └── yallist@2.1.2
│ │ ├─┬ shebang-command@1.2.0
│ │ │ └── shebang-regex@1.0.0
│ │ └─┬ which@1.3.0
│ │   └── isexe@2.0.0
│ ├─┬ debug@3.1.0
│ │ └── ms@2.0.0
│ ├─┬ doctrine@2.0.0
│ │ ├── esutils@2.0.2 deduped
│ │ └── isarray@1.0.0
│ ├─┬ eslint-scope@3.7.1
│ │ ├─┬ esrecurse@4.2.0
│ │ │ ├── estraverse@4.2.0 deduped
│ │ │ └── object-assign@4.1.1 deduped
│ │ └── estraverse@4.2.0 deduped
│ ├─┬ espree@3.5.1
│ │ ├── acorn@5.2.1
│ │ └─┬ acorn-jsx@3.0.1
│ │   └── acorn@3.3.0
│ ├─┬ esquery@1.0.0
│ │ └── estraverse@4.2.0 deduped
│ ├── estraverse@4.2.0
│ ├── esutils@2.0.2
│ ├─┬ file-entry-cache@2.0.0
│ │ ├─┬ flat-cache@1.3.0
│ │ │ ├── circular-json@0.3.3
│ │ │ ├─┬ del@2.2.2
│ │ │ │ ├─┬ globby@5.0.0
│ │ │ │ │ ├─┬ array-union@1.0.2
│ │ │ │ │ │ └── array-uniq@1.0.3
│ │ │ │ │ ├── arrify@1.0.1
│ │ │ │ │ ├── glob@7.1.2 deduped
│ │ │ │ │ ├── object-assign@4.1.1 deduped
│ │ │ │ │ ├── pify@2.3.0 deduped
│ │ │ │ │ └── pinkie-promise@2.0.1 deduped
│ │ │ │ ├── is-path-cwd@1.0.0
│ │ │ │ ├─┬ is-path-in-cwd@1.0.0
│ │ │ │ │ └─┬ is-path-inside@1.0.0
│ │ │ │ │   └── path-is-inside@1.0.2 deduped
│ │ │ │ ├── object-assign@4.1.1 deduped
│ │ │ │ ├── pify@2.3.0
│ │ │ │ ├─┬ pinkie-promise@2.0.1
│ │ │ │ │ └── pinkie@2.0.4
│ │ │ │ └─┬ rimraf@2.6.2
│ │ │ │   └── glob@7.1.2 deduped
│ │ │ ├── graceful-fs@4.1.11
│ │ │ └─┬ write@0.2.1
│ │ │   └── mkdirp@0.5.1 deduped
│ │ └── object-assign@4.1.1
│ ├── functional-red-black-tree@1.0.1
│ ├─┬ glob@7.1.2
│ │ ├── fs.realpath@1.0.0
│ │ ├─┬ inflight@1.0.6
│ │ │ ├── once@1.4.0 deduped
│ │ │ └── wrappy@1.0.2
│ │ ├── inherits@2.0.3 deduped
│ │ ├── minimatch@3.0.4 deduped
│ │ ├─┬ once@1.4.0
│ │ │ └── wrappy@1.0.2 deduped
│ │ └── path-is-absolute@1.0.1
│ ├── globals@9.18.0
│ ├── ignore@3.3.7
│ ├── imurmurhash@0.1.4
│ ├─┬ inquirer@3.3.0
│ │ ├── ansi-escapes@3.0.0
│ │ ├── chalk@2.3.0 deduped
│ │ ├─┬ cli-cursor@2.1.0
│ │ │ └─┬ restore-cursor@2.0.0
│ │ │   ├─┬ onetime@2.0.1
│ │ │   │ └── mimic-fn@1.1.0
│ │ │   └── signal-exit@3.0.2
│ │ ├── cli-width@2.2.0
│ │ ├─┬ external-editor@2.0.5
│ │ │ ├── iconv-lite@0.4.19
│ │ │ ├── jschardet@1.6.0
│ │ │ └─┬ tmp@0.0.33
│ │ │   └── os-tmpdir@1.0.2
│ │ ├─┬ figures@2.0.0
│ │ │ └── escape-string-regexp@1.0.5 deduped
│ │ ├── lodash@4.17.4 deduped
│ │ ├── mute-stream@0.0.7
│ │ ├─┬ run-async@2.3.0
│ │ │ └── is-promise@2.1.0
│ │ ├── rx-lite@4.0.8
│ │ ├─┬ rx-lite-aggregates@4.0.8
│ │ │ └── rx-lite@4.0.8 deduped
│ │ ├─┬ string-width@2.1.1
│ │ │ ├── is-fullwidth-code-point@2.0.0
│ │ │ └── strip-ansi@4.0.0 deduped
│ │ ├── strip-ansi@4.0.0 deduped
│ │ └── through@2.3.8
│ ├─┬ is-resolvable@1.0.0
│ │ └── tryit@1.0.3
│ ├─┬ js-yaml@3.10.0
│ │ ├─┬ argparse@1.0.9
│ │ │ └── sprintf-js@1.0.3
│ │ └── esprima@4.0.0
│ ├─┬ json-stable-stringify@1.0.1
│ │ └── jsonify@0.0.0
│ ├─┬ levn@0.3.0
│ │ ├── prelude-ls@1.1.2
│ │ └─┬ type-check@0.3.2
│ │   └── prelude-ls@1.1.2 deduped
│ ├── lodash@4.17.4
│ ├─┬ minimatch@3.0.4
│ │ └─┬ brace-expansion@1.1.8
│ │   ├── balanced-match@1.0.0
│ │   └── concat-map@0.0.1
│ ├─┬ mkdirp@0.5.1
│ │ └── minimist@0.0.8
│ ├── natural-compare@1.4.0
│ ├─┬ optionator@0.8.2
│ │ ├── deep-is@0.1.3
│ │ ├── fast-levenshtein@2.0.6
│ │ ├── levn@0.3.0 deduped
│ │ ├── prelude-ls@1.1.2 deduped
│ │ ├── type-check@0.3.2 deduped
│ │ └── wordwrap@1.0.0
│ ├── path-is-inside@1.0.2
│ ├── pluralize@7.0.0
│ ├── progress@2.0.0
│ ├─┬ require-uncached@1.0.3
│ │ ├─┬ caller-path@0.1.0
│ │ │ └── callsites@0.2.0
│ │ └── resolve-from@1.0.1
│ ├── semver@5.4.1
│ ├─┬ strip-ansi@4.0.0
│ │ └── ansi-regex@3.0.0
│ ├── strip-json-comments@2.0.1
│ ├─┬ table@4.0.2
│ │ ├── ajv@5.3.0 deduped
│ │ ├── ajv-keywords@2.1.1
│ │ ├── chalk@2.3.0 deduped
│ │ ├── lodash@4.17.4 deduped
│ │ ├─┬ slice-ansi@1.0.0
│ │ │ └── is-fullwidth-code-point@2.0.0 deduped
│ │ └── string-width@2.1.1 deduped
│ └── text-table@0.2.0
├── vue@2.5.3
├── vue-class-component@6.1.0
└─┬ vue-eslint-parser@2.0.1-beta.2
  ├── debug@3.1.0 deduped
  ├── eslint-scope@3.7.1 deduped
  ├── espree@3.5.1 deduped
  ├── esquery@1.0.0 deduped
  └── lodash@4.17.4 deduped

I can't see much difference except that you have eslint-plugin-react (what treachery! 😄)

@mysticatea
Copy link
Member

mysticatea commented Nov 11, 2017

Thank you.

But sorry, I didn't find meaningful different.... (I checked estraverse, babel-eslint, eslint-scope. The babel-eslint is finding eslint-scope and estraverse in order to monkey-patching. If there is different dedupe situation, I guessed it's the cause. But no...)

I realized your screenshot has yarn.lock, so I tried to use yarn, but I got the same result (no errors)...

@mysticatea
Copy link
Member

Maybe I got it.

@cmizzi
Copy link

cmizzi commented Nov 21, 2017

I've got the same bug here (my configuration seems to be the same as @Robula)

@mysticatea
Copy link
Member

Yes. This happens when a code is using stage 0-3 syntaxes or type annotations. I'm working on this, but I need more time.

The cause is that vue-eslint-parser does not get the monkey patching of babel-eslint. The monkey patching affects to ESLint core, but does not to this parser. I'm working to remove the monkey patching on the new feature of ESLint core.

@Robula
Copy link
Author

Robula commented Nov 22, 2017

Thank you for the explanation and your efforts to resolve this @mysticatea.

@mysticatea
Copy link
Member

Thank you for your patience.

I'm still working in progress, but I have gotten that eslint/eslint#8755 is accepted at the last ESLint TSC Meeting and can advance babel/babel-eslint#542 to remove the monkey patching.

@mysticatea
Copy link
Member

eslint@4.14.0 has been released. It includes the enhancement and I removed the monkeypatch from babel-eslint. I'll advance to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants