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

Improve jsx-components exclusion method #118

Open
MaaitaMohammad opened this issue Jan 7, 2024 · 1 comment
Open

Improve jsx-components exclusion method #118

MaaitaMohammad opened this issue Jan 7, 2024 · 1 comment

Comments

@MaaitaMohammad
Copy link

Problem

There is a single problem bugging me in the plugin related to the jsx-components option, I'm using css classes based icons, as an example:

// eslint-disable-next-line i18next/no-literal-string
<span className="material-symbols-rounded">lock</span>

The class material-symbols-rounded is apparent on a certain tag the text inside it is used to ref the icon needed (in this example this will be viewed as a lock icon), and as you can see in my example I need to ignore this line to stop eslint from shouting at me, also I'm going to exclude all of the spans in the project because that defeats the whole purpose of using the plugin.

Proposed Solution

What I thought of as a solution for this problem is implementing css selectors like syntax for the exclude array in the jsx-components option.
I don't know if the solution I'm proposing is the best one out there but I'm suggesting it because it won't be cause breaking change and it would be very helpful for future uses other than my icons problem.

@hackily
Copy link

hackily commented Nov 1, 2024

I'm not sure what your config looks like exactly, but could you add className to the exclusions array under jsx-attributes?

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

No branches or pull requests

2 participants