question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

stylelint complains about :global selector

See original GitHub issue
// https://github.com/callstack/linaria/blob/60962090410ea3878f3c190817c1667a124d7df9/docs/BASICS.md#adding-global-styles
export const globalCSS = css`
  :global() {
    @import-sanitize;
  }
`

Running stylelint on the above code will give:

src/App.tsx
 9:3  ✖  Unexpected unknown pseudo-class selector ":global"   selector-pseudo-class-no-unknown

My stylelint config is:

extends:
  - stylelint-config-recommended
  - linaria/stylelint-config

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

51reactions
ricardo-teixeiracommented, Nov 9, 2020

For those who still have this problem, just add this rule to your .stylelintrc:

 "rules": {
    ...
    "selector-pseudo-class-no-unknown": [
      true,
      {
        "ignorePseudoClasses": ["global"]
      }
    ]
  }

Reference: https://stylelint.io/user-guide/configure#rules

11reactions
paulrbergcommented, Oct 5, 2019

This also happens for :export.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration | Stylelint
Rules determine what the linter looks for and complains about. There are over 170 rules built into Stylelint. No rules are turned on...
Read more >
Lint your CSS with stylelint
Above all, you need to control your selectors. Ruthlessly. With stylelint, you can disallow selectors that exceed a certain specificity, ...
Read more >
How to keep this CSS code DRY along with satisfying no ...
The desugared CSS has interwoven class selectors and element selectors. ... off the rules for this code block using /* stylelint-disable .
Read more >
Tooling - styled-components
Add a lint:css script to your package.json which runs stylelint with a glob to all ... styled component, what you really interpolate is...
Read more >
An ode to the CSS owl selector - DEV Community ‍ ‍
The * is the universal selector in CSS, it applies to all ... why stylelint complains about having two universal selectors together.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found