-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Replace context.sourceCode
with context.getSourceCode()
in no-war…
#17325
Conversation
…ning-comments.js For the rule `no-warning-comments` the variable `sourceCode` was undefined and resulting in the following error: ``` $ yarn lint yarn run v1.9.4 $ getk run lint-es '**/*.{js,jsx,ts,tsx}' --ignore-path .gitignore Oops! Something went wrong! :( ESLint: 8.43.0 TypeError: Cannot read properties of undefined (reading 'getAllComments') Occurred while linting /Users/shermam/Projects/format-location/.eslintrc.js:1 Rule: "unicorn/expiring-todo-comments" at Object.Program (/Users/shermam/Projects/format-location/node_modules/eslint/lib/rules/no-warning-comments.js:193:45) at Program (/Users/shermam/Projects/format-location/node_modules/eslint-plugin-unicorn/rules/expiring-todo-comments.js:511:10) at /Users/shermam/Projects/format-location/node_modules/eslint-plugin-unicorn/rules/utils/rule.js:39:18 at ruleErrorHandler (/Users/shermam/Projects/format-location/node_modules/eslint/lib/linter/linter.js:1050:28) at /Users/shermam/Projects/format-location/node_modules/eslint/lib/linter/safe-emitter.js:45:58 at Array.forEach (<anonymous>) at Object.emit (/Users/shermam/Projects/format-location/node_modules/eslint/lib/linter/safe-emitter.js:45:38) at NodeEventGenerator.applySelector (/Users/shermam/Projects/format-location/node_modules/eslint/lib/linter/node-event-generator.js:297:26) at NodeEventGenerator.applySelectors (/Users/shermam/Projects/format-location/node_modules/eslint/lib/linter/node-event-generator.js:326:22) at NodeEventGenerator.enterNode (/Users/shermam/Projects/format-location/node_modules/eslint/lib/linter/node-event-generator.js:340:14) at CodePathAnalyzer.enterNode (/Users/shermam/Projects/format-location/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:795:23) at /Users/shermam/Projects/format-location/node_modules/eslint/lib/linter/linter.js:1085:32 at Array.forEach (<anonymous>) at runRules (/Users/shermam/Projects/format-location/node_modules/eslint/lib/linter/linter.js:1080:15) at Linter._verifyWithoutProcessors (/Users/shermam/Projects/format-location/node_modules/eslint/lib/linter/linter.js:1330:31) at Linter._verifyWithoutProcessors (/Users/shermam/Projects/format-location/node_modules/eslint-plugin-eslint-comments/lib/utils/patch.js:166:36) at Linter._verifyWithConfigArray (/Users/shermam/Projects/format-location/node_modules/eslint/lib/linter/linter.js:1706:21) at Linter.verify (/Users/shermam/Projects/format-location/node_modules/eslint/lib/linter/linter.js:1412:65) at Linter.verifyAndFix (/Users/shermam/Projects/format-location/node_modules/eslint/lib/linter/linter.js:1967:29) at verifyText (/Users/shermam/Projects/format-location/node_modules/eslint/lib/cli-engine/cli-engine.js:245:48) at CLIEngine.executeOnFiles (/Users/shermam/Projects/format-location/node_modules/eslint/lib/cli-engine/cli-engine.js:825:28) at ESLint.lintFiles (/Users/shermam/Projects/format-location/node_modules/eslint/lib/eslint/eslint.js:551:23) at Object.execute (/Users/shermam/Projects/format-location/node_modules/eslint/lib/cli.js:391:36) at async main (/Users/shermam/Projects/format-location/node_modules/eslint/bin/eslint.js:135:24) error Command failed with exit code 2. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ``` This change set updates the code to use `context.getSourceCode()` instead of `context.sourceCode` which is no longer defined.
|
Hi @CamillaTeodoro!, thanks for the Pull Request The first commit message isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.
To Fix: You can fix this problem by running Read more about contributing to ESLint here |
✅ Deploy Preview for docs-eslint canceled.
|
Hi @CamillaTeodoro! Thanks for the PR but we can't accept this change because the current code is correct and this is actually a problem in eslint-plugin-unicorn's rule |
…ning-comments.js
For the rule
no-warning-comments
the variablesourceCode
was undefined and resulting in the following error:This change set updates the code to use
context.getSourceCode()
instead ofcontext.sourceCode
which is no longer defined.Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
Is there anything you'd like reviewers to focus on?