Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
Lint All Sass Files and Fix Only One Rule

I have a front-end build for which I am setting up style linting. The project is using Stylelint. At the moment, there are a bunch of warnings, which I need to address. It appears that some of them are such that I can easily allow the linter to fix them right now. The other ones I would like to take a look at more carefully.

My question is whether it is possible to run the fix such that it applies only one rule and ignores everything else. For example, suppose there is a rule that after a comma there must be a space character. Then, I would like the linter to fix all such occurrences and not touch anything else. How can I do that?

In package.json, I have the following commands:

"lint:styles": "stylelint \"src/**/*.scss\"",
"lint:styles --fix": "stylelint \"src/**/*.scss\" --syntax=scss --fix",
"lint:scripts": "eslint --color ./src/blocks",
"lint:scripts --fix": "eslint --fix --color ./src/blocks",

Some of the lint-related things I am using

"lint-staged": "^10.0.3",
"postcss": "^8.4.4",
"stylelint": "^14.1.0",
"stylelint-config-standard-scss": "^3.0.0",
"stylelint-order": "^4.1.0",
"stylelint-selector-bem-pattern": "^2.1.1",

The top of the .stylelintrc file looks as follows

    {
        "extends": ["stylelint-config-standard-scss"],
        "customSyntax": "postcss-scss",
        "plugins": [
            "stylelint-order",
            "stylelint-selector-bem-pattern"
        ],
        "rules": {
                  ...
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It's not currently possible to apply autofix to a single rule while ignoring the other. (There is an open ticket to add options to allow this.)

It's clunky, but you can temporarily comment-out/remove all the rules except the one you want to autofix, run Stylelint, and then add the other rules back in. If you want to autofix a rule that's included in a shared config that you've extended, then you'll need to copy the rule config into your rules array. For example, here are the rules of the stylelint-config-standard-scss shared config.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!