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

TypeError when linting if ... else if ... statement #26

Open
merceyz opened this issue Sep 4, 2021 · 0 comments
Open

TypeError when linting if ... else if ... statement #26

merceyz opened this issue Sep 4, 2021 · 0 comments

Comments

@merceyz
Copy link

merceyz commented Sep 4, 2021

The following code snippet causes a TypeError when linting

if (test) {
  test;
} else if (test) {
  test;
}
TypeError: Cannot read property 'type' of null
Occurred while linting C:\temp.ts:1
    at getElseKeyword (C:\.yarn\cache\eslint-plugin-arca-npm-0.10.0-eea2ede7c2-90b0a6bab3.zip\node_modules\eslint-plugin-arca\lib\rules\curly.js:59:26)
    at reportUnnecessaryBraceError (C:\.yarn\cache\eslint-plugin-arca-npm-0.10.0-eea2ede7c2-90b0a6bab3.zip\node_modules\eslint-plugin-arca\lib\rules\curly.js:97:48)
    at checkCurly (C:\.yarn\cache\eslint-plugin-arca-npm-0.10.0-eea2ede7c2-90b0a6bab3.zip\node_modules\eslint-plugin-arca\lib\rules\curly.js:138:17)
    at IfStatement (C:\.yarn\cache\eslint-plugin-arca-npm-0.10.0-eea2ede7c2-90b0a6bab3.zip\node_modules\eslint-plugin-arca\lib\rules\curly.js:269:25)
    at C:\.yarn\cache\eslint-npm-6.8.0-d27045f313-d4edbe6958.zip\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (C:\.yarn\cache\eslint-npm-6.8.0-d27045f313-d4edbe6958.zip\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (C:\.yarn\cache\eslint-npm-6.8.0-d27045f313-d4edbe6958.zip\node_modules\eslint\lib\linter\node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (C:\.yarn\cache\eslint-npm-6.8.0-d27045f313-d4edbe6958.zip\node_modules\eslint\lib\linter\node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (C:\.yarn\cache\eslint-npm-6.8.0-d27045f313-d4edbe6958.zip\node_modules\eslint\lib\linter\node-event-generator.js:297:14)

Reproduced in https://github.com/yarnpkg/berry/tree/9620239f2f124d2b04246ceb4b9cf42a8fae60c9

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

No branches or pull requests

1 participant