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

Fix false positives for single value within template literal #4655

Closed
Tracked by #4574
jdvivar opened this issue Mar 19, 2020 · 2 comments
Closed
Tracked by #4574

Fix false positives for single value within template literal #4655

jdvivar opened this issue Mar 19, 2020 · 2 comments
Labels
status: ready to implement is ready to be worked on by someone syntax: css-in-js relates to JS objects & template literals type: bug a problem with a feature or rule

Comments

@jdvivar
Copy link

jdvivar commented Mar 19, 2020

I've looked for similar bugs and although there are similar titles I couldn't find this one. It's not in the changelog and it's reproducible in the playground demo. I also created this small repo to more easily reproduce it: https://github.com/jdvivar/demo-bug-stylelint

Clearly describe the bug

False positive on single css-in-js value

Which rule, if any, is the bug related to?

Not a rule, but a syntax error

What code is needed to reproduce the bug?

with this test.ts file:

import { css } from 'lit-element'
export const max = css`100px`

What stylelint configuration is needed to reproduce the bug?

and this config .stylelintrc.json:

{
  "extends": "stylelint-config-standard"
}

Which version of stylelint are you using?

13.2.1

How are you running stylelint: CLI, PostCSS plugin, Node.js API?

CLI with stylelint --syntax css-in-js "test.ts"
CLI with stylelint "test.ts"

Both with the same output

Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?

Yep, CSS-in-JS

What did you expect to happen?

Nothing to be flagged

What actually happened (e.g. what warnings or errors did you get)?

test.ts
 2:24  ✖  Unknown word   CssSyntaxError
@jeddy3 jeddy3 changed the title False positive on single css-in-js value Fix false positives for single value within template literal Mar 20, 2020
@jeddy3 jeddy3 mentioned this issue Mar 20, 2020
23 tasks
@jeddy3 jeddy3 added status: ready to implement is ready to be worked on by someone syntax: css-in-js relates to JS objects & template literals type: bug a problem with a feature or rule labels Mar 20, 2020
@jeddy3
Copy link
Member

jeddy3 commented Mar 20, 2020

@jdvivar Thanks for the clear report, reproducible demo and repository!

It's likely a problem with the parser stylelint uses to support CSS-in-JS. I've added this issue to #4574, which is a growing list of the problems with the syntax that we need help to fix.

Please consider contributing to the parser if you have time.

@jeddy3
Copy link
Member

jeddy3 commented Jan 18, 2022

Closing as the syntax option was removed for the 14.0.0 release. (See the migration guide.)

We'll also be deprecating our forked CSS-in-JS package, in favour of leaner custom syntaxes.

Please consider writing a custom syntax specific to the CSS-in-JS library in this issue and fixing the bug there.

@jeddy3 jeddy3 closed this as completed Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready to implement is ready to be worked on by someone syntax: css-in-js relates to JS objects & template literals type: bug a problem with a feature or rule
Development

No branches or pull requests

2 participants