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.

Remove stylelint-processor-styled-components in stylelint section

See original GitHub issue

According to those two GitHub issues stylelint-processor-styled-components is deprecated as it provokes bugs and stylelint now supports CSS-in-JS out of the box.

I think we should update the documentation section to avoid newcomers to install it.

I could do the PR if you want to

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:18
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

12reactions
aacgncommented, Oct 25, 2021

Hi, everyone. After some research, I found a configuration that allows me to use stylint with styled-components with the auto-fix feature.

I’m using the postcss-jsx library as my customSyntax analyzer over the stylelint-processor-styled-components and stylelint-config-styled-components.

I just needed to follow the steps below:

  1. Install dependencies
yarn add -D stylelint stylelint-config-concentric-order postcss-jsx postcss-syntax 
  1. Create .stylintrc file at root folder and add some configurations
# stylelint.rc

{
  "extends": ["stylelint-config-concentric-order", "stylelint-config-prettier"],
  "customSyntax": "postcss-jsx"
}
  1. Add scripts to your package.json
# package.json

{ 
    "scripts": {
        "stylelint": "stylelint '**/styles.ts'",
        "stylelint:fix": "stylelint --fix '**/styles.ts'",
    }
}
  1. Run the scripts
yarn stylelint 

Enjoy 😉

5reactions
william-hotmartcommented, Feb 2, 2022

That configuration works for me:

.stylelintrc.json

{
  "extends": ["stylelint-config-recommended", "stylelint-config-styled-components"],
  "customSyntax": "@stylelint/postcss-css-in-js"
  ...
}

package.json

  "scripts": {
    ...
    "stylelint-check": "stylelint './src/**/*.{js,ts,tsx}'",
    "stylelint-check:fix": "stylelint './src/**/*.{js,ts,tsx}' --fix",
    ...
  },
  "devDependencies": {
     ...
     "@stylelint/postcss-css-in-js": "~0.37.2",
     "postcss": "~8.4.6",
     "postcss-syntax": "~0.36.2",
     "stylelint": "~14.2.0",
     "stylelint-config-recommended": "~6.0.0",
     "stylelint-config-styled-components": "~0.1.1",     
     ...
  }

Hope it helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration | Stylelint
You can set the reportDisables secondary option to report any stylelint-disable comments for this rule, effectively disallowing authors to opt out of it....
Read more >
Stylelint | WebStorm Documentation - JetBrains
Stylelint wakes up automatically when you edit a CSS file and highlights the detected problems, see Lint your code below. Before you start....
Read more >
stylelint-config-godaddy - npm
Add a script to the scripts area in your package.json . Linting scss files in the root of your project: "test:styles": " ...
Read more >
FAQ - stylelint
You can also disable a rule for specific sections of your CSS. Refer to the rules section of the configuration guide for more...
Read more >
Stylelint: The Style Sheet Linter We've Always Wanted
Configuration Files #. Configuring is the most difficult part about using a linter — and the most time-consuming. But there are shortcuts and ......
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