-
Notifications
You must be signed in to change notification settings - Fork 35
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
eslint rules needed for cssx #10
Comments
Hey @rosskevin, I'm not sure how to approach this problem. For me it looks like the cssx block should be totally ignored by eslint. Mainly because CSSX is a CSS specific thing while eslint is a tool for JavaScript and JSX. If we want to lint the CSSX we should be probably using csslint (or stylelint) somehow. I'll leave this open and will try finding some sensible solution. |
I see. This will be tough. Is there any way to ignore a code block (not just a line). |
That's what I was wondering, but there were so many rules in your own .eslintrc that I couldn't review each one. I wasn't sure if you already knew a specific rule. Would your eslint code for this repo allow the code above to pass? |
I know we can disable/re-enable for each, but that seems only a temporary workaround (painful and messy): /* eslint-disable */
const styles = ...
/*eslint-enable */ EDIT: doesn't work - see below. |
This might be tougher than I thought, I added the eslint disable and it still fails:
related: |
I agree this looks tough. I think figuring it out needs to be a priority if CSSX is to be adopted. As-is, failing eslint (parsing) means that a project would either need to toss out eslint validation, or toss out CSSX. This looks like a huge barrier for adoption. |
A lead: babel-eslint. I'm currently using this already in my starter kit (because I'm using relay): |
FYI - I'm using |
Definitely I'll make eslint work with CSSX. At least not break the other linting. |
Seems like the |
Not really. |
hzoo provided some good background on the #linting slack channel:
|
Yep, that's what I thought. I'll try finding some time this weekend. |
I read the PR, I agree with all the reasons you have built CSSX. These aren't easy things to tackle so I just want to say thank you upfront for all the effort thus far and looking into this. With the big changes happening in how we create/style front-ends, I think cssx could be a substantial part of that future. |
Oh thank you @rosskevin. It was really fun working on it. The whole parsing and compiling bit was really interesting. I'll try make eslint work with JSX and CSSX in one file. If possible will bring some css linting to the table. |
@rosskevin The problem should be fixed now. Please use eslint-plugin-cssx. It's a plugin for ESLint that transforms the CSSX expressions to empty objects. For example:
to
It keeps the number of lines used by CSSX so the rest of the errors/warnings (if any) are reported at the right line. |
I didn't add CSSLint even though this is possible (and quite easy) but CSSX is not example a valid CSS. So this integration may cause more issues then it solves. |
I'm using
standard
andstandard-react
settings for eslint currently, and eslint is complaining aboutcolor: #333
.Sample repo
Are there a specific recommended set of rules we need to configure to be CSSX friendly? I tried looking at your file but it doesn't extend a preset, it is manual.
This is my starting point:
The text was updated successfully, but these errors were encountered: