@kununu/stylelint-config 6.1.4 → 6.1.5

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.
Files changed (3) hide show
  1. package/README.md +74 -25
  2. package/index.js +5 -15
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -2,11 +2,17 @@
2
2
 
3
3
  > kununu style linter configuration
4
4
 
5
- These configurations are for [stylelint](https://stylelint.io/) linter.
5
+ Shared [stylelint](https://stylelint.io/) configuration for kununu's SCSS, used
6
+ across the frontend apps and `@kununu/ui`. It builds on
7
+ [`stylelint-config-standard-scss`](https://github.com/stylelint-scss/stylelint-config-standard-scss)
8
+ and enforces kununu's conventions plus Prettier formatting.
9
+
10
+ `stylelint` itself is bundled as a dependency, so you don't need to install it
11
+ separately. The package pins Node `24.13.1` / npm `11.8.0` in `engines`.
6
12
 
7
13
  ## 📦 Installation
8
14
 
9
- Add @kununu/stylelint-config npm package as a dev dependency to your project:
15
+ Add the package as a dev dependency:
10
16
 
11
17
  ```console
12
18
  npm install @kununu/stylelint-config --save-dev
@@ -14,35 +20,78 @@ npm install @kununu/stylelint-config --save-dev
14
20
 
15
21
  ## 💻 Usage
16
22
 
17
- Create a `.stylelintrc` file with the following configuration:
23
+ Create a `.stylelintrc` (or `.stylelintrc.json`) file:
18
24
 
19
- ```yaml
25
+ ```json
20
26
  {
21
27
  "extends": "@kununu/stylelint-config"
22
28
  }
23
29
  ```
24
30
 
25
- See [docs](https://stylelint.io/user-guide/configuration) to find more detailed information on stylelint configuration and usage.
26
-
27
- And add
31
+ Add a lint script targeting your SCSS files to `package.json`:
28
32
 
29
- ```console
30
-
31
- "lint": "stylelint '**/*.scss'",
33
+ ```json
34
+ {
35
+ "scripts": {
36
+ "lint": "stylelint '**/*.scss'"
37
+ }
38
+ }
32
39
  ```
33
40
 
34
- to your npm file.
35
-
36
- ## ⚡️ Editor Plugins
37
-
38
- At kununu, [@kununu/stylelint-config](https://www.npmjs.com/package/@kununu/stylelint-config) linter runs on every commit, but finding a lint error after push can be frustrating and a waste time. In order to avoid it, editor plugins are available to warn you and validate your code.
39
-
40
- There's what we use and recommend:
41
-
42
- ### Atom
43
-
44
- - [linter-stylelint](https://atom.io/packages/linter-stylelint)
45
-
46
- ### Visual Code Studio
47
-
48
- - [stylelint](https://marketplace.visualstudio.com/items?itemName=hex-ci.stylelint-plus)
41
+ See the [stylelint docs](https://stylelint.io/user-guide/configuration) for more
42
+ detailed configuration options.
43
+
44
+ ## 🎨 What's included
45
+
46
+ The config extends `stylelint-config-standard-scss` and
47
+ `stylelint-prettier/recommended`, then layers on kununu's conventions. The
48
+ notable rules:
49
+
50
+ - **Class selectors** must be **camelCase** (`selector-class-pattern`).
51
+ - **SCSS mixin names** must be **kebab-case** (`scss/at-mixin-pattern`).
52
+ - **Colors:** named colors are forbidden (`color-named`), hex must be long form
53
+ (`#ffffff`, not `#fff`), and legacy color/alpha notation is used
54
+ (`rgba(0, 0, 0, 0.5)`).
55
+ - **No duplicate selectors**, and ID selectors are flagged as a **warning**
56
+ (not an error).
57
+ - CSS Modules pseudo-selectors (`:export`, `:global`, `:local`, `:import`) are
58
+ allowed.
59
+ - **Property and selector ordering** is enforced via
60
+ [`stylelint-semantic-groups`](https://www.npmjs.com/package/stylelint-semantic-groups).
61
+
62
+ ### Formatting (Prettier)
63
+
64
+ Formatting is handled by [Prettier](https://prettier.io/) through
65
+ `stylelint-prettier` and reported as lint errors (auto-fixable with
66
+ `stylelint --fix`). The relevant options are pinned here:
67
+
68
+ | Option | Value |
69
+ | --- | --- |
70
+ | `printWidth` | `80` |
71
+ | `tabWidth` | `2` |
72
+ | `useTabs` | `false` |
73
+ | `singleQuote` | `true` |
74
+ | `trailingComma` | `'all'` |
75
+
76
+ > **Note:** these Prettier options are enforced by this config and
77
+ > **intentionally override any `.prettierrc` in the consuming project** for SCSS
78
+ > files. This keeps SCSS formatting consistent across all repos regardless of
79
+ > each project's JS/TS Prettier setup.
80
+
81
+ ## ⚡️ Editor integration
82
+
83
+ Linting runs in CI (and pre-commit, where configured), but catching errors in
84
+ your editor is faster. We recommend the
85
+ [stylelint VS Code extension](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint).
86
+
87
+ Installing the extension alone often isn't enough to lint SCSS — add this to
88
+ your `.vscode/settings.json` so it validates SCSS and stylelint owns formatting
89
+ instead of the built-in linters:
90
+
91
+ ```json
92
+ {
93
+ "stylelint.validate": ["css", "scss"],
94
+ "css.validate": false,
95
+ "scss.validate": false
96
+ }
97
+ ```
package/index.js CHANGED
@@ -6,20 +6,14 @@ module.exports = {
6
6
  'stylelint-prettier/recommended',
7
7
  ],
8
8
  plugins: [
9
- 'stylelint-scss',
10
9
  'stylelint-order',
11
10
  ],
12
11
  rules: {
13
12
  'alpha-value-notation': 'number',
14
- 'at-rule-no-unknown': null,
15
- 'at-rule-no-vendor-prefix': true,
16
13
  'color-function-notation': 'legacy',
17
14
  'color-hex-length': 'long',
18
15
  'color-named': 'never',
19
16
  'comment-empty-line-before': ['always', {except: ['first-nested'], ignore: ['after-comment', 'stylelint-commands']}],
20
- 'comment-whitespace-inside': 'always',
21
- 'function-url-quotes': 'always',
22
- 'media-feature-name-no-vendor-prefix': true,
23
17
  'media-feature-range-notation': 'prefix',
24
18
  'no-descending-specificity': null, // clashing with order/order
25
19
  'no-duplicate-selectors': true,
@@ -33,13 +27,13 @@ module.exports = {
33
27
  return group
34
28
  })),
35
29
  'prettier/prettier': [
36
- true,
30
+ true,
37
31
  {
38
- 'arrowParens': 'avoid',
39
- 'bracketSpacing': false,
40
- 'semi': true,
32
+ 'printWidth': 80,
41
33
  'singleQuote': true,
34
+ 'tabWidth': 2,
42
35
  'trailingComma': 'all',
36
+ 'useTabs': false,
43
37
  },
44
38
  ],
45
39
  'property-no-unknown': [
@@ -48,18 +42,14 @@ module.exports = {
48
42
  ignoreSelectors: [':export'],
49
43
  },
50
44
  ],
51
- 'property-no-vendor-prefix': true,
52
45
  'rule-empty-line-before': ['always', {except: ['after-single-line-comment', 'first-nested']}],
53
46
  'scss/at-mixin-pattern': '^([a-z][a-z0-9]*)(-[a-z0-9]+)*$', // kebab-case
54
47
  'scss/at-rule-no-unknown': true,
55
- 'selector-attribute-quotes': 'always',
56
48
  'selector-class-pattern': '^[a-z][a-zA-Z0-9]+$', // camelCase
57
49
  'selector-max-id': [0, {severity: 'warning'}],
58
- 'selector-no-vendor-prefix': true,
59
50
  'selector-pseudo-element-colon-notation': 'single',
60
51
  'selector-pseudo-class-no-unknown': [true, {
61
52
  ignorePseudoClasses: ['global', 'export', 'import', 'local'],
62
53
  }],
63
- 'value-no-vendor-prefix': true,
64
54
  },
65
- };
55
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kununu/stylelint-config",
3
- "version": "6.1.4",
3
+ "version": "6.1.5",
4
4
  "description": "kununu's stylelint config",
5
5
  "author": "kununu",
6
6
  "license": "ISC",
@@ -25,12 +25,12 @@
25
25
  "beta": "npm publish --tag=beta"
26
26
  },
27
27
  "dependencies": {
28
- "prettier": "3.8.3",
29
- "stylelint": "17.12.0",
28
+ "prettier": "3.9.4",
29
+ "stylelint": "17.14.0",
30
30
  "stylelint-config-standard-scss": "17.0.0",
31
31
  "stylelint-order": "8.1.1",
32
32
  "stylelint-prettier": "5.0.3",
33
- "stylelint-scss": "7.1.1",
33
+ "stylelint-scss": "7.2.0",
34
34
  "stylelint-semantic-groups": "1.2.2"
35
35
  }
36
36
  }