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

Support id selectors #80

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Support id selectors #80

wants to merge 3 commits into from

Conversation

Cellule
Copy link

@Cellule Cellule commented Aug 30, 2023

Fixes #54

@@ -51,7 +51,7 @@ export const getRegularClassesMap = (ast: gASTNode): classMapType => {
fp.map('content'),
fp.filter({ type: 'ident' }),
fp.flatMap('content'),
fp.filter({ type: 'class' }),
fp.filter(node => node.is('class') || node.is('id')),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Love the initiative! A small suggestion here: This function is intended to return regular classes. What do you think about creating a new one for retrieving ids or renaming the function?

Copy link
Author

Choose a reason for hiding this comment

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

Renamed the function because it would be a shame to have to go over the ast one more time just for that

Comment on lines +365 to +373
test({
code: `
import s from './id.scss';

export default Foo = () => (
<div id={s.scopedId}></div>
);
`,
}),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this work with no-unused-class as well?

Copy link
Author

Choose a reason for hiding this comment

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

Added tests for no-unused-class as well as an error test for no-undef-class

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

Successfully merging this pull request may close these issues.

Why do you support classes only, no IDs?
2 participants