You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
The styleguide provides a method of linting [Sass] code to ensure it conforms
364
-
to the rules in the styleguide. This linting tool will go through all Sass code
365
-
and issue warnings wherever the code differs from the styleguide. We've created
366
-
a specific [`.scss-lint.yml` file][scss-lint yaml] that's configured to work
367
-
with the css coding styleguide. There are two ways to set up linting:
368
-
369
-
* locally with ruby
370
-
* locally with node
371
-
372
-
## Locally with ruby
373
-
1. Add the [`.scss-lint.yml` file][scss-lint yaml] to the base of your
374
-
repository.
375
-
2. Install the [scss-lint] gem with `gem install scss_lint`
376
-
3. Run scss-lint: `scss-lint app/assets/stylesheets/`
377
-
378
-
## Locally with node (experimental!)
379
-
1. Run `npm install --save-dev @18f/stylelint-rules` to download the package and save it to your package.json
380
-
2. The package provides both a gulp task and a cli interface. Detailed usage instructions can be found in the [README](https://github.com/18F/stylelint-rules)
381
-
382
-
## Shortcomings
383
-
384
-
### scss-lint
385
-
386
-
The scss-lint tool currently lacks the functionality to check these rules in
387
-
the CSS coding styleguide:
388
-
389
-
- Does not limit line width to 80 characters
390
-
- Does not check for numeric calculations in parentheses
391
-
- Does not sort properties in quite the order we want (defaults to
392
-
alphabetical)
393
-
394
-
### stylelint
395
-
396
-
This tool is still being evaluated, so not every rule in our current styleguide
397
-
is supported by stylelint. scss-lint is purpose built for SCSS and is therefore
398
-
a bit more feature rich. The following rules are currently not supported:
399
-
400
-
- PropertySpelling
401
-
- UnecessaryParentReference
402
-
403
-
That being said, if you want to avoid a dependency on ruby in your project and
404
-
still benefit from reliable SCSS linting, please test out this tool!
363
+
Using a linter will ensure that [Sass] code conforms to some consistent rules. A linting tool like
364
+
(Stylelint)[https://stylelint.io/] can issue warnings wherever your code differs from established rules.
365
+
366
+
## Setting up Stylelint locally
367
+
1. Run `npm install --save-dev stylelint stylelint-config-standard` to download the package and save it to your package.json
368
+
2. Create a .stylelintrc.json configuration file in the root of your project with the following content:
369
+
```json
370
+
{
371
+
"extends": "stylelint-config-standard"
372
+
}
373
+
```
374
+
3. Run Stylelint on all the CSS files in your project:
375
+
`npx stylelint "**/*.css"`
405
376
377
+
This utilizes stylelint's standard rules configuration for css linting.
378
+
If your project needs different rules or defaults, or you'd like to extend linting to other types of
379
+
files, you can utilize custom syntaxes or write your own.
0 commit comments