-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
feat: add support for Import Attributes and RegExp Modifiers #19076
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
Conversation
✅ Deploy Preview for docs-eslint canceled.
|
Browser test is now constantly failing in CI:
It works for me locally. @christian-bromann any ideas what might be causing this? |
Yes, we unfortunately pushed a buggy version. I triggered a new release which is available on NPM ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM. Just one spot for a bit of refactoring.
(parent.key === node || parent.value === node && parent.shorthand && !parent.method) && | ||
parent.parent.type === "ObjectExpression" | ||
) { | ||
const objectExpression = parent.parent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you're only using this to get objectExpression.parent
below. Maybe we could simplify by setting this to:
const objectExpression = parent.parent; | |
const objectExpressionParent = parent.parent.parent; |
And then just using objectExpressionParent
below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
objectExpression
is used here, on the right side:
eslint/lib/rules/utils/ast-utils.js
Line 1159 in 263a7e5
objectExpression.parent.options === objectExpression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good call. There's still five references to objectExpression.parent
, though, so I'd still like to see us eliminate unnecessary prototype lookups for the number of times this will be called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 474a29c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Giving another day so others have a chance to review.
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
[x] Add something to the core
[ ] Other, please explain:
Closes #19014
Closes #19073
What changes did you make? (Give an overview)
espree
,eslint-scope
,eslint-visitor-keys
.camelcase
,id-denylist
,id-length
,id-match
.no-underscore-dangle
to verify that it ignores import attribute keys (this rule actually ignores object properties except methods).astUtils.needsPrecedingSemicolon
(since there are no unit tests, I added tests for theno-array-constructor
rule) to verify it returnsfalse
for nodes after import/export declarations with attributes.prefer-regex-literals
andprefer-named-capture-group
rules to verify behavior with regex pattern modifiers.Is there anything you'd like reviewers to focus on?