Comments (10)
@timothyneiljohnson Now that Github has reactions, please use those to +1 in the future instead of adding comment noise. Thanks!
from css.
@lencioni Stylelint is already used by:
- Facebook: good overview article about their experience
- GitHub: stylelint-config-primer
- Wikipedia: stylelint-config-wikimedia
- WordPress: stylelint-config-wordpress
Using Stylelint is especially reasonable, because Stylelint copy ESLint architecture. If you like ESLint, you will love Stylelint too — same benefits.
from css.
From the README.md
- CSS
- Formatting
- Use soft tabs (2 spaces) for indentation:
'indentation': 2,
- Do not use ID selectors:
'selector-no-id': true,
- When using multiple selectors in a rule declaration, give each selector its own line:
'selector-list-comma-newline-after': 'always',
- Put a space before the opening brace
{
in rule declarations:'block-opening-brace-space-before': 'always',
- In properties, put a space after, but not before, the
:
character:'declaration-colon-space-after': 'always',
and'declaration-colon-space-before': 'never',
- Put closing braces
}
of rule declarations on a new line:'block-closing-brace-newline-before': 'always',
- Put blank lines between rule declarations:
'rule-non-nested-empty-line-before': ['always', { ignore: ['after-comment'], }],
- Use soft tabs (2 spaces) for indentation:
- Comments
- Prefer line comments (// in Sass-land) to block comments.
- CSS: 'no-invalid-double-slash-comments': true, Ignored in Sass-land
- Prefer comments on their own line. Avoid end-of-line comments:
'comment-empty-line-before': ['always', {ignore: ['stylelint-commands'],}],
- Write detailed comments for code that isn't self-documenting:
- Uses of z-index: n/a
- Compatibility or browser-specific hacks: you might want to use
no-browser-hacks
rule with thewarning
severity
- Prefer line comments (// in Sass-land) to block comments.
- OOCSS and BEM
- Include the stylelint plugin
stylelint-selector-bem-pattern
see https://github.com/davidtheclark/stylelint-selector-bem-pattern and https://github.com/postcss/postcss-bem-linter
- Include the stylelint plugin
- Border
- Use
0
instead ofnone
to specify that a style has no border: Implemented using stylelint pluginstylelint-value-border-zero
with
"value-border-zero": { "convention": "0" // Or "none" }
, see https://github.com/timothyneiljohnson/stylelint-value-border-zero
- Use
- Formatting
- Sass
- Ordering
- Use
declaration-block-properties-order
though a new option would be neded for the rule to make@includes
last in the list http://stylelint.io/user-guide/rules/declaration-block-properties-order/
- Use
- Variables
- Use stylelint plugin
stylelint-scss
and a regex with thedollar-variable-pattern
rule
- Use stylelint plugin
- Extend directive
- Maybe a new stylelint-scss rule,
at-extend-disallow
https://github.com/kristerkari/stylelint-scss/blob/master/src/rules/at-extend-no-missing-placeholder/README.md
- Maybe a new stylelint-scss rule,
- Nested selectors
- Do not nest selectors more than three levels deep:
'max-nesting-depth': 3,
- Do not nest selectors more than three levels deep:
- Ordering
- Not Implemented for CSS formatting:
- Prefer dashes over camelCasing in class names. Underscores and PascalCasing are okay if you are using BEM (see OOCSS and BEM below), use
selector-class-pattern
with a regular expression matching your pattern
- Prefer dashes over camelCasing in class names. Underscores and PascalCasing are okay if you are using BEM (see OOCSS and BEM below), use
- Suggestions, I've deliberately left out many rules and only covered as much as I could the Airbnb CSS / Sass Styleguide as it is written, I'd suggest reviewing these for additional rules:
- https://github.com/kristerkari/stylelint-scss
- https://github.com/stylelint/stylelint-config-standard (Many or most of the default configuration in this config would suit Airbnb, but its hard to determine without knowing or testing with Airbnb's CSS)
from css.
+1 👍
from css.
+1 👍
from css.
Stylelint become the most popular CSS linter from npm: http://www.npmtrends.com/csslint-vs-csscomb-vs-stylelint
from css.
@michaelBenin The pull request is in #23, I'm happy to refresh it, update, add whatever Travis CI configuration is needed etc
from css.
Hello, there hasn't been much action in this thread and I'm hoping to revive it. Is airbnb open to a pr for this?
from css.
@michaelBenin yes, as long as it includes the right travis config so that it can be automatically verified :-)
from css.
Going to close this as its been a few years.
from css.
Related Issues (20)
- :)
- Css
- yarn lint warning about deprecated rule
- stylelint-config-airbnb is causing issues with npm for dependency resolution HOT 1
- [spam]
- Rule: declaration-property-value-blacklist no longer exists with Stylelint 14.x HOT 1
- How can I add transition in <details> HOT 1
- Wla
- css
- [spam]
- CSS
- [spam]
- [spam]
- [spam]
- [spam]
- [spam]
- [spam]
- Translate to Hindi HOT 5
- CSS
- Css
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from css.