@readme/stylelint-config 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +60 -0
- package/index.js +51 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 ReadMe
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @readme/stylelint-config
|
|
2
|
+
|
|
3
|
+
ReadMe coding standards for all things style-related, specifically CSS and SCSS.
|
|
4
|
+
|
|
5
|
+
[](https://readme.io)
|
|
6
|
+
|
|
7
|
+
[](https://npm.im/@readme/stylelint-config) [](https://github.com/readmeio/stylelint-config)
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
# Install the config as a dev dependency.
|
|
13
|
+
npm install --save-dev @readme/eslint-config
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Peer dependencies
|
|
17
|
+
|
|
18
|
+
You need to additionally install [Stylelint](https://www.npmjs.com/package/stylelint) and [PostCSS](https://www.npmjs.com/package/postcss) into your project. These are peer dependencies of `@readme/stylelint-config`, which can conveniently be installed either manually or using [`install-peerdeps`](https://www.npmjs.com/package/install-peerdeps).
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
# Install with "install-peerdeps"
|
|
22
|
+
npx install-peerdeps --dev @readme/stylelint-config
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
# Install manually
|
|
27
|
+
npm install --save-dev stylelint postcss
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
Create a `stylelint.config.js` file with the following contents:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
module.exports = {
|
|
36
|
+
extends: "@readme/stylelint-config",
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Testing
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
# Run unit tests
|
|
44
|
+
npm run test
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
# Run unit tests in watch mode
|
|
49
|
+
npm run test -- --watch
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Extended configs
|
|
53
|
+
|
|
54
|
+
We've adopted the following list of shared configs that remain actively maintained by the broader developer community.
|
|
55
|
+
|
|
56
|
+
- [stylelint-config-standard](https://github.com/stylelint/stylelint-config-standard) - The standard shareable config for Stylelint.
|
|
57
|
+
- [stylelint-config-standard-scss](https://github.com/stylelint-scss/stylelint-config-standard-scss) - The standard shareable SCSS config for Stylelint.
|
|
58
|
+
- [stylelint-config-sass-guidelines](https://github.com/bjankord/stylelint-config-sass-guidelines) - A stylelint config inspired by [sass-guidelin.es](https://sass-guidelin.es/).
|
|
59
|
+
- [stylelint-config-css-modules](https://github.com/pascalduez/stylelint-config-css-modules) - CSS modules shareable config for stylelint. Tweaks stylelint rules to accept [css modules](https://github.com/css-modules/css-modules) specific syntax.
|
|
60
|
+
- [stylelint-prettier/recommended](https://github.com/prettier/stylelint-prettier) - Runs Prettier as a Stylelint rule and reports differences as individual Stylelint issues.
|
package/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: [
|
|
3
|
+
// Standard rules to enforce common conventions
|
|
4
|
+
'stylelint-config-standard',
|
|
5
|
+
|
|
6
|
+
// Standard rules for SCSS
|
|
7
|
+
'stylelint-config-standard-scss',
|
|
8
|
+
|
|
9
|
+
// Stylelint config inspired by https://sass-guidelin.es
|
|
10
|
+
'stylelint-config-sass-guidelines',
|
|
11
|
+
|
|
12
|
+
// Support CSS modules syntax
|
|
13
|
+
'stylelint-config-css-modules',
|
|
14
|
+
|
|
15
|
+
// Enable prettier formatting for SCSS/CSS
|
|
16
|
+
'stylelint-config-prettier',
|
|
17
|
+
'stylelint-prettier/recommended',
|
|
18
|
+
],
|
|
19
|
+
rules: {
|
|
20
|
+
// ReadMe still uses color names as values in many places.
|
|
21
|
+
'color-named': null,
|
|
22
|
+
|
|
23
|
+
// ReadMe breaks this rule in many places.
|
|
24
|
+
'max-nesting-depth': null,
|
|
25
|
+
|
|
26
|
+
// ReadMe relies on "element[attr='value']" selectors in too many places.
|
|
27
|
+
// Eventually, it may be beneficial to turn this on.
|
|
28
|
+
'selector-no-qualifying-type': null,
|
|
29
|
+
|
|
30
|
+
// ReadMe relies on legacy color functions (e.g. rgba(0, 0, 0, 0.5))
|
|
31
|
+
// everywhere in addition to Scss allowing this to be written with a color
|
|
32
|
+
// name (e.g. rgba(black, 0.5)). Eventually, consider removing this rule to
|
|
33
|
+
// use "modern" style with comma-free syntax (e.g. rgb(0 0 0 / 0.5)). This
|
|
34
|
+
// change however won't be trivial.
|
|
35
|
+
'color-function-notation': 'legacy',
|
|
36
|
+
|
|
37
|
+
// Custom regex of ReadMe's current BEM selector class pattern.
|
|
38
|
+
'selector-class-pattern': [
|
|
39
|
+
'^[a-zA-Z0-9]+((_|-)([a-zA-Z0-9]+))*$',
|
|
40
|
+
{
|
|
41
|
+
message:
|
|
42
|
+
'Selector should start in CapitalCase or camelCase and optionally followed by either kebab-lowercase with hyphens or snake_lowercase with underscores (e.g. BlockName-element-name_modifier-name)',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
|
|
46
|
+
// TODO: Remove this when migrating to Dart Sass.
|
|
47
|
+
// Disallows the use of global function names, as these global functions are
|
|
48
|
+
// now located inside built-in Dart Sass modules.
|
|
49
|
+
'scss/no-global-function-names': null,
|
|
50
|
+
},
|
|
51
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@readme/stylelint-config",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "ReadMe coding standards for styles",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"index.js"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"lint": "eslint .",
|
|
11
|
+
"test": "jest"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+ssh://git@github.com/readmeio/standards.git"
|
|
16
|
+
},
|
|
17
|
+
"author": "Engineers <engineers@readme.com>",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/readmeio/standards/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/readmeio/standards",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"stylelint-config-css-modules": "^4.1.0",
|
|
25
|
+
"stylelint-config-prettier": "^9.0.3",
|
|
26
|
+
"stylelint-config-sass-guidelines": "^9.0.1",
|
|
27
|
+
"stylelint-config-standard": "^25.0.0",
|
|
28
|
+
"stylelint-config-standard-scss": "^3.0.0",
|
|
29
|
+
"stylelint-prettier": "^2.0.0"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"postcss": "^8.4.12",
|
|
33
|
+
"stylelint": "^14.6.1"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@readme/eslint-config": "file:../eslint-config",
|
|
37
|
+
"jest": "^27.5.1"
|
|
38
|
+
}
|
|
39
|
+
}
|