-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Getting wrong error "Strings not allowed in JSX files" in prop #2142
Comments
This should definitely be fine since it's in an attribute. |
not sure what's wrong. Here is my package versions:
|
What's your eslint config? |
Here is link to my eslint config file. |
k, looks like a legitimate bug |
hmm, maybe today is my bad day, another strange thing is happening: if I use: items = <li className='suggestions col-12 lighter-color'>{'No matching suggestion.'}</li> I get error: Curly braces are unnecessary here. and I remove curly braces like this: <li className='suggestions col-12 lighter-color'>'No matching suggestion.'</li> I get error: Strings not allowed in JSX files: "No matching suggestion" |
Well that's true - the "no literal" rule explicitly forbids string literals. (it's not in curly braces, so it's a string literal) |
how do I fix it then.. can't keep the curly braces can't remove them either.. |
We'll need a PR to this plugin to fix it. |
can I create a PR.. |
Absolutely! |
@ljharb as you can see in my config file, I am using airbnb style guid too, and there the rule for 'react/jsx-no-literals': ['off', { noStrings: true }], and in my config file I've this rule: 'react/jsx-no-literals': 2 Everything works fine if I make Not sure if it's a bug or kept it this way for a reason. |
one more thing, should we have a little more details about the API and how the control flows in contributing file. LMK if I could be a help.. |
Sure, a separate PR to improve CONTRIBUTING.md is always great. As for |
oh, I see. I will look into it. |
@ljharb I've created a pull request for the issue, but when I see in test file, it doesn't allow strings in props. I've updated the test in PR tho. Just wanted to make sure if we are on the same page. |
Is this something I could start working with? Or is it WIP? |
My mistake 😄 Thanks. |
Yep, now that it's merged. Thanks! |
I'm getting error in this:
The error is:
There is no string in the className, not sure what am I missing here.
The text was updated successfully, but these errors were encountered: