Skip to content
New issue

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

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

Already on GitHub? # to your account

[Feat]: provide compatibility with eslint v9 #3727

Closed

Conversation

antongolub
Copy link

@antongolub antongolub commented Apr 7, 2024

relates #3699
superseeds #3726

@antongolub antongolub marked this pull request as draft April 7, 2024 18:12
@antongolub
Copy link
Author

antongolub commented Apr 7, 2024

Oh... One more.

ESLint: 9.0.0

TypeError: context.getScope is not a function
Occurred while linting /gh/forks/eslint-plugin-react/configs/all.js:3
Rule: "import/no-amd"
    at CallExpression (/gh/forks/eslint-plugin-react/node_modules/eslint-plugin-import/lib/rules/no-amd.js:26:25)
    at ruleErrorHandler (/gh/forks/eslint-plugin-react/node_modules/eslint/lib/linter/linter.js:1145:48)
    at /gh/forks/eslint-plugin-react/node_modules/eslint/lib/linter/safe-emitter.js:45:58

@antongolub
Copy link
Author

Copy link

socket-security bot commented Apr 7, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/eslint@9.0.0 environment, filesystem Transitive: eval, shell, unsafe +80 10.1 MB eslintbot

View full report↗︎

Copy link

codecov bot commented Apr 7, 2024

Codecov Report

Attention: Patch coverage is 99.28571% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 97.57%. Comparing base (e4ecbcf) to head (d87ada8).
Report is 2 commits behind head on master.

Files Patch % Lines
lib/util/ast.js 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3727      +/-   ##
==========================================
- Coverage   97.76%   97.57%   -0.19%     
==========================================
  Files         133      133              
  Lines        9467     9496      +29     
  Branches     3467     3480      +13     
==========================================
+ Hits         9255     9266      +11     
- Misses        212      230      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be very convenient if this was rebased so there was one commit that added and used astUtil.getScope, and the rest was done in their own atomic commits :-)

lib/rules/destructuring-assignment.js Show resolved Hide resolved
lib/rules/jsx-no-undef.js Show resolved Hide resolved
lib/rules/no-access-state-in-setstate.js Show resolved Hide resolved
lib/rules/no-access-state-in-setstate.js Show resolved Hide resolved
lib/rules/no-access-state-in-setstate.js Show resolved Hide resolved
lib/util/ast.js Outdated Show resolved Hide resolved
lib/rules/forbid-prop-types.js Show resolved Hide resolved
Comment on lines +94 to +95
const name = node.name;
const variable = variableUtil.variablesInScope(context, node).find((item) => item.name === name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems like variableUtil.variablesInScope(context, node, node.name) should do this logic for us. am i misreading?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variableUtil.variablesInScope(context, node) returns a set of vars visible from the specified node, and then we pick the one by name, as I understand.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right - but providing the third argument to variablesInScope picks it by name already, doesn't it?

lib/rules/require-render-return.js Outdated Show resolved Hide resolved
lib/util/Components.js Show resolved Hide resolved
);
const scope = astUtil.getScope(context, node);
const allVars = [];
let vars = (scope.childScopes[0] || scope).variableScope;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you elaborate on the need for this? did eslint 9 just straight up remove this functionality?

@ljharb
Copy link
Member

ljharb commented Jul 16, 2024

I believe this was obsoleted by #3759.

@ljharb ljharb closed this Jul 16, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants