These linting rules are designed to be very strict. Much thought has been placed in every rule, and a comment has been added over each explaining what it does. The rules work on both .sass
and .scss
files, though if you are using these rules, you should probably be using .sass
files primarily as they are stricter by default and less error proned (see pros/cons at the bottom). These rules include a strict ordering of CSS properties, detailed below.
Much care and thought has gone into every rule, and each has been documented. This rule set is by far the most comprehensive currently in existence. Take, for example, the "property sort order" detailed below:
Property Sort Order:
The order by which you sort properties matters for consistency, predictability, and compression (gzip). I have carefully analyzed the most popular approaches, found their flaws, and improved on them.
For the purposes of linting, the more properties you have documented the better.
Rule Set Amount of properties Dupes TJW 456 0 SMACSS 201 2 Concentric 170 ? Recess 161 0(?
- It is hard to denote dupes as there are competing versions of Concentric)
If you find you are using a CSS property that is not in the list, please create an issue on GitHub to report it and it will be added into the ruleset.
Cross-Platform Instructionsnpm install --save-dev tjw-sasslint-rules sass-lint sass-lint-auto-fix node-sass
.sass-lint.yml
and set it up like so:
options: config-file: node_modules/tjw-sasslint-rules/tjwsasslint.yml files: # Note: You can change the '**/*.s+(a|c)ss' to be specific to your project's Sass folder. Example: 'src/sass/**/*.s+(a|c)ss' include: '**/*.s+(a|c)ss'
"scripts":
section of your package.json
add in these two lines:
"sasslint": "sass-lint -c .sass-lint.yml -v -f table",
"sassfix": "sass-lint-auto-fix -c .sass-lint.yml"
npm run sassfix
- This will automatically fix anything it can in accordance with the rules.npm run sasslint
- This will show you the remaining lines of code in violation of the linting rules for you to manually correct.Benefits of Sass over SCSS:
{}
){}
and ;
( which can cause errors).animals +myMixin border: 1px solid $myColor margin: 10px padding: 5px .kitten background: $myColor font-family: $secondaryFont font-size: $fontSizeMedium text-align: center
Benefits of SCSS over Sass:
.icon { display: inline-block; width: 16px; height: 16px; background-image: url('sprite-sheet.png'); } .icon-bat { background-position: 0px 0px; } .icon-cat { background-position: 0px -16px; } .icon-cow { background-position: 0px -32px; } .icon-dog { background-position: -16px 0px; } .icon-pig { background-position: -16px -16px; } .icon-rat { background-position: -16px -32px; } .icon-bee { background-position: -32px 0px; } .icon-ant { background-position: -32px -16px; } .icon-ape { background-position: -32px -32px; }
Benefits of Sass or SCSS over CSS:
width: $height / 2;
)color: desaturate(#F00, 20%);
or color: rgba(#FCE, 0.5);
)Other Info:
.sass
syntax in your code examples online.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4