-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update stylelint docs, use js file for configuration (#661)
- Loading branch information
Showing
4 changed files
with
64 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
modules.exports = { | ||
extends: 'stylelint-config-standard', | ||
|
||
rules: { | ||
'string-quotes': 'single', | ||
'selector-max-id': 0, | ||
'property-no-unknown': [true, { ignoreProperties: ['composes'] }], | ||
'selector-pseudo-class-no-unknown': [ | ||
true, | ||
{ | ||
ignorePseudoClasses: ['export', 'import', 'global', 'local'], | ||
}, | ||
], | ||
'function-url-scheme-blacklist': 'never', | ||
'property-no-vendor-prefix': true, | ||
'selector-no-vendor-prefix': true, | ||
'selector-class-pattern': [ | ||
'^[a-zA-Z0-9_]+$', | ||
{ | ||
message: 'Selector should be alhpanumeric, without hyphens [stylelint-config-kyt]', | ||
}, | ||
], | ||
'at-rule-no-unknown': [ | ||
true, | ||
{ | ||
ignoreAtRules: ['extend', 'include', 'mixin', 'if', 'else', 'for'], | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,26 @@ | ||
# kyt Stylelint Linter and CSS/Sass Style Guide | ||
# NYT Stylelint and SCSS Style Guide | ||
|
||
This is an extension of [stylelint-config-standard](https://github.com/stylelint/stylelint-config-standard) with some overrides for CSS/Sass Modules. | ||
|
||
## Table of Contents | ||
|
||
1. [Install](#install) | ||
1. [CSS + Sass Guide](#css--sass-guide) | ||
- [Formatting](#formatting) | ||
- [Comments](#comments) | ||
- [ID Selectors](#id-selectors) | ||
- [Syntax](#syntax) | ||
- [Ordering](#ordering-of-property-declarations) | ||
- [Variables](#variables) | ||
- [Mixins](#mixins) | ||
1. [Changelog](#changelog) | ||
|
||
## Install | ||
|
||
If you want to install this linter extension, follow these install instructions. | ||
|
||
1. Install the `stylelint-config-kyt` npm package: | ||
``` | ||
npm i --save-dev stylelint stylelint-config-kyt stylelint-config-standard | ||
``` | ||
1. Add a `.stylelintrc` file to your project's root | ||
1. Add configuration: | ||
``` | ||
yarn add --dev [email protected] \ | ||
[email protected] \ | ||
stylelint-config-kyt | ||
// or | ||
npm i --save-dev --save-exact [email protected] \ | ||
[email protected] \ | ||
stylelint-config-kyt | ||
``` | ||
|
||
## Configuration | ||
|
||
Add a `.stylelintrc` file to your project's root with these contents: | ||
|
||
```json | ||
{ | ||
|
@@ -35,8 +31,6 @@ If you want to install this linter extension, follow these install instructions. | |
|
||
## CSS + Sass Guide | ||
|
||
The following guide is best used with the `kyt` linter against CSS/Sass Modules. | ||
|
||
### Formatting | ||
|
||
- Use soft tabs (2 spaces) for indentation. | ||
|
@@ -102,8 +96,8 @@ You should never define an ID selector in a CSS Module. | |
|
||
### Ordering of property declarations | ||
|
||
1. `@include` or `composes` declarations | ||
2. Property declarations in alphabetical order | ||
* `@include` or `composes` declarations | ||
* Property declarations in alphabetical order | ||
|
||
```scss | ||
.btnGreen { | ||
|
@@ -115,20 +109,20 @@ You should never define an ID selector in a CSS Module. | |
} | ||
``` | ||
|
||
3. Nested pseudo-selectors | ||
* Nested pseudo-selectors | ||
|
||
Nested pseudo-selectors go last, and nothing goes after them. | ||
Nested pseudo-selectors go last, and nothing goes after them. | ||
|
||
```scss | ||
.btn { | ||
@include color(red); | ||
font-weight: bold; | ||
```scss | ||
.btn { | ||
@include color(red); | ||
font-weight: bold; | ||
|
||
&:hover { | ||
cursor: pointer; | ||
} | ||
&:hover { | ||
cursor: pointer; | ||
} | ||
``` | ||
} | ||
``` | ||
|
||
### Variables | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.