@alexlit/lint-kit 214.4.0 → 216.0.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/README.md +27 -22
- package/eslint.config.js +31 -60
- package/lint-staged.config.js +2 -2
- package/linthtml.config.js +2 -2
- package/package.json +3 -2
- package/packages/config-eslint/README.md +181 -106
- package/packages/config-eslint/base.js +8 -3
- package/packages/config-eslint/index.d.ts +114 -0
- package/packages/config-eslint/index.js +82 -23
- package/packages/config-eslint/package.json +20 -17
- package/packages/config-eslint/plugins/de-morgan.js +11 -4
- package/packages/config-eslint/plugins/import-x.js +54 -37
- package/packages/config-eslint/plugins/javascript.js +100 -85
- package/packages/config-eslint/plugins/jsdoc.js +28 -17
- package/packages/config-eslint/plugins/json.js +35 -24
- package/packages/config-eslint/plugins/perfectionist.js +112 -95
- package/packages/config-eslint/plugins/pinia.js +21 -10
- package/packages/config-eslint/plugins/prettier.js +32 -10
- package/packages/config-eslint/plugins/regexp.js +20 -9
- package/packages/config-eslint/plugins/sonar.js +23 -12
- package/packages/config-eslint/plugins/stylistic.js +111 -100
- package/packages/config-eslint/plugins/tailwindcss.js +24 -10
- package/packages/config-eslint/plugins/tanstack-query.js +20 -9
- package/packages/config-eslint/plugins/typescript-type-checked.js +42 -33
- package/packages/config-eslint/plugins/typescript.js +27 -14
- package/packages/config-eslint/plugins/unicorn.js +77 -64
- package/packages/config-eslint/plugins/unocss.js +16 -5
- package/packages/config-eslint/plugins/vitest.js +24 -13
- package/packages/config-eslint/plugins/vue-accessibility.js +26 -13
- package/packages/config-eslint/plugins/vue-i18n.js +43 -31
- package/packages/config-eslint/plugins/vue.js +259 -242
- package/packages/config-eslint/plugins/zod.js +21 -10
- package/packages/config-eslint/rules/typescript.js +1 -1
- package/packages/config-hooks/README.md +119 -37
- package/packages/config-hooks/index.d.ts +19 -0
- package/packages/config-hooks/lint-staged.js +8 -6
- package/packages/config-hooks/package.json +3 -1
- package/packages/config-htmllint/README.md +50 -22
- package/packages/config-htmllint/index.d.ts +13 -0
- package/packages/config-htmllint/index.js +15 -7
- package/packages/config-htmllint/package.json +4 -2
- package/packages/config-markdownlint/README.md +40 -5
- package/packages/config-markdownlint/index.json +0 -2
- package/packages/config-markdownlint/package.json +1 -1
- package/packages/config-npmlint/README.md +48 -5
- package/packages/config-npmlint/package.json +3 -3
- package/packages/config-prettier/README.md +158 -23
- package/packages/config-prettier/index.d.ts +100 -0
- package/packages/config-prettier/index.js +63 -85
- package/packages/config-prettier/package.json +6 -4
- package/packages/config-prettier/plugins/jsdoc.js +17 -2
- package/packages/config-prettier/plugins/mdc.js +17 -2
- package/packages/config-prettier/plugins/packagejson.js +17 -4
- package/packages/config-prettier/plugins/php.js +17 -4
- package/packages/config-prettier/plugins/pug.js +17 -2
- package/packages/config-prettier/plugins/ruby.js +17 -11
- package/packages/config-prettier/plugins/sh.js +17 -4
- package/packages/config-prettier/plugins/solidity.js +17 -4
- package/packages/config-prettier/plugins/sort-json.js +17 -2
- package/packages/config-prettier/plugins/sql.js +17 -4
- package/packages/config-prettier/plugins/tailwindcss.js +17 -2
- package/packages/config-prettier/plugins/xml.js +17 -2
- package/packages/config-prettier/utils/merge-configs.js +18 -0
- package/packages/config-stylelint/README.md +182 -44
- package/packages/config-stylelint/index.d.ts +56 -0
- package/packages/config-stylelint/index.js +161 -165
- package/packages/config-stylelint/package.json +5 -2
- package/packages/config-stylelint/plugins/a11y.js +13 -6
- package/packages/config-stylelint/plugins/bem.js +14 -6
- package/packages/config-stylelint/plugins/color-format.js +14 -2
- package/packages/config-stylelint/plugins/declaration-block-no-ignored-properties.js +14 -5
- package/packages/config-stylelint/plugins/gamut.js +13 -5
- package/packages/config-stylelint/plugins/high-performance-animation.js +15 -6
- package/packages/config-stylelint/plugins/logical-css.js +13 -5
- package/packages/config-stylelint/plugins/media-use-custom-media.js +14 -5
- package/packages/config-stylelint/plugins/no-indistinguishable-colors.js +14 -5
- package/packages/config-stylelint/plugins/no-nested-media.js +13 -5
- package/packages/config-stylelint/plugins/no-unresolved-module.js +15 -6
- package/packages/config-stylelint/plugins/no-unsupported-browser-features.js +15 -6
- package/packages/config-stylelint/plugins/order.js +14 -6
- package/packages/config-stylelint/plugins/prettier.js +13 -5
- package/packages/config-stylelint/plugins/scss.js +13 -6
- package/packages/config-stylelint/plugins/selector-no-empty.js +14 -5
- package/packages/config-stylelint/plugins/use-nesting.js +13 -5
- package/packages/config-stylelint/plugins/vue.js +10 -2
- package/packages/config-stylelint/utils/merge-configs.js +20 -0
- package/prettier.config.js +15 -7
- package/scripts/semver.sh +3 -3
- package/stylelint.config.js +25 -11
- package/packages/config-eslint/_legacy/LICENSE +0 -20
- package/packages/config-eslint/_legacy/README.md +0 -48
- package/packages/config-eslint/_legacy/constants/allow-boolean-property-list.js +0 -38
- package/packages/config-eslint/_legacy/constants/boolean-prefixes.js +0 -11
- package/packages/config-eslint/_legacy/constants/english-verbs.js +0 -3368
- package/packages/config-eslint/_legacy/dictionaries/index.js +0 -467
- package/packages/config-eslint/_legacy/dictionaries/programming/bash.js +0 -25
- package/packages/config-eslint/_legacy/dictionaries/programming/django.js +0 -2345
- package/packages/config-eslint/_legacy/dictionaries/programming/elixir.js +0 -64
- package/packages/config-eslint/_legacy/dictionaries/programming/go.js +0 -7748
- package/packages/config-eslint/_legacy/dictionaries/programming/java.js +0 -33527
- package/packages/config-eslint/_legacy/dictionaries/programming/latex.js +0 -675
- package/packages/config-eslint/_legacy/dictionaries/programming/lua.js +0 -394
- package/packages/config-eslint/_legacy/dictionaries/programming/php.js +0 -9788
- package/packages/config-eslint/_legacy/dictionaries/programming/python.js +0 -367
- package/packages/config-eslint/_legacy/dictionaries/programming/ruby.js +0 -357
- package/packages/config-eslint/_legacy/dictionaries/programming/rust.js +0 -115
- package/packages/config-eslint/_legacy/dictionaries/programming/scala.js +0 -2755
- package/packages/config-eslint/_legacy/dictionaries/specialized/html-symbol-entities.js +0 -1118
- package/packages/config-eslint/_legacy/dictionaries/specialized/lorem-ipsum.js +0 -359
- package/packages/config-eslint/_legacy/index.js +0 -12
- package/packages/config-eslint/_legacy/legacy.js +0 -3
- package/packages/config-eslint/_legacy/package.json +0 -97
- package/packages/config-eslint/_legacy/plugins/array-func.js +0 -20
- package/packages/config-eslint/_legacy/plugins/compat.js +0 -7
- package/packages/config-eslint/_legacy/plugins/decorator-position.js +0 -15
- package/packages/config-eslint/_legacy/plugins/eslint-comments.js +0 -9
- package/packages/config-eslint/_legacy/plugins/etc.js +0 -13
- package/packages/config-eslint/_legacy/plugins/ext.js +0 -12
- package/packages/config-eslint/_legacy/plugins/filenames.js +0 -38
- package/packages/config-eslint/_legacy/plugins/import.js +0 -133
- package/packages/config-eslint/_legacy/plugins/jsdoc.js +0 -32
- package/packages/config-eslint/_legacy/plugins/jsx-a11y.js +0 -5
- package/packages/config-eslint/_legacy/plugins/lit-a11y.js +0 -5
- package/packages/config-eslint/_legacy/plugins/lit.js +0 -9
- package/packages/config-eslint/_legacy/plugins/more.js +0 -17
- package/packages/config-eslint/_legacy/plugins/no-await-in-promise.js +0 -5
- package/packages/config-eslint/_legacy/plugins/no-constructor-bind.js +0 -8
- package/packages/config-eslint/_legacy/plugins/no-explicit-type-exports.js +0 -7
- package/packages/config-eslint/_legacy/plugins/no-loops.js +0 -7
- package/packages/config-eslint/_legacy/plugins/no-secrets.js +0 -12
- package/packages/config-eslint/_legacy/plugins/no-use-extend-native.js +0 -5
- package/packages/config-eslint/_legacy/plugins/node.js +0 -5
- package/packages/config-eslint/_legacy/plugins/prettier.js +0 -24
- package/packages/config-eslint/_legacy/plugins/promise.js +0 -10
- package/packages/config-eslint/_legacy/plugins/regexp.js +0 -7
- package/packages/config-eslint/_legacy/plugins/security.js +0 -10
- package/packages/config-eslint/_legacy/plugins/simple-import-sort.js +0 -7
- package/packages/config-eslint/_legacy/plugins/sonar.js +0 -5
- package/packages/config-eslint/_legacy/plugins/sort-class-members.js +0 -298
- package/packages/config-eslint/_legacy/plugins/sort-destructure-keys.js +0 -10
- package/packages/config-eslint/_legacy/plugins/sort-keys-fix.js +0 -7
- package/packages/config-eslint/_legacy/plugins/spellcheck.js +0 -9
- package/packages/config-eslint/_legacy/plugins/sql.js +0 -26
- package/packages/config-eslint/_legacy/plugins/tanstack-query.js +0 -4
- package/packages/config-eslint/_legacy/plugins/testing-library.js +0 -9
- package/packages/config-eslint/_legacy/plugins/typescript-sort-keys.js +0 -5
- package/packages/config-eslint/_legacy/plugins/typescript.js +0 -157
- package/packages/config-eslint/_legacy/plugins/unicorn.js +0 -70
- package/packages/config-eslint/_legacy/plugins/unused-imports.js +0 -17
- package/packages/config-eslint/_legacy/plugins/vitest.js +0 -16
- package/packages/config-eslint/_legacy/plugins/vue-i18n.js +0 -34
- package/packages/config-eslint/_legacy/plugins/vue.js +0 -291
- package/packages/config-eslint/_legacy/plugins/vuejs-accessibility.js +0 -20
- package/packages/config-eslint/_legacy/plugins/wc.js +0 -5
- package/packages/config-eslint/_legacy/plugins/write-good-comments.js +0 -7
- package/packages/config-eslint/_legacy/utils/create-config.js +0 -377
- package/packages/config-eslint/_legacy/utils/extend-spell-checker.js +0 -23
|
@@ -1,178 +1,174 @@
|
|
|
1
1
|
/* eslint-disable unicorn/no-null */
|
|
2
|
+
import { a11y } from './plugins/a11y.js';
|
|
3
|
+
import { bem } from './plugins/bem.js';
|
|
4
|
+
import { colorFormat } from './plugins/color-format.js';
|
|
5
|
+
import { declarationBlockNoIgnoredProperties } from './plugins/declaration-block-no-ignored-properties.js';
|
|
6
|
+
import { gamut } from './plugins/gamut.js';
|
|
7
|
+
import { highPerformanceAnimation } from './plugins/high-performance-animation.js';
|
|
8
|
+
import { logicalCss } from './plugins/logical-css.js';
|
|
9
|
+
import { mediaUseCustomMedia } from './plugins/media-use-custom-media.js';
|
|
10
|
+
import { noIndistinguishableColors } from './plugins/no-indistinguishable-colors.js';
|
|
11
|
+
import { noNestedMedia } from './plugins/no-nested-media.js';
|
|
12
|
+
import { noUnresolvedModule } from './plugins/no-unresolved-module.js';
|
|
13
|
+
import { noUnsupportedBrowserFeatures } from './plugins/no-unsupported-browser-features.js';
|
|
14
|
+
import { order } from './plugins/order.js';
|
|
15
|
+
import { prettier } from './plugins/prettier.js';
|
|
16
|
+
import { scss } from './plugins/scss.js';
|
|
17
|
+
import { selectorNoEmpty } from './plugins/selector-no-empty.js';
|
|
18
|
+
import { useNesting } from './plugins/use-nesting.js';
|
|
19
|
+
import { vue } from './plugins/vue.js';
|
|
20
|
+
import { mergeConfigs } from './utils/merge-configs.js';
|
|
2
21
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
22
|
+
/** Плагины. Дефолтных плагинов нет - подключайте нужные явно в `defineConfig`. */
|
|
23
|
+
const plugins = {
|
|
24
|
+
a11y,
|
|
25
|
+
bem,
|
|
26
|
+
colorFormat,
|
|
27
|
+
declarationBlockNoIgnoredProperties,
|
|
28
|
+
gamut,
|
|
29
|
+
highPerformanceAnimation,
|
|
30
|
+
logicalCss,
|
|
31
|
+
mediaUseCustomMedia,
|
|
32
|
+
noIndistinguishableColors,
|
|
33
|
+
noNestedMedia,
|
|
34
|
+
noUnresolvedModule,
|
|
35
|
+
noUnsupportedBrowserFeatures,
|
|
36
|
+
order,
|
|
37
|
+
prettier,
|
|
38
|
+
scss,
|
|
39
|
+
selectorNoEmpty,
|
|
40
|
+
useNesting,
|
|
41
|
+
vue,
|
|
13
42
|
};
|
|
14
43
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
44
|
+
/** Базовые правила, применяются всегда (ниже опций плагинов и `options`). */
|
|
45
|
+
const BASE_RULES = {
|
|
46
|
+
'alpha-value-notation': 'number',
|
|
47
|
+
'annotation-no-unknown': [true, { ignoreAnnotations: ['default'] }],
|
|
48
|
+
'at-rule-disallowed-list': ['debug'],
|
|
49
|
+
'at-rule-empty-line-before': [
|
|
50
|
+
'always',
|
|
51
|
+
{
|
|
52
|
+
except: ['blockless-after-same-name-blockless', 'first-nested'],
|
|
53
|
+
ignoreAtRules: ['else'],
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
'at-rule-no-deprecated': [true, { ignoreAtRules: ['apply', 'tailwind'] }],
|
|
57
|
+
'at-rule-no-unknown': null,
|
|
58
|
+
'at-rule-no-vendor-prefix': true,
|
|
59
|
+
'block-no-empty': null,
|
|
60
|
+
'color-function-notation': 'modern',
|
|
61
|
+
'color-hex-length': 'short',
|
|
62
|
+
'color-no-hex': true,
|
|
63
|
+
'color-no-invalid-hex': true,
|
|
64
|
+
'custom-property-empty-line-before': [
|
|
65
|
+
'always',
|
|
66
|
+
{ except: ['after-comment', 'after-custom-property', 'first-nested'] },
|
|
67
|
+
],
|
|
68
|
+
'custom-property-pattern': '^_?[a-z]+([a-z0-9-]+[a-z0-9]+)?$',
|
|
69
|
+
'declaration-block-no-redundant-longhand-properties': null,
|
|
70
|
+
'declaration-property-value-no-unknown': [
|
|
71
|
+
true,
|
|
72
|
+
{
|
|
73
|
+
ignoreProperties: {
|
|
74
|
+
'/.+/': /(v-(bind|deep|global|slotted)|calc-size|rgb|theme|view)|\$/,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
'font-family-name-quotes': 'always-unless-keyword',
|
|
79
|
+
'function-no-unknown': null, // delegate to scss/function-no-unknown
|
|
80
|
+
'function-url-quotes': 'always',
|
|
81
|
+
'function-url-scheme-disallowed-list': ['/^data/', 'ftp', '/^http/'],
|
|
82
|
+
'hue-degree-notation': 'angle',
|
|
83
|
+
'keyframes-name-pattern': '^[a-z]+(-[a-z]+)*$',
|
|
84
|
+
'max-nesting-depth': [
|
|
85
|
+
6,
|
|
86
|
+
{ ignoreAtRules: ['each', 'media', 'supports', 'include'] },
|
|
87
|
+
],
|
|
88
|
+
'media-feature-name-no-unknown': [
|
|
89
|
+
true,
|
|
90
|
+
{ ignoreMediaFeatureNames: ['screen'] },
|
|
91
|
+
],
|
|
92
|
+
'media-feature-name-no-vendor-prefix': true,
|
|
93
|
+
'no-descending-specificity': null,
|
|
94
|
+
'no-empty-source': null,
|
|
95
|
+
'no-unknown-animations': true,
|
|
96
|
+
'number-max-precision': 3,
|
|
97
|
+
'property-no-unknown': [
|
|
98
|
+
true,
|
|
99
|
+
{
|
|
100
|
+
ignoreProperties: [
|
|
101
|
+
'align-tracks',
|
|
102
|
+
'animation-timeline',
|
|
103
|
+
'interpolate-size',
|
|
104
|
+
'text-stroke',
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
'property-no-vendor-prefix': true,
|
|
109
|
+
'rule-empty-line-before': [
|
|
110
|
+
'always',
|
|
111
|
+
{ except: ['after-single-line-comment', 'first-nested'], ignore: [] },
|
|
112
|
+
],
|
|
113
|
+
'selector-class-pattern': [
|
|
114
|
+
'^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$',
|
|
115
|
+
{
|
|
116
|
+
message:
|
|
117
|
+
'Selector should be written as BEM "block__element--modifier--value" (selector-class-pattern)',
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
'selector-combinator-disallowed-list': ['>>>', '/deep/'],
|
|
121
|
+
'selector-max-compound-selectors': 6,
|
|
122
|
+
'selector-max-id': 0,
|
|
123
|
+
'selector-no-qualifying-type': null,
|
|
124
|
+
'selector-no-vendor-prefix': true,
|
|
125
|
+
'selector-pseudo-element-disallowed-list': ['shadow'],
|
|
126
|
+
'selector-pseudo-element-no-unknown': [
|
|
127
|
+
true,
|
|
128
|
+
{ ignorePseudoElements: ['v-deep', 'file-selector-button'] },
|
|
129
|
+
],
|
|
130
|
+
'selector-type-no-unknown': [true, { ignoreTypes: ['ymaps'] }],
|
|
131
|
+
'shorthand-property-no-redundant-values': true,
|
|
132
|
+
'string-no-newline': null,
|
|
133
|
+
'time-min-milliseconds': 16,
|
|
134
|
+
'value-keyword-case': [
|
|
135
|
+
'lower',
|
|
136
|
+
{ camelCaseSvgKeywords: true, ignoreFunctions: ['v-bind'] },
|
|
137
|
+
],
|
|
138
|
+
'value-no-vendor-prefix': true,
|
|
32
139
|
};
|
|
33
140
|
|
|
34
141
|
/**
|
|
35
|
-
*
|
|
142
|
+
* Создать конфиг Stylelint.
|
|
36
143
|
*
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
return pluginsList;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Create stylelint config
|
|
144
|
+
* Приоритет (от низкого к высокому): база → конфиги плагинов по порядку →
|
|
145
|
+
* `options`. Коллекции (`extends`, `ignoreFiles`, `overrides`, `plugins`)
|
|
146
|
+
* конкатенируются (дубли `plugins` убираются), `rules` - shallow merge.
|
|
147
|
+
*
|
|
148
|
+
* @param {import('stylelint').Config[]} [pluginConfigs] - Конфиги плагинов
|
|
149
|
+
* (например, `[plugins.scss(), plugins.vue()]`)
|
|
150
|
+
* @param {import('stylelint').Config} [options] - Базовые опции Stylelint,
|
|
151
|
+
* наивысший приоритет
|
|
53
152
|
*
|
|
54
|
-
* @
|
|
55
|
-
* @param {import('stylelint').Config} options Stylelint options
|
|
153
|
+
* @returns {import('stylelint').Config}
|
|
56
154
|
*/
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
'.*',
|
|
69
|
-
'.*/**',
|
|
70
|
-
'build/**',
|
|
71
|
-
'dist/**',
|
|
72
|
-
'docs/**',
|
|
73
|
-
'node_modules/**',
|
|
74
|
-
'storybook-*/**',
|
|
75
|
-
|
|
76
|
-
...(options.ignoreFiles ?? []),
|
|
77
|
-
],
|
|
78
|
-
plugins: options.plugins ?? [],
|
|
79
|
-
rules: {
|
|
80
|
-
'alpha-value-notation': 'number',
|
|
81
|
-
'annotation-no-unknown': [true, { ignoreAnnotations: ['default'] }],
|
|
82
|
-
'at-rule-disallowed-list': ['debug'],
|
|
83
|
-
'at-rule-empty-line-before': [
|
|
84
|
-
'always',
|
|
85
|
-
{
|
|
86
|
-
except: ['blockless-after-same-name-blockless', 'first-nested'],
|
|
87
|
-
ignoreAtRules: ['else'],
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
'at-rule-no-deprecated': [true, { ignoreAtRules: ['apply', 'tailwind'] }],
|
|
91
|
-
'at-rule-no-unknown': null,
|
|
92
|
-
'at-rule-no-vendor-prefix': true,
|
|
93
|
-
'block-no-empty': null,
|
|
94
|
-
'color-function-notation': 'modern',
|
|
95
|
-
'color-hex-length': 'short',
|
|
96
|
-
'color-no-hex': true,
|
|
97
|
-
'color-no-invalid-hex': true,
|
|
98
|
-
'custom-property-empty-line-before': [
|
|
99
|
-
'always',
|
|
100
|
-
{ except: ['after-comment', 'after-custom-property', 'first-nested'] },
|
|
101
|
-
],
|
|
102
|
-
'custom-property-pattern': '^_?[a-z]+([a-z0-9-]+[a-z0-9]+)?$',
|
|
103
|
-
'declaration-block-no-redundant-longhand-properties': null,
|
|
104
|
-
'declaration-property-value-no-unknown': [
|
|
105
|
-
true,
|
|
106
|
-
{
|
|
107
|
-
ignoreProperties: {
|
|
108
|
-
'/.+/': /(v-(bind|deep|global|slotted)|calc-size|rgb|theme|view)|\$/,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
155
|
+
const defineConfig = (pluginConfigs = [], options = {}) => {
|
|
156
|
+
const baseConfig = {
|
|
157
|
+
extends: ['stylelint-config-standard'],
|
|
158
|
+
ignoreFiles: [
|
|
159
|
+
'.*',
|
|
160
|
+
'.*/**',
|
|
161
|
+
'build/**',
|
|
162
|
+
'dist/**',
|
|
163
|
+
'docs/**',
|
|
164
|
+
'node_modules/**',
|
|
165
|
+
'storybook-*/**',
|
|
111
166
|
],
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
'function-url-scheme-disallowed-list': ['/^data/', 'ftp', '/^http/'],
|
|
116
|
-
'hue-degree-notation': 'angle',
|
|
117
|
-
'keyframes-name-pattern': '^[a-z]+(-[a-z]+)*$',
|
|
118
|
-
'max-nesting-depth': [
|
|
119
|
-
6,
|
|
120
|
-
{ ignoreAtRules: ['each', 'media', 'supports', 'include'] },
|
|
121
|
-
],
|
|
122
|
-
'media-feature-name-no-unknown': [
|
|
123
|
-
true,
|
|
124
|
-
{ ignoreMediaFeatureNames: ['screen'] },
|
|
125
|
-
],
|
|
126
|
-
'media-feature-name-no-vendor-prefix': true,
|
|
127
|
-
'no-descending-specificity': null,
|
|
128
|
-
'no-empty-source': null,
|
|
129
|
-
'no-unknown-animations': true,
|
|
130
|
-
'number-max-precision': 3,
|
|
131
|
-
'property-no-unknown': [
|
|
132
|
-
true,
|
|
133
|
-
{
|
|
134
|
-
ignoreProperties: [
|
|
135
|
-
'align-tracks',
|
|
136
|
-
'animation-timeline',
|
|
137
|
-
'interpolate-size',
|
|
138
|
-
'text-stroke',
|
|
139
|
-
],
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
'property-no-vendor-prefix': true,
|
|
143
|
-
'rule-empty-line-before': [
|
|
144
|
-
'always',
|
|
145
|
-
{ except: ['after-single-line-comment', 'first-nested'], ignore: [] },
|
|
146
|
-
],
|
|
147
|
-
'selector-class-pattern': [
|
|
148
|
-
'^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$',
|
|
149
|
-
{
|
|
150
|
-
message:
|
|
151
|
-
'Selector should be written as BEM "block__element--modifier--value" (selector-class-pattern)',
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
'selector-combinator-disallowed-list': ['>>>', '/deep/'],
|
|
155
|
-
'selector-max-compound-selectors': 6,
|
|
156
|
-
'selector-max-id': 0,
|
|
157
|
-
'selector-no-qualifying-type': null,
|
|
158
|
-
'selector-no-vendor-prefix': true,
|
|
159
|
-
'selector-pseudo-element-disallowed-list': ['shadow'],
|
|
160
|
-
'selector-pseudo-element-no-unknown': [
|
|
161
|
-
true,
|
|
162
|
-
{ ignorePseudoElements: ['v-deep', 'file-selector-button'] },
|
|
163
|
-
],
|
|
164
|
-
'selector-type-no-unknown': [true, { ignoreTypes: ['ymaps'] }],
|
|
165
|
-
'shorthand-property-no-redundant-values': true,
|
|
166
|
-
'string-no-newline': null,
|
|
167
|
-
'time-min-milliseconds': 16,
|
|
168
|
-
'value-keyword-case': [
|
|
169
|
-
'lower',
|
|
170
|
-
{ camelCaseSvgKeywords: true, ignoreFunctions: ['v-bind'] },
|
|
171
|
-
],
|
|
172
|
-
'value-no-vendor-prefix': true,
|
|
167
|
+
plugins: [],
|
|
168
|
+
rules: BASE_RULES,
|
|
169
|
+
};
|
|
173
170
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
});
|
|
171
|
+
return mergeConfigs(baseConfig, ...pluginConfigs, options);
|
|
172
|
+
};
|
|
177
173
|
|
|
178
|
-
export {
|
|
174
|
+
export { defineConfig, plugins };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexlit/config-stylelint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "64.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Stylelint config",
|
|
6
6
|
"keywords": [
|
|
@@ -23,10 +23,13 @@
|
|
|
23
23
|
],
|
|
24
24
|
"type": "module",
|
|
25
25
|
"main": "index.js",
|
|
26
|
+
"types": "index.d.ts",
|
|
26
27
|
"files": [
|
|
27
28
|
"README.md",
|
|
28
29
|
"index.js",
|
|
29
|
-
"
|
|
30
|
+
"index.d.ts",
|
|
31
|
+
"plugins",
|
|
32
|
+
"utils"
|
|
30
33
|
],
|
|
31
34
|
"scripts": {
|
|
32
35
|
"lint": "cd ../../ && ./scripts/lint.stylelint.sh",
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
/* eslint-disable unicorn/no-null */
|
|
2
|
+
import { mergeConfigs } from '../utils/merge-configs.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
* @type {import('stylelint').Config}
|
|
5
|
-
*
|
|
6
|
-
* @see [stylelint-a11y](https://github.com/double-great/stylelint-a11y)
|
|
7
|
-
*/
|
|
8
|
-
export default {
|
|
4
|
+
const DEFAULTS = {
|
|
9
5
|
plugins: ['@double-great/stylelint-a11y'],
|
|
10
6
|
rules: {
|
|
11
7
|
'a11y/media-prefers-reduced-motion': null,
|
|
@@ -16,3 +12,14 @@ export default {
|
|
|
16
12
|
'a11y/selector-pseudo-class-focus': true,
|
|
17
13
|
},
|
|
18
14
|
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Проверяет типичные ошибки доступности.
|
|
18
|
+
*
|
|
19
|
+
* @param {Partial<import('stylelint').Config>} [options]
|
|
20
|
+
*
|
|
21
|
+
* @returns {import('stylelint').Config}
|
|
22
|
+
*
|
|
23
|
+
* @see [stylelint-a11y](https://github.com/double-great/stylelint-a11y)
|
|
24
|
+
*/
|
|
25
|
+
export const a11y = (options = {}) => mergeConfigs(DEFAULTS, options);
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
/* eslint-disable unicorn/no-null */
|
|
2
2
|
import { createDefineRules } from '@morev/stylelint-plugin';
|
|
3
3
|
|
|
4
|
+
import { mergeConfigs } from '../utils/merge-configs.js';
|
|
5
|
+
|
|
4
6
|
const defineRules = createDefineRules({
|
|
5
7
|
separators: { element: '__', modifier: '--', modifierValue: '--' },
|
|
6
8
|
});
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
* @type {import('stylelint').Config}
|
|
10
|
-
*
|
|
11
|
-
* @see [@morev/stylelint-plugin](https://morevm.github.io/stylelint-plugin/)
|
|
12
|
-
*/
|
|
13
|
-
export default {
|
|
10
|
+
const DEFAULTS = {
|
|
14
11
|
overrides: [
|
|
15
12
|
{
|
|
16
13
|
files: ['**/*.{css,scss,vue}'],
|
|
@@ -41,3 +38,14 @@ export default {
|
|
|
41
38
|
],
|
|
42
39
|
plugins: ['@morev/stylelint-plugin'],
|
|
43
40
|
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Настраивает линтинг по методологии БЭМ.
|
|
44
|
+
*
|
|
45
|
+
* @param {Partial<import('stylelint').Config>} [options]
|
|
46
|
+
*
|
|
47
|
+
* @returns {import('stylelint').Config}
|
|
48
|
+
*
|
|
49
|
+
* @see [@morev/stylelint-plugin](https://morevm.github.io/stylelint-plugin/)
|
|
50
|
+
*/
|
|
51
|
+
export const bem = (options = {}) => mergeConfigs(DEFAULTS, options);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import stylelint from 'stylelint';
|
|
2
2
|
|
|
3
|
+
import { mergeConfigs } from '../utils/merge-configs.js';
|
|
4
|
+
|
|
3
5
|
const { createPlugin } = stylelint;
|
|
4
6
|
const { report, ruleMessages, validateOptions } = stylelint.utils;
|
|
5
7
|
|
|
@@ -168,8 +170,18 @@ const rule = function (actual, options, context) {
|
|
|
168
170
|
rule.ruleName = ruleName;
|
|
169
171
|
rule.messages = messages;
|
|
170
172
|
|
|
171
|
-
|
|
172
|
-
export default {
|
|
173
|
+
const DEFAULTS = {
|
|
173
174
|
plugins: [createPlugin(ruleName, rule)],
|
|
174
175
|
rules: { 'color-format/format': { format: 'rgb' } },
|
|
175
176
|
};
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Нормализует формат цветов (hex → rgb/hsl).
|
|
180
|
+
*
|
|
181
|
+
* @param {Partial<import('stylelint').Config>} [options] - Опции, накладываемые
|
|
182
|
+
* поверх значений по умолчанию. Коллекции (`extends`, `ignoreFiles`,
|
|
183
|
+
* `overrides`, `plugins`) дополняются, `rules` мержатся поверхностно
|
|
184
|
+
*
|
|
185
|
+
* @returns {import('stylelint').Config}
|
|
186
|
+
*/
|
|
187
|
+
export const colorFormat = (options = {}) => mergeConfigs(DEFAULTS, options);
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import { mergeConfigs } from '../utils/merge-configs.js';
|
|
2
|
+
|
|
3
|
+
const DEFAULTS = {
|
|
4
|
+
plugins: ['stylelint-declaration-block-no-ignored-properties'],
|
|
5
|
+
rules: { 'plugin/declaration-block-no-ignored-properties': true },
|
|
6
|
+
};
|
|
7
|
+
|
|
1
8
|
/**
|
|
2
|
-
*
|
|
9
|
+
* Запрещает бесполезные свойства в блоке объявлений.
|
|
10
|
+
*
|
|
11
|
+
* @param {Partial<import('stylelint').Config>} [options]
|
|
12
|
+
*
|
|
13
|
+
* @returns {import('stylelint').Config}
|
|
3
14
|
*
|
|
4
15
|
* @see [stylelint-declaration-block-no-ignored-properties](https://github.com/kristerkari/stylelint-declaration-block-no-ignored-properties)
|
|
5
16
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
rules: { 'plugin/declaration-block-no-ignored-properties': true },
|
|
9
|
-
};
|
|
17
|
+
export const declarationBlockNoIgnoredProperties = (options = {}) =>
|
|
18
|
+
mergeConfigs(DEFAULTS, options);
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import { mergeConfigs } from '../utils/merge-configs.js';
|
|
2
|
+
|
|
3
|
+
const DEFAULTS = {
|
|
4
|
+
plugins: ['stylelint-gamut'],
|
|
5
|
+
rules: { 'gamut/color-no-out-gamut-range': true },
|
|
6
|
+
};
|
|
7
|
+
|
|
1
8
|
/**
|
|
2
|
-
*
|
|
9
|
+
* Проверяет цвета на выход за пределы цветового охвата (gamut).
|
|
10
|
+
*
|
|
11
|
+
* @param {Partial<import('stylelint').Config>} [options]
|
|
12
|
+
*
|
|
13
|
+
* @returns {import('stylelint').Config}
|
|
3
14
|
*
|
|
4
15
|
* @see [stylelint-gamut](https://github.com/fpetrakov/stylelint-gamut)
|
|
5
16
|
*/
|
|
6
|
-
export
|
|
7
|
-
plugins: ['stylelint-gamut'],
|
|
8
|
-
rules: { 'gamut/color-no-out-gamut-range': true },
|
|
9
|
-
};
|
|
17
|
+
export const gamut = (options = {}) => mergeConfigs(DEFAULTS, options);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @see [stylelint-high-performance-animation](https://github.com/kristerkari/stylelint-high-performance-animation)
|
|
5
|
-
*/
|
|
6
|
-
export default {
|
|
1
|
+
import { mergeConfigs } from '../utils/merge-configs.js';
|
|
2
|
+
|
|
3
|
+
const DEFAULTS = {
|
|
7
4
|
plugins: ['stylelint-high-performance-animation'],
|
|
8
5
|
rules: {
|
|
9
6
|
'plugin/no-low-performance-animation-properties': [
|
|
@@ -12,3 +9,15 @@ export default {
|
|
|
12
9
|
],
|
|
13
10
|
},
|
|
14
11
|
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Запрещает анимации, нагружающие рендеринг.
|
|
15
|
+
*
|
|
16
|
+
* @param {Partial<import('stylelint').Config>} [options]
|
|
17
|
+
*
|
|
18
|
+
* @returns {import('stylelint').Config}
|
|
19
|
+
*
|
|
20
|
+
* @see [stylelint-high-performance-animation](https://github.com/kristerkari/stylelint-high-performance-animation)
|
|
21
|
+
*/
|
|
22
|
+
export const highPerformanceAnimation = (options = {}) =>
|
|
23
|
+
mergeConfigs(DEFAULTS, options);
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import { mergeConfigs } from '../utils/merge-configs.js';
|
|
2
|
+
|
|
3
|
+
const DEFAULTS = {
|
|
4
|
+
extends: ['stylelint-plugin-logical-css/configs/recommended'],
|
|
5
|
+
plugins: ['stylelint-plugin-logical-css'],
|
|
6
|
+
};
|
|
7
|
+
|
|
1
8
|
/**
|
|
2
|
-
*
|
|
9
|
+
* Проверяет использование логических CSS-свойств.
|
|
10
|
+
*
|
|
11
|
+
* @param {Partial<import('stylelint').Config>} [options]
|
|
12
|
+
*
|
|
13
|
+
* @returns {import('stylelint').Config}
|
|
3
14
|
*
|
|
4
15
|
* @see [stylelint-plugin-logical-css](https://github.com/yuschick/stylelint-plugin-logical-css)
|
|
5
16
|
*/
|
|
6
|
-
export
|
|
7
|
-
extends: ['stylelint-plugin-logical-css/configs/recommended'],
|
|
8
|
-
plugins: ['stylelint-plugin-logical-css'],
|
|
9
|
-
};
|
|
17
|
+
export const logicalCss = (options = {}) => mergeConfigs(DEFAULTS, options);
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import { mergeConfigs } from '../utils/merge-configs.js';
|
|
2
|
+
|
|
3
|
+
const DEFAULTS = {
|
|
4
|
+
plugins: ['stylelint-media-use-custom-media'],
|
|
5
|
+
rules: { 'csstools/media-use-custom-media': 'always' },
|
|
6
|
+
};
|
|
7
|
+
|
|
1
8
|
/**
|
|
2
|
-
*
|
|
9
|
+
* Требует использования кастомных медиа-запросов.
|
|
10
|
+
*
|
|
11
|
+
* @param {Partial<import('stylelint').Config>} [options]
|
|
12
|
+
*
|
|
13
|
+
* @returns {import('stylelint').Config}
|
|
3
14
|
*
|
|
4
15
|
* @see [stylelint-media-use-custom-media](https://github.com/csstools/stylelint-media-use-custom-media)
|
|
5
16
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
rules: { 'csstools/media-use-custom-media': 'always' },
|
|
9
|
-
};
|
|
17
|
+
export const mediaUseCustomMedia = (options = {}) =>
|
|
18
|
+
mergeConfigs(DEFAULTS, options);
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import { mergeConfigs } from '../utils/merge-configs.js';
|
|
2
|
+
|
|
3
|
+
const DEFAULTS = {
|
|
4
|
+
plugins: ['stylelint-no-indistinguishable-colors'],
|
|
5
|
+
rules: { 'plugin/stylelint-no-indistinguishable-colors': true },
|
|
6
|
+
};
|
|
7
|
+
|
|
1
8
|
/**
|
|
2
|
-
*
|
|
9
|
+
* Запрещает неразличимые цвета.
|
|
10
|
+
*
|
|
11
|
+
* @param {Partial<import('stylelint').Config>} [options]
|
|
12
|
+
*
|
|
13
|
+
* @returns {import('stylelint').Config}
|
|
3
14
|
*
|
|
4
15
|
* @see [stylelint-no-indistinguishable-colors](https://github.com/ierhyna/stylelint-no-indistinguishable-colors)
|
|
5
16
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
rules: { 'plugin/stylelint-no-indistinguishable-colors': true },
|
|
9
|
-
};
|
|
17
|
+
export const noIndistinguishableColors = (options = {}) =>
|
|
18
|
+
mergeConfigs(DEFAULTS, options);
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import { mergeConfigs } from '../utils/merge-configs.js';
|
|
2
|
+
|
|
3
|
+
const DEFAULTS = {
|
|
4
|
+
plugins: ['stylelint-no-nested-media'],
|
|
5
|
+
rules: { 'pitcher/no-nested-media': true },
|
|
6
|
+
};
|
|
7
|
+
|
|
1
8
|
/**
|
|
2
|
-
*
|
|
9
|
+
* Запрещает вложенные медиа-запросы.
|
|
10
|
+
*
|
|
11
|
+
* @param {Partial<import('stylelint').Config>} [options]
|
|
12
|
+
*
|
|
13
|
+
* @returns {import('stylelint').Config}
|
|
3
14
|
*
|
|
4
15
|
* @see [stylelint-no-nested-media](https://github.com/dkrnl/stylelint-no-nested-media)
|
|
5
16
|
*/
|
|
6
|
-
export
|
|
7
|
-
plugins: ['stylelint-no-nested-media'],
|
|
8
|
-
rules: { 'pitcher/no-nested-media': true },
|
|
9
|
-
};
|
|
17
|
+
export const noNestedMedia = (options = {}) => mergeConfigs(DEFAULTS, options);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @see [stylelint-no-unresolved-module](https://github.com/niksy/stylelint-no-unresolved-module)
|
|
5
|
-
*/
|
|
6
|
-
export default {
|
|
1
|
+
import { mergeConfigs } from '../utils/merge-configs.js';
|
|
2
|
+
|
|
3
|
+
const DEFAULTS = {
|
|
7
4
|
plugins: ['stylelint-no-unresolved-module'],
|
|
8
5
|
rules: {
|
|
9
6
|
'plugin/no-unresolved-module': {
|
|
@@ -21,3 +18,15 @@ export default {
|
|
|
21
18
|
},
|
|
22
19
|
},
|
|
23
20
|
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Проверяет разрешение импортов.
|
|
24
|
+
*
|
|
25
|
+
* @param {Partial<import('stylelint').Config>} [options]
|
|
26
|
+
*
|
|
27
|
+
* @returns {import('stylelint').Config}
|
|
28
|
+
*
|
|
29
|
+
* @see [stylelint-no-unresolved-module](https://github.com/niksy/stylelint-no-unresolved-module)
|
|
30
|
+
*/
|
|
31
|
+
export const noUnresolvedModule = (options = {}) =>
|
|
32
|
+
mergeConfigs(DEFAULTS, options);
|