linter-bundle 2.16.0 → 2.19.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/CHANGELOG.md +91 -14
- package/eslint/index.js +1 -1
- package/eslint/overrides-jest.js +1 -0
- package/eslint/overrides-react.js +2 -2
- package/package.json +14 -14
- package/stylelint/index.js +5 -1
- package/stylelint/plugins/stylelint-high-performance-animation.js +109 -106
package/CHANGELOG.md
CHANGED
|
@@ -6,10 +6,66 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
-
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.
|
|
9
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.18.0...HEAD)
|
|
10
|
+
|
|
11
|
+
## [2.19.0] - 2022.08.28
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- [eslint] Updated `@typescript-eslint` from `5.33.1` to `5.35.1`
|
|
16
|
+
- [eslint] Updated `eslint` from `8.22.0` to `8.23.0`
|
|
17
|
+
- [eslint] Updated `eslint-import-resolver-typescript` from `3.4.2` to `3.5.0`
|
|
18
|
+
- [eslint] Updated `eslint-plugin-jest` from `26.8.3` to `26.9.0`
|
|
19
|
+
- [eslint] Updated `eslint-plugin-promise` from `6.0.0` to `6.0.1`
|
|
20
|
+
- [eslint] Updated `eslint-plugin-react` from `7.30.1` to `7.31.1`
|
|
21
|
+
- [markdownlint] Updated `markdownlint-cli` from `0.32.1` to `0.32.2`
|
|
22
|
+
- [stylelint] Updated `stylelint` from `14.10.0` to `14.11.0`
|
|
23
|
+
- [eslint] Activate [`allowEmptyCase`](https://github.com/eslint/eslint/blob/main/docs/src/rules/no-fallthrough.md#allowemptycase) option of `no-fallthrough` rule
|
|
24
|
+
- [stylelint] Activate [`ignoreAfterCombinators: ['>', '+']`](https://stylelint.io/user-guide/rules/list/selector-max-universal/#ignoreaftercombinators-array-of-combinators) of `selector-max-universal` rule, see [this issue](https://github.com/stylelint/stylelint/issues/5792) for details
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- [eslint/overrides-jest] Make use of [jest/prefer-each](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-each.md) rule
|
|
29
|
+
|
|
30
|
+
## [2.18.0] - 2022.08.19
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- [eslint] Updated `@typescript-eslint/eslint-plugin` from `5.33.0` to `5.33.1`
|
|
35
|
+
- [eslint] Updated `eslint` from `8.21.0` to `8.22.0`
|
|
36
|
+
- [eslint] Updated `eslint-import-resolver-typescript` from `3.4.0` to `3.4.2`
|
|
37
|
+
- [eslint] Updated `eslint-plugin-jest` from `26.8.2` to `26.8.3`
|
|
38
|
+
- [stylelint] Updated `stylelint` from `14.9.1` to `14.10.0`
|
|
39
|
+
- [eslint/overrides-react] Activate [`allowExpressions`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md#allowexpressions) for
|
|
40
|
+
[`react/jsx-no-useless-fragment`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md) rule, to fill the React type definitions
|
|
41
|
+
requirement that when a component returns only children (a ReactNode), the return value is a ReactElement by wrapping children in a React.Fragment
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
|
|
45
|
+
- [stylelint] Make use of [`annotation-no-unknown`](https://github.com/stylelint/stylelint/tree/main/lib/rules/annotation-no-unknown) rule
|
|
46
|
+
- [stylelint] Make use of [`keyframe-selector-notation`](https://github.com/stylelint/stylelint/tree/main/lib/rules/keyframe-selector-notation) rule, with option `percentage`
|
|
47
|
+
|
|
48
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.17.0...v2.18.0)
|
|
49
|
+
|
|
50
|
+
## [2.17.0] - 2022.08.10
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
|
|
54
|
+
- [eslint] Updated `@typescript-eslint/eslint-plugin` from `5.32.0` to `5.33.0`
|
|
55
|
+
- [eslint] Updated `eslint-plugin-jest` from `26.7.0` to `26.8.2`
|
|
56
|
+
- [eslint] Updated `eslint-plugin-jsdoc` from `39.3.4` to `39.3.6`
|
|
57
|
+
|
|
58
|
+
### Fixed
|
|
59
|
+
|
|
60
|
+
- [eslint/overrides-react] Disable [`react/jsx-no-leaked-render`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md) rule, as this should be covered by types in TypeScript to prevent unnecessary type castings from boolean to boolean
|
|
61
|
+
- [stylelint] Add `except` for `"margin"` and `"padding"` in `stylelint-use-logical-spec` rule, to prevent [unnecessary warnings](https://github.com/Jordan-Hall/stylelint-use-logical-spec/issues/33) for usages like `margin: 10px 20px;`
|
|
62
|
+
|
|
63
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.16.0...v2.17.0)
|
|
10
64
|
|
|
11
65
|
## [2.16.0] - 2022.08.05
|
|
12
66
|
|
|
67
|
+
### Changed
|
|
68
|
+
|
|
13
69
|
- [eslint] Updated `eslint` from `8.14.0` to `8.21.0`
|
|
14
70
|
- [eslint] Updated `eslint-import-resolver-typescript` from `2.7.1` to `3.4.0`
|
|
15
71
|
- [eslint] Updated `eslint-plugin-functional` from `4.2.1` to `4.2.2`
|
|
@@ -20,7 +76,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
20
76
|
- [eslint] Updated `eslint-plugin-react-hooks` from `4.5.0` to `4.6.0`
|
|
21
77
|
- [eslint] Updated `eslint-plugin-unicorn` from `42.0.0` to `43.0.2`
|
|
22
78
|
- [eslint] Updated `@typescript-eslint` from `5.22.0` to `5.32.0`
|
|
23
|
-
- [
|
|
79
|
+
- [markdownlint] Updated `markdownlint-cli` from `0.31.1` to `0.32.1`
|
|
80
|
+
- [stylelint] Updated `stylelint` from `14.8.2` to `14.9.1`
|
|
81
|
+
- [stylelint] Updated `stylelint-scss` from `4.2.0` to `4.3.0`
|
|
82
|
+
- [stylelint] Updated `stylelint-selector-no-empty` from `1.0.8` to `1.0.9`
|
|
83
|
+
- [stylelint] Updated `stylelint-use-logical-spec` from `3.2.2` to `4.1.0`
|
|
84
|
+
|
|
85
|
+
### Added
|
|
86
|
+
|
|
24
87
|
- [eslint] Make use of [`@typescript-eslint/no-restricted-imports`](https://typescript-eslint.io/rules/no-restricted-imports/) rule
|
|
25
88
|
- [eslint] Make use of [`@typescript-eslint/space-infix-ops`](https://typescript-eslint.io/rules/space-infix-ops/) rule
|
|
26
89
|
- [eslint] Make use of [`@typescript-eslint/consistent-generic-constructors`](https://typescript-eslint.io/rules/consistent-generic-constructors/) rule
|
|
@@ -30,17 +93,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
30
93
|
- [eslint/overrides-react] Make use of [`react/jsx-no-leaked-render`](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md) rule
|
|
31
94
|
- [eslint] Added but disable [`unicorn/prefer-event-target`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-event-target.md) rule
|
|
32
95
|
- [eslint] Make use of [`unicorn/prefer-logical-operator-over-ternary`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-logical-operator-over-ternary.md) rule
|
|
33
|
-
- [eslint] Remove deprecated `unicorn/import-index` rule
|
|
34
|
-
- [markdownlint] Updated `markdownlint-cli` from `0.31.1` to `0.32.1`
|
|
35
|
-
- [stylelint] Updated `stylelint` from `14.8.2` to `14.9.1`
|
|
36
|
-
- [stylelint] Updated `stylelint-scss` from `4.2.0` to `4.3.0`
|
|
37
|
-
- [stylelint] Updated `stylelint-selector-no-empty` from `1.0.8` to `1.0.9`
|
|
38
|
-
- [stylelint] Updated `stylelint-use-logical-spec` from `3.2.2` to `4.1.0`
|
|
39
96
|
- [stylelint] Added but disable [`import-notation`](https://github.com/stylelint/stylelint/tree/main/lib/rules/import-notation) rule
|
|
40
97
|
|
|
98
|
+
### Removed
|
|
99
|
+
|
|
100
|
+
- [eslint] Remove deprecated `@typescript-eslint/no-duplicate-imports` rule
|
|
101
|
+
- [eslint] Remove deprecated `unicorn/import-index` rule
|
|
102
|
+
|
|
103
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.15.0...v2.16.0)
|
|
104
|
+
|
|
105
|
+
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.15.0...v2.16.0)
|
|
106
|
+
|
|
41
107
|
## [2.15.0] - 2022.05.05
|
|
42
108
|
|
|
43
|
-
###
|
|
109
|
+
### Fixed
|
|
44
110
|
|
|
45
111
|
- [stylelint] Disabled `declaration-property-max-values` rule because of false-positives.
|
|
46
112
|
- [stylelint] Disabled `selector-not-notation` for now, because it depends on the project if modern Selectors Level 4 CSS can be used.
|
|
@@ -59,14 +125,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
59
125
|
|
|
60
126
|
### Changed
|
|
61
127
|
|
|
62
|
-
- [general] Remove files from npm package which are only necessary for development
|
|
63
128
|
- [eslint] Updated `@typescript-eslint` from `5.21.0` to `5.22.0`
|
|
64
129
|
- [eslint] Updated `eslint-plugin-jsdoc` from `39.2.8` to `39.2.9`
|
|
65
130
|
- [eslint] Updated `eslint-plugin-react-hooks` from `4.4.0` to `4.5.0`
|
|
66
131
|
- [stylelint] Updated `stylelint` from `14.7.1` to `14.8.2`
|
|
132
|
+
|
|
133
|
+
### Added
|
|
134
|
+
|
|
67
135
|
- [eslint] Make use of new [`@typescript-eslint/no-duplicate-enum-values`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-duplicate-enum-values.md) rule
|
|
68
136
|
- [stylelint] Make use of new [`keyframe-block-no-duplicate-selectors`](https://github.com/stylelint/stylelint/blob/main/lib/rules/keyframe-block-no-duplicate-selectors/README.md) rule
|
|
69
137
|
- [stylelint] In the deployment process, ensure that the used Stylelint options are valid
|
|
138
|
+
|
|
139
|
+
### Fixed
|
|
140
|
+
|
|
141
|
+
- [general] Remove files from npm package which are only necessary for development
|
|
70
142
|
- [stylelint] Fix invalid configuration of [`declaration-property-max-values`](https://github.com/stylelint/stylelint/blob/main/lib/rules/declaration-property-max-values/README.md) rule
|
|
71
143
|
|
|
72
144
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.13.0...v2.14.0)
|
|
@@ -75,7 +147,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
75
147
|
|
|
76
148
|
### Changed
|
|
77
149
|
|
|
78
|
-
- [eslint] Activate `allowExpressions` option of [`@typescript-eslint/explicit-function-return-type`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md) rule
|
|
79
150
|
- [eslint] Updated `@typescript-eslint` from `5.17.0` to `5.21.0`
|
|
80
151
|
- [eslint] Updated `eslint` from `8.12.0` to `8.14.0`
|
|
81
152
|
- [eslint] Updated `eslint-import-resolver-typescript` from `2.7.0` to `2.7.1`
|
|
@@ -86,14 +157,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
86
157
|
- [eslint] Updated `eslint-plugin-unicorn` from `41.0.1` to `42.0.0`
|
|
87
158
|
- [stylelint] Updated `postcss-scss` from `4.0.3` to `4.0.4`
|
|
88
159
|
- [stylelint] Updated `stylelint` from `14.6.1` to `14.7.1`
|
|
89
|
-
- [eslint] Activate `allowExpressions` option of [`@typescript-eslint/explicit-function-return-type`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md) rule
|
|
90
160
|
- [eslint/overrides-jsdoc] Set [`minLineCount` option to 2](https://github.com/gajus/eslint-plugin-jsdoc/issues/870) for `require-jsdoc` rule
|
|
161
|
+
- [stylelint] Set [`selector-not-notation`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-not-notation/README.md) rule to `"complex"`
|
|
162
|
+
|
|
163
|
+
### Added
|
|
164
|
+
|
|
165
|
+
- [eslint] Activate `allowExpressions` option of [`@typescript-eslint/explicit-function-return-type`](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md) rule
|
|
91
166
|
- [eslint] Reactivated the [`import/no-relative-packages`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-relative-packages.md) rule
|
|
92
167
|
- [eslint] Make use of new [`unicorn/no-useless-switch-case`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-switch-case.md) rule
|
|
93
168
|
- [eslint] Make use of new [`unicorn/prefer-modern-math-apis`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-modern-math-apis.md) rule
|
|
94
169
|
- [eslint] Make use of new [`unicorn/no-unreadable-iife`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unreadable-iife.md) rule
|
|
95
170
|
- [eslint] Add but disable [`unicorn/prefer-native-coercion-functions`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-native-coercion-functions.md) rule, because this would produce inconsistency in the code and is harder to read
|
|
96
|
-
- [stylelint] Set [`selector-not-notation`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-not-notation/README.md) rule to `"complex"`
|
|
97
171
|
|
|
98
172
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.12.0...v2.13.0)
|
|
99
173
|
|
|
@@ -112,9 +186,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
112
186
|
- [stylelint] Updated `stylelint` from `14.5.3` to `14.6.1`
|
|
113
187
|
- [stylelint] Updated `stylelint-scss` from `4.1.0` to `4.2.0`
|
|
114
188
|
- [general] Updated `micromatch` from `4.0.4` to `4.0.5`
|
|
189
|
+
- [stylelint] Replace `function-no-unknown` by `scss/function-no-unknown`
|
|
190
|
+
|
|
191
|
+
### Added
|
|
192
|
+
|
|
115
193
|
- [eslint] Make use of [`destructuredArrayIgnorePattern`](https://eslint.org/docs/rules/no-unused-vars#destructuredarrayignorepattern) of `@typescript-eslint/no-unused-vars` rule, to ignore variables with leading underscore.
|
|
116
194
|
- [stylelint] Make use of [`declaration-property-max-values`](https://stylelint.io/user-guide/rules/list/declaration-property-max-values/) rule, and set `unprefixed-property-name` to `4`
|
|
117
|
-
- [stylelint] Replace `function-no-unknown` by `scss/function-no-unknown`
|
|
118
195
|
|
|
119
196
|
[Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v2.11.1...v2.12.0)
|
|
120
197
|
|
package/eslint/index.js
CHANGED
|
@@ -173,7 +173,7 @@ module.exports = {
|
|
|
173
173
|
'no-extend-native': 'error',
|
|
174
174
|
'no-extra-bind': 'error',
|
|
175
175
|
'no-extra-label': 'error',
|
|
176
|
-
'no-fallthrough': 'error',
|
|
176
|
+
'no-fallthrough': ['error', { allowEmptyCase: true }],
|
|
177
177
|
'no-floating-decimal': 'error',
|
|
178
178
|
'no-global-assign': 'error',
|
|
179
179
|
'no-implicit-coercion': ['error', { disallowTemplateShorthand: true }],
|
package/eslint/overrides-jest.js
CHANGED
|
@@ -97,6 +97,7 @@ module.exports = {
|
|
|
97
97
|
'jest/prefer-hooks-in-order': 'error',
|
|
98
98
|
'jest/prefer-hooks-on-top': 'error',
|
|
99
99
|
'jest/prefer-comparison-matcher': 'error',
|
|
100
|
+
'jest/prefer-each': 'error',
|
|
100
101
|
'jest/prefer-equality-matcher': 'error',
|
|
101
102
|
'jest/prefer-mock-promise-shorthand': 'error',
|
|
102
103
|
'jest/prefer-snapshot-hint': 'error',
|
|
@@ -150,12 +150,12 @@ module.exports = {
|
|
|
150
150
|
'react/jsx-no-comment-textnodes': 'error',
|
|
151
151
|
'react/jsx-no-constructed-context-values': 'error',
|
|
152
152
|
'react/jsx-no-duplicate-props': 'error',
|
|
153
|
-
'react/jsx-no-leaked-render': '
|
|
153
|
+
'react/jsx-no-leaked-render': 'off', // Should be covered by boolean-types in TypeScript, otherwise unnecessary type-castings from boolean to boolean would be required
|
|
154
154
|
'react/jsx-no-literals': 'off',
|
|
155
155
|
'react/jsx-no-script-url': 'error',
|
|
156
156
|
'react/jsx-no-target-blank': ['error', { allowReferrer: true, forms: true }],
|
|
157
157
|
'react/jsx-no-undef': 'error',
|
|
158
|
-
'react/jsx-no-useless-fragment': 'error',
|
|
158
|
+
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
|
|
159
159
|
'react/jsx-one-expression-per-line': ['off', { allow: 'single-child' }], // @todo Doesn't work with something like "Text <a href="...">Link</a> More Text", which should be valid
|
|
160
160
|
'react/jsx-curly-brace-presence': ['error', { propElementValues: 'always' }],
|
|
161
161
|
'react/jsx-fragments': ['error', 'element'],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linter-bundle",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"description": "Ready-to use bundle of linting tools, containing configurations for ESLint, stylelint and markdownlint.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -40,26 +40,26 @@
|
|
|
40
40
|
"check-outdated": "npx --yes -- check-outdated --ignore-pre-releases"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
44
|
-
"@typescript-eslint/parser": "5.
|
|
45
|
-
"eslint": "8.
|
|
46
|
-
"eslint-import-resolver-typescript": "3.
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "5.35.1",
|
|
44
|
+
"@typescript-eslint/parser": "5.35.1",
|
|
45
|
+
"eslint": "8.23.0",
|
|
46
|
+
"eslint-import-resolver-typescript": "3.5.0",
|
|
47
47
|
"eslint-import-resolver-webpack": "0.13.2",
|
|
48
48
|
"eslint-plugin-eslint-comments": "3.2.0",
|
|
49
49
|
"eslint-plugin-functional": "4.2.2",
|
|
50
50
|
"eslint-plugin-import": "2.26.0",
|
|
51
|
-
"eslint-plugin-jest": "26.
|
|
52
|
-
"eslint-plugin-jsdoc": "39.3.
|
|
51
|
+
"eslint-plugin-jest": "26.9.0",
|
|
52
|
+
"eslint-plugin-jsdoc": "39.3.6",
|
|
53
53
|
"eslint-plugin-jsx-a11y": "6.6.1",
|
|
54
54
|
"eslint-plugin-node": "11.1.0",
|
|
55
|
-
"eslint-plugin-promise": "6.0.
|
|
56
|
-
"eslint-plugin-react": "7.
|
|
55
|
+
"eslint-plugin-promise": "6.0.1",
|
|
56
|
+
"eslint-plugin-react": "7.31.1",
|
|
57
57
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
58
58
|
"eslint-plugin-unicorn": "43.0.2",
|
|
59
|
-
"markdownlint-cli": "0.32.
|
|
59
|
+
"markdownlint-cli": "0.32.2",
|
|
60
60
|
"micromatch": "4.0.5",
|
|
61
61
|
"postcss-scss": "4.0.4",
|
|
62
|
-
"stylelint": "14.
|
|
62
|
+
"stylelint": "14.11.0",
|
|
63
63
|
"stylelint-declaration-block-no-ignored-properties": "2.5.0",
|
|
64
64
|
"stylelint-order": "5.0.0",
|
|
65
65
|
"stylelint-scss": "4.3.0",
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"typescript": "^4.0.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@types/eslint": "8.4.
|
|
74
|
+
"@types/eslint": "8.4.6",
|
|
75
75
|
"@types/micromatch": "4.0.2",
|
|
76
|
-
"@types/node": "18.
|
|
76
|
+
"@types/node": "18.7.13",
|
|
77
77
|
"stylelint-find-new-rules": "4.0.0",
|
|
78
|
-
"typescript": "4.
|
|
78
|
+
"typescript": "4.8.2"
|
|
79
79
|
}
|
|
80
80
|
}
|
package/stylelint/index.js
CHANGED
|
@@ -68,6 +68,7 @@ module.exports = {
|
|
|
68
68
|
* @see https://github.com/stylelint/stylelint/tree/master/lib/rules
|
|
69
69
|
*/
|
|
70
70
|
'alpha-value-notation': 'number', // @todo change that to 'percentage'?
|
|
71
|
+
'annotation-no-unknown': true,
|
|
71
72
|
'at-rule-allowed-list': null,
|
|
72
73
|
'at-rule-disallowed-list': null,
|
|
73
74
|
'at-rule-empty-line-before': [
|
|
@@ -197,6 +198,7 @@ module.exports = {
|
|
|
197
198
|
'indentation': 'tab',
|
|
198
199
|
'keyframe-block-no-duplicate-selectors': true,
|
|
199
200
|
'keyframe-declaration-no-important': true,
|
|
201
|
+
'keyframe-selector-notation': 'percentage',
|
|
200
202
|
'keyframes-name-pattern': '^[a-z]+(-[a-z]+)*\\d*$',
|
|
201
203
|
'length-zero-no-unit': true,
|
|
202
204
|
'linebreaks': 'unix',
|
|
@@ -288,7 +290,7 @@ module.exports = {
|
|
|
288
290
|
}
|
|
289
291
|
],
|
|
290
292
|
'selector-max-type': 6,
|
|
291
|
-
'selector-max-universal': 1,
|
|
293
|
+
'selector-max-universal': [1, { ignoreAfterCombinators: ['>', '+'] }],
|
|
292
294
|
'selector-nested-pattern': null,
|
|
293
295
|
'selector-no-qualifying-type': [true, { ignore: ['attribute', 'class'] }],
|
|
294
296
|
'selector-no-vendor-prefix': true,
|
|
@@ -952,9 +954,11 @@ module.exports = {
|
|
|
952
954
|
'border-right', // "border-inline-end" is new and should not be used before 2022. @see https://caniuse.com/mdn-css_properties_border-inline-end
|
|
953
955
|
'border-right-color', // "border-inline-end-color" is new and should not be used before 2022. @see https://caniuse.com/mdn-css_properties_border-inline-end-color
|
|
954
956
|
|
|
957
|
+
'margin',
|
|
955
958
|
'margin-top',
|
|
956
959
|
'margin-bottom',
|
|
957
960
|
|
|
961
|
+
'padding',
|
|
958
962
|
'padding-top',
|
|
959
963
|
'padding-bottom',
|
|
960
964
|
|
|
@@ -122,12 +122,12 @@ const propsThatCausePaint = [
|
|
|
122
122
|
];
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
|
-
* Get
|
|
125
|
+
* Get disallowed properties.
|
|
126
126
|
*
|
|
127
127
|
* @param {string} ignore - Property name.
|
|
128
|
-
* @returns {string[]} - Array of
|
|
128
|
+
* @returns {string[]} - Array of disallowed properties.
|
|
129
129
|
*/
|
|
130
|
-
const
|
|
130
|
+
const getDisallowedList = (ignore) => {
|
|
131
131
|
if (ignore === 'paint-properties') {
|
|
132
132
|
return propertiesThatCauseLayout;
|
|
133
133
|
}
|
|
@@ -146,128 +146,131 @@ const getBlacklist = (ignore) => {
|
|
|
146
146
|
*/
|
|
147
147
|
const unprefixed = (property) => property.replace(/^-\w+-/u, '');
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Rule function.
|
|
151
|
+
*
|
|
152
|
+
* @param {Record<string, any>} actual - Primary options
|
|
153
|
+
* @param {Record<string, any>} options - Secondary options
|
|
154
|
+
* @returns {(root: import('postcss').Root, result: import('stylelint').PostcssResult) => Promise<void> | void} PostCSS plugin
|
|
155
|
+
*/
|
|
156
|
+
const ruleFunction = (actual, options) => (cssRoot, result) => {
|
|
157
|
+
const validOptions = stylelint.utils.validateOptions(
|
|
158
|
+
result,
|
|
159
|
+
ruleName,
|
|
160
|
+
{ actual },
|
|
161
|
+
{
|
|
162
|
+
actual: options,
|
|
163
|
+
possible: {
|
|
164
|
+
ignore: ['paint-properties'],
|
|
165
|
+
ignoreProperties: [isString]
|
|
166
|
+
},
|
|
167
|
+
optional: true
|
|
168
|
+
}
|
|
169
|
+
);
|
|
165
170
|
|
|
166
|
-
|
|
171
|
+
if (!validOptions) { return; }
|
|
167
172
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// @ts-expect-error -- Property 'ignoreProperties' comes from an index signature, so it must be accessed with ['ignoreProperties'].
|
|
171
|
-
const ignored = options.ignoreProperties ?? [];
|
|
173
|
+
const disallowedList = getDisallowedList(options['ignore']);
|
|
174
|
+
const ignored = options['ignoreProperties'] ?? [];
|
|
172
175
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
+
cssRoot.walkDecls('transition-property', (decl) => {
|
|
177
|
+
valueParser(decl.value).walk((node) => {
|
|
178
|
+
const value = unprefixed(node.value);
|
|
176
179
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
if (
|
|
181
|
+
node.type === 'word' &&
|
|
182
|
+
!ignored.includes(value) &&
|
|
183
|
+
(disallowedList.includes(value) || value === 'all')
|
|
184
|
+
) {
|
|
185
|
+
const index = declarationValueIndex(decl) + node.sourceIndex;
|
|
183
186
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
});
|
|
187
|
+
stylelint.utils.report({
|
|
188
|
+
ruleName,
|
|
189
|
+
result,
|
|
190
|
+
node: decl,
|
|
191
|
+
message: messages.rejected('transition', node.value),
|
|
192
|
+
index
|
|
193
|
+
});
|
|
194
|
+
}
|
|
193
195
|
});
|
|
196
|
+
});
|
|
194
197
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
+
cssRoot.walkDecls('transition', (decl) => {
|
|
199
|
+
/** @type {{ index: number; value: string; }[]} */
|
|
200
|
+
const nodes = [];
|
|
198
201
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
valueParser(decl.value).walk((node) => {
|
|
203
|
+
if (node.type === 'word' || node.type === 'function') {
|
|
204
|
+
nodes.push({
|
|
205
|
+
index: node.sourceIndex,
|
|
206
|
+
value: node.value
|
|
207
|
+
});
|
|
208
|
+
}
|
|
206
209
|
|
|
207
|
-
|
|
208
|
-
|
|
210
|
+
return false;
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
if (!ignored.includes('all')) {
|
|
214
|
+
const transitionProp = nodes.filter((node) => {
|
|
215
|
+
const isUnit = valueParser.unit(node.value);
|
|
216
|
+
const isTimingFunction = cssTimingFunctionsRE.test(node.value);
|
|
209
217
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const isTimingFunction = cssTimingFunctionsRE.test(node.value);
|
|
218
|
+
if (isUnit || isTimingFunction) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
214
221
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
222
|
+
return node;
|
|
223
|
+
});
|
|
218
224
|
|
|
219
|
-
|
|
225
|
+
if (nodes.length > 0 && transitionProp.length === 0) {
|
|
226
|
+
stylelint.utils.report({
|
|
227
|
+
ruleName,
|
|
228
|
+
result,
|
|
229
|
+
node: decl,
|
|
230
|
+
message: messages.rejected('transition', 'all'),
|
|
231
|
+
index: declarationValueIndex(decl) + nodes[0].index
|
|
220
232
|
});
|
|
221
233
|
|
|
222
|
-
|
|
223
|
-
stylelint.utils.report({
|
|
224
|
-
ruleName,
|
|
225
|
-
result,
|
|
226
|
-
node: decl,
|
|
227
|
-
message: messages.rejected('transition', 'all'),
|
|
228
|
-
index: declarationValueIndex(decl) + nodes[0].index
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
234
|
+
return;
|
|
233
235
|
}
|
|
236
|
+
}
|
|
234
237
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
+
for (const property of nodes) {
|
|
239
|
+
const index = declarationValueIndex(decl) + property.index;
|
|
240
|
+
const value = unprefixed(property.value);
|
|
238
241
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
242
|
+
if (
|
|
243
|
+
!ignored.includes(value) &&
|
|
244
|
+
(disallowedList.includes(value) || value === 'all')
|
|
245
|
+
) {
|
|
246
|
+
stylelint.utils.report({
|
|
247
|
+
ruleName,
|
|
248
|
+
result,
|
|
249
|
+
node: decl,
|
|
250
|
+
message: messages.rejected('transition', property.value),
|
|
251
|
+
index
|
|
252
|
+
});
|
|
251
253
|
}
|
|
252
|
-
}
|
|
254
|
+
}
|
|
255
|
+
});
|
|
253
256
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
cssRoot.walkAtRules(/^keyframes$/iu, (atRuleKeyframes) => {
|
|
258
|
+
atRuleKeyframes.walkDecls((decl) => {
|
|
259
|
+
const value = unprefixed(decl.prop);
|
|
257
260
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
});
|
|
261
|
+
if (!ignored.includes(value) && disallowedList.includes(value)) {
|
|
262
|
+
stylelint.utils.report({
|
|
263
|
+
ruleName,
|
|
264
|
+
result,
|
|
265
|
+
node: decl,
|
|
266
|
+
message: messages.rejected('animation', decl.prop)
|
|
267
|
+
});
|
|
268
|
+
}
|
|
267
269
|
});
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
ruleFunction.ruleName = ruleName;
|
|
274
|
+
ruleFunction.messages = messages;
|
|
270
275
|
|
|
271
|
-
|
|
272
|
-
module.exports.ruleName = ruleName;
|
|
273
|
-
module.exports.messages = messages;
|
|
276
|
+
module.exports = stylelint.createPlugin(ruleName, ruleFunction);
|