Skip to content

"no-multi-spaces" will effect js file and throw a error #161

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

Closed
weizhenye opened this issue Aug 16, 2017 · 3 comments · Fixed by #162
Closed

"no-multi-spaces" will effect js file and throw a error #161

weizhenye opened this issue Aug 16, 2017 · 3 comments · Fixed by #162
Labels

Comments

@weizhenye
Copy link

Tell us about your environment

  • ESLint Version: 4.4.1
  • eslint-plugin-vue Version: 3.12.0
  • Node Version: 8.4.0

Please show your full configuration:

"vue/no-multi-spaces": 2,

What did you do? Please include the actual source code causing the issue.

eslint src/ --ext=js,vue

What did you expect to happen?

What actually happened? Please include the actual, raw output from ESLint.

Cannot read property 'range' of undefined
TypeError: Cannot read property 'range' of undefined
    at TokenStore.getTokens (xxx\node_modules\eslint\lib\token-store\index.js:528:17)
    at Linter.Program (xxx\node_modules\eslint-plugin-vue\lib\rules\no-multi-spaces.js:42:35)
    at emitOne (events.js:120:20)
    at Linter.emit (events.js:210:7)
    at NodeEventGenerator.applySelector (xxx\node_modules\eslint\lib\util\node-event-generator.js:265:26)
    at NodeEventGenerator.applySelectors (xxx\node_modules\eslint\lib\util\node-event-generator.js:294:22)
    at NodeEventGenerator.enterNode (xxx\node_modules\eslint\lib\util\node-event-generator.js:308:14)
    at CodePathAnalyzer.enterNode (xxx\node_modules\eslint\lib\code-path-analysis\code-path-analyzer.js:602:23)
    at Traverser.enter (xxx\node_modules\eslint\lib\linter.js:925:36)
    at Traverser.__execute (xxx\node_modules\estraverse\estraverse.js:397:31)

After I enable the no-multi-spaces rule, it will lint js file and throw a error showed above.

@mysticatea
Copy link
Member

Thank you for this report.

Could you tell us the repro code?
I guess that you can get the triggering file with eslint src/ --ext=js,vue --debug command.

@mysticatea mysticatea added the bug label Aug 16, 2017
@armano2
Copy link
Contributor

armano2 commented Aug 16, 2017

@mysticatea issue happens when you are trying to lint js file

export default {
}

in that case node.templateBody is undefined and getTokens from tokenStore is throwing error

@armano2
Copy link
Contributor

armano2 commented Aug 16, 2017

@weizhenye thank you for reporting issue

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

Successfully merging a pull request may close this issue.

3 participants