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

Linting the following code throws TypeError #45

Open
hakatashi opened this issue Mar 22, 2022 · 1 comment
Open

Linting the following code throws TypeError #45

hakatashi opened this issue Mar 22, 2022 · 1 comment

Comments

@hakatashi
Copy link

const array = [0, 1, 2];
for (let i = 0; i < array.length; i++) {
  let variable;
  console.log(array[i]);
}

Reproduction Steps

$ mkdir eslint-config-repro
$ cd .\eslint-config-repro

$ npm install eslint @mysticatea/eslint-plugin

added 167 packages, and audited 168 packages in 15s

17 packages are looking for funding
  run `npm fund` for details

10 moderate severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

$ cp ../test.js test.js # put the code above

$ npx eslint --plugin "@mysticatea" --rule "@mysticatea/prefer-for-of: error" --parser-options=ecmaVersion:6 test.js
TypeError: Cannot read properties of null (reading 'type')
Occurred while linting C:\Users\hakatashi\Documents\GitHub\eslint-config-repro\test.js:2
    at getElementVariableDeclaration (C:\Users\hakatashi\Documents\GitHub\eslint-config-repro\node_modules\@mysticatea\eslint-plugin\lib\rules\prefer-for-of.js:366:25)
    at fixForStatement (C:\Users\hakatashi\Documents\GitHub\eslint-config-repro\node_modules\@mysticatea\eslint-plugin\lib\rules\prefer-for-of.js:478:21)
    at normalizeFixes (C:\Users\hakatashi\Documents\GitHub\eslint-config-repro\node_modules\eslint\lib\linter\report-translator.js:178:28)
    at C:\Users\hakatashi\Documents\GitHub\eslint-config-repro\node_modules\eslint\lib\linter\report-translator.js:343:49
    at Object.report (C:\Users\hakatashi\Documents\GitHub\eslint-config-repro\node_modules\eslint\lib\linter\linter.js:905:41)
    at ForStatement:exit (C:\Users\hakatashi\Documents\GitHub\eslint-config-repro\node_modules\@mysticatea\eslint-plugin\lib\rules\prefer-for-of.js:610:29)       
    at C:\Users\hakatashi\Documents\GitHub\eslint-config-repro\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (C:\Users\hakatashi\Documents\GitHub\eslint-config-repro\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (C:\Users\hakatashi\Documents\GitHub\eslint-config-repro\node_modules\eslint\lib\linter\node-event-generator.js:254:26) 

Versions

     "@mysticatea/eslint-plugin": "13.0.0",
    "eslint": "6.8.0"
@MichaelDeBoey
Copy link

Hi @hakatashi!

Since this repo is unmaintained, you might want to re-open this issue in the @eslint-community fork https://github.com/eslint-community/eslint-plugin-mysticatea

For more info about why we created this organization, you can read https://eslint.org/blog/2023/03/announcing-eslint-community-org

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

2 participants