Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

139
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda