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 template literal interpolations in media-feature-name-no-unknown #4987

Closed
Tracked by #4574
maclockard opened this issue Oct 13, 2020 · 3 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 upstream relates to an upstream package

Comments

@maclockard
Copy link

Clearly describe the bug

There are false positives when specifying a media query value using CSS in JS.

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

media-feature-name-no-unknown

What code is needed to reproduce the bug?

const StyledLogo = styled.div`
  overflow: hidden;

  @media (max-width: ${({ theme }) => theme.mediaQuery.MEDIUM}px) {
    width: 18px;
  }
`;

What stylelint configuration is needed to reproduce the bug?

{
  "rules": {
    "media-feature-name-no-unknown": true
  }
}

Which version of stylelint are you using?

13.6.1

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

CLI with stylelint './**/*.{tsx,ts,css}

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

Yes, its related to using CSS in JS using styled-components

What did you expect to happen?

No errors to be flagged.

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

The following errors were flagged:

components/app/NavigationBar.tsx
 75:11  ✖  Unexpected unknown media feature name "m"   media-feature-name-no-unknown

This is related to #4574

@maclockard
Copy link
Author

Also tested 13.7.2, still got the failure though

@hudochenkov hudochenkov changed the title Media Query false positive with CSS in JS Fix false positives for template literal interpolations in media-feature-name-no-unknown Oct 13, 2020
@hudochenkov hudochenkov mentioned this issue Oct 13, 2020
23 tasks
@hudochenkov hudochenkov 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 upstream relates to an upstream package labels Oct 13, 2020
@hudochenkov
Copy link
Member

It is more likely related to other issues with template literals interpolations listed in #4574. There is some work is happening to fix this in #4944.

@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 upstream relates to an upstream package
Development

No branches or pull requests

3 participants