-
-
Notifications
You must be signed in to change notification settings - Fork 19
feat: add new rule no-duplicate-keyframe-selectors
#143
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
base: main
Are you sure you want to change the base?
Conversation
eslint.config.js
Outdated
@@ -30,7 +31,7 @@ const eslintPluginTestsRecommendedConfig = | |||
|
|||
export default [ | |||
{ | |||
ignores: ["**/tests/fixtures/", "**/dist/"], | |||
ignores: ["**/tests/fixtures/", "**/dist/", "test.css"], |
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.
Added this test.css
for local testing purposes, similar to the eslint repo

62ec302
to
470e3a9
Compare
@snitin315 can you check the merge conflicts? |
@@ -30,7 +31,7 @@ const eslintPluginTestsRecommendedConfig = | |||
//----------------------------------------------------------------------------- | |||
|
|||
export default defineConfig([ | |||
globalIgnores(["**/tests/fixtures/", "**/dist/"]), | |||
globalIgnores(["**/tests/fixtures/", "**/dist/", "test.css"]), |
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.
@nzakas resolved. |
{ | ||
files: ["**/*.css"], | ||
language: "css/css", | ||
...css.configs.recommended, |
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.
can we use extends
here instead?
|
||
create(context) { | ||
return { | ||
Atrule(node) { |
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.
This method is traversing the at-rule itself instead of letting the rule do so.
It would be more efficient to do "Atrule[name=keyframes]"
, "Atrule[name=keyframes]:exit"
and then look for the selectors in between.
See https://github.com/eslint/css/blob/main/src/rules/use-layers.js as an example.
Prerequisites checklist
What is the purpose of this pull request?
Add new rule
no-duplicate-keyframe-selectors
.What changes did you make? (Give an overview)
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Related Issues
Fix #141
Is there anything you'd like reviewers to focus on?