@alexlit/lint-kit 108.1.0 → 109.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.
Files changed (23) hide show
  1. package/package.json +1 -1
  2. package/packages/config-stylelint/README.md +38 -16
  3. package/packages/config-stylelint/config.js +126 -0
  4. package/packages/config-stylelint/index.js +105 -143
  5. package/packages/config-stylelint/package.json +2 -1
  6. package/packages/config-stylelint/plugins/a11y.js +0 -1
  7. package/packages/config-stylelint/plugins/at-rule-no-children.js +0 -1
  8. package/packages/config-stylelint/plugins/color-format.js +0 -1
  9. package/packages/config-stylelint/plugins/declaration-block-no-ignored-properties.js +0 -1
  10. package/packages/config-stylelint/plugins/{optional/gamut.js → gamut.js} +0 -1
  11. package/packages/config-stylelint/plugins/high-performance-animation.js +0 -1
  12. package/packages/config-stylelint/plugins/{optional/logical-css.js → logical-css.js} +0 -1
  13. package/packages/config-stylelint/plugins/{optional/no-indistinguishable-colors.js → no-indistinguishable-colors.js} +0 -1
  14. package/packages/config-stylelint/plugins/no-nested-media.js +0 -1
  15. package/packages/config-stylelint/plugins/no-unresolved-module.js +0 -1
  16. package/packages/config-stylelint/plugins/no-unsupported-browser-features.js +0 -1
  17. package/packages/config-stylelint/plugins/order.js +0 -1
  18. package/packages/config-stylelint/plugins/prettier.js +0 -1
  19. package/packages/config-stylelint/plugins/scss.js +0 -1
  20. package/packages/config-stylelint/plugins/selector-no-empty.js +0 -1
  21. package/packages/config-stylelint/plugins/use-nesting.js +0 -1
  22. package/packages/config-stylelint/plugins/vue.js +0 -2
  23. package/stylelint.config.js +5 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexlit/lint-kit",
3
- "version": "108.1.0",
3
+ "version": "109.0.0",
4
4
  "private": false,
5
5
  "description": "Preset of configuration files and dependencies for linting web applications (designed for Vue.js with TypeScript)",
6
6
  "keywords": [
@@ -8,22 +8,44 @@ npm i @alexlit/config-stylelint -D
8
8
 
9
9
  ## Connection
10
10
 
11
- ```js
12
- // stylelint.config.js
13
- import config from '@alexlit/config-stylelint';
14
-
15
- export default {
16
- extends: [
17
- '@alexlit/config-stylelint',
18
-
19
- /* optional */
20
- '@alexlit/config-stylelint/plugins/optional/gamut',
21
- '@alexlit/config-stylelint/plugins/optional/no-indistinguishable-colors',
22
- '@alexlit/config-stylelint/plugins/optional/logical-css',
23
- ],
24
- ignoreFiles: [...config.ignoreFiles],
25
- };
26
- ```
11
+ - Default
12
+ ([see plugins enabled by default](https://github.com/alex-lit/lint-kit/blob/master/packages/config-stylelint/index.js#L62))
13
+
14
+ ```js
15
+ // stylelint.config.js
16
+ import { createConfig } from '@alexlit/config-stylelint';
17
+
18
+ export default createConfig();
19
+ ```
20
+
21
+ - Custom
22
+
23
+ ```js
24
+ // stylelint.config.js
25
+ import { createConfig } from '@alexlit/config-stylelint';
26
+
27
+ export default createConfig(
28
+ {
29
+ // disable some default plugins
30
+ 'no-nested-media': false,
31
+
32
+ // enable some optional plugins
33
+ gamut: true,
34
+ 'logical-css': true,
35
+ },
36
+ {
37
+ // add custom rules
38
+ rules: {
39
+ 'custom-property-empty-line-before': [
40
+ 'always',
41
+ {
42
+ except: ['after-comment', 'after-custom-property', 'first-nested'],
43
+ },
44
+ ],
45
+ },
46
+ },
47
+ );
48
+ ```
27
49
 
28
50
  ## Development
29
51
 
@@ -0,0 +1,126 @@
1
+ /* eslint-disable sonarjs/no-duplicate-string, unicorn/no-null */
2
+
3
+ export const config = {
4
+ ignoreFiles: [
5
+ '.*/**',
6
+ 'build/**',
7
+ 'dist/**',
8
+ 'docs/**',
9
+ 'node_modules/**',
10
+ 'storybook-*/**',
11
+ ],
12
+
13
+ rules: {
14
+ 'alpha-value-notation': 'number',
15
+ 'annotation-no-unknown': [true, { ignoreAnnotations: ['default'] }],
16
+ 'at-rule-disallowed-list': ['debug'],
17
+
18
+ 'at-rule-empty-line-before': [
19
+ 'always',
20
+ {
21
+ except: ['blockless-after-same-name-blockless', 'first-nested'],
22
+ ignoreAtRules: ['else'],
23
+ },
24
+ ],
25
+
26
+ 'at-rule-no-unknown': null,
27
+ 'at-rule-no-vendor-prefix': true,
28
+ 'block-no-empty': null,
29
+ 'color-function-notation': 'modern',
30
+ 'color-hex-length': 'short',
31
+ 'color-no-hex': true,
32
+ 'color-no-invalid-hex': true,
33
+
34
+ 'custom-property-empty-line-before': [
35
+ 'always',
36
+ {
37
+ except: ['after-comment', 'after-custom-property', 'first-nested'],
38
+ },
39
+ ],
40
+
41
+ 'custom-property-pattern': '^_?[a-z]+([a-z0-9-]+[a-z0-9]+)?$',
42
+ 'declaration-block-no-redundant-longhand-properties': null,
43
+
44
+ 'declaration-property-value-no-unknown': [
45
+ true,
46
+ {
47
+ ignoreProperties: {
48
+ '/.+/': /^(v-(bind|deep|global|slotted)|theme|view)|\$/,
49
+ },
50
+ },
51
+ ],
52
+
53
+ 'font-family-name-quotes': 'always-unless-keyword',
54
+ 'function-no-unknown': null, // delegate to scss/function-no-unknown
55
+ 'function-url-quotes': 'always',
56
+ 'function-url-scheme-disallowed-list': ['/^data/', 'ftp', '/^http/'],
57
+ 'hue-degree-notation': 'angle',
58
+ 'keyframes-name-pattern': '^[a-z]+(-[a-z]+)*$',
59
+
60
+ 'max-nesting-depth': [
61
+ 6,
62
+ {
63
+ ignoreAtRules: ['each', 'media', 'supports', 'include'],
64
+ },
65
+ ],
66
+
67
+ 'media-feature-name-no-unknown': [
68
+ true,
69
+ { ignoreMediaFeatureNames: ['screen'] },
70
+ ],
71
+
72
+ 'media-feature-name-no-vendor-prefix': true,
73
+ 'no-descending-specificity': null,
74
+ 'no-empty-source': null,
75
+ 'no-unknown-animations': true,
76
+ 'number-max-precision': 3,
77
+
78
+ 'property-no-unknown': [
79
+ true,
80
+ { ignoreProperties: ['align-tracks', 'animation-timeline'] },
81
+ ],
82
+
83
+ 'property-no-vendor-prefix': true,
84
+
85
+ 'rule-empty-line-before': [
86
+ 'always',
87
+ {
88
+ except: ['first-nested'],
89
+ ignore: [],
90
+ },
91
+ ],
92
+
93
+ 'selector-class-pattern': [
94
+ '^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$',
95
+ {
96
+ message:
97
+ 'Selector should be written as BEM "block__element--modifier--value" (selector-class-pattern)',
98
+ },
99
+ ],
100
+
101
+ 'selector-combinator-disallowed-list': ['>>>', '/deep/'],
102
+
103
+ 'selector-max-compound-selectors': 6,
104
+ 'selector-max-id': 0,
105
+ 'selector-no-qualifying-type': null,
106
+ 'selector-no-vendor-prefix': true,
107
+ 'selector-pseudo-element-disallowed-list': ['shadow'],
108
+
109
+ 'selector-pseudo-element-no-unknown': [
110
+ true,
111
+ { ignorePseudoElements: ['v-deep', 'file-selector-button'] },
112
+ ],
113
+
114
+ 'selector-type-no-unknown': [true, { ignoreTypes: ['ymaps'] }],
115
+ 'shorthand-property-no-redundant-values': true,
116
+ 'string-no-newline': null,
117
+ 'time-min-milliseconds': 16,
118
+
119
+ 'value-keyword-case': [
120
+ 'lower',
121
+ { camelCaseSvgKeywords: true, ignoreFunctions: ['v-bind'] },
122
+ ],
123
+
124
+ 'value-no-vendor-prefix': true,
125
+ },
126
+ };
@@ -1,150 +1,112 @@
1
- /* eslint-disable sonarjs/no-duplicate-string, unicorn/no-null */
2
- export default {
1
+ /* eslint-disable no-console, import/extensions */
2
+
3
+ import { config } from './config.js';
4
+
5
+ const ADDITIONAL_PLUGINS = {
6
+ /** @see [stylelint-a11y](https://github.com/double-great/stylelint-a11y) */
7
+ a11y: true,
8
+
9
+ /** @see [stylelint-at-rule-no-children](https://github.com/adityavm/stylelint-at-rule-no-children) */
10
+ 'at-rule-no-children': true,
11
+
12
+ /** @see [stylelint-color-format](https://github.com/filipekiss/stylelint-color-format) */
13
+ 'color-format': true,
14
+
15
+ /** @see [stylelint-declaration-block-no-ignored-properties](https://github.com/kristerkari/stylelint-declaration-block-no-ignored-properties) */
16
+ 'declaration-block-no-ignored-properties': true,
17
+
18
+ /** @see [stylelint-high-performance-animation](https://github.com/kristerkari/stylelint-high-performance-animation) */
19
+ 'high-performance-animation': true,
20
+
21
+ /** @see [stylelint-no-nested-media](https://github.com/dkrnl/stylelint-no-nested-media) */
22
+ 'no-nested-media': true,
23
+
24
+ /** @see [stylelint-no-unresolved-module](https://github.com/niksy/stylelint-no-unresolved-module) */
25
+ 'no-unresolved-module': true,
26
+
27
+ /** @see [stylelint-no-unsupported-browser-features](https://github.com/ismay/stylelint-no-unsupported-browser-features) */
28
+ 'no-unsupported-browser-features': true,
29
+
30
+ /** @see [stylelint-order](https://github.com/hudochenkov/stylelint-order) */
31
+ order: true,
32
+
33
+ /** @see [stylelint-scss](https://github.com/kristerkari/stylelint-scss) */
34
+ scss: true,
35
+
36
+ /** @see [stylelint-selector-no-empty](https://github.com/ssivanatarajan/stylelint-selector-no-empty) */
37
+ 'selector-no-empty': true,
38
+
39
+ /** @see [stylelint-use-nesting](https://github.com/csstools/stylelint-use-nesting) */
40
+ 'use-nesting': true,
41
+
42
+ /** @see [stylelint-config-recommended-vue](https://github.com/ota-meshi/stylelint-config-recommended-vue) */
43
+ vue: true,
44
+ };
45
+
46
+ const OPTIONAL_PLUGINS = {
47
+ /** @see [stylelint-gamut](https://github.com/fpetrakov/stylelint-gamut) */
48
+ gamut: false,
49
+
50
+ /** @see [stylelint-plugin-logical-css](https://github.com/yuschick/stylelint-plugin-logical-css) */
51
+ 'logical-css': false,
52
+
53
+ /** @see [stylelint-no-indistinguishable-colors](https://github.com/ierhyna/stylelint-no-indistinguishable-colors) */
54
+ 'no-indistinguishable-colors': false,
55
+ };
56
+
57
+ const PRETTIER_PLUGINS = {
58
+ /** @see [stylelint-prettier](https://github.com/prettier/stylelint-prettier) */
59
+ prettier: true,
60
+ };
61
+
62
+ const PLUGINS = {
63
+ ...ADDITIONAL_PLUGINS,
64
+ ...OPTIONAL_PLUGINS,
65
+ ...PRETTIER_PLUGINS,
66
+ };
67
+
68
+ /**
69
+ * Create "extends" field
70
+ *
71
+ * @param {PLUGINS} incomingPlugins Plugins
72
+ */
73
+ const connectPlugins = (incomingPlugins = {}) => {
74
+ const extendsPlugins = [];
75
+
76
+ Object.entries({ ...PLUGINS, ...incomingPlugins })?.forEach(
77
+ ([name, isActive]) => {
78
+ if (isActive) {
79
+ extendsPlugins.push(`@alexlit/config-stylelint/plugins/${name}`);
80
+ }
81
+ },
82
+ );
83
+
84
+ return extendsPlugins;
85
+ };
86
+
87
+ /**
88
+ * Create stylelint config
89
+ *
90
+ * @param {PLUGINS} incomingPlugins Plugins
91
+ * @param {import('stylelint').Config} incomingConfig Stylelint config
92
+ */
93
+ const createConfig = (incomingPlugins = {}, incomingConfig = {}) => ({
94
+ ...incomingConfig,
95
+
3
96
  extends: [
4
97
  'stylelint-config-standard',
5
-
6
- './plugins/a11y',
7
- './plugins/at-rule-no-children',
8
- './plugins/color-format',
9
- './plugins/declaration-block-no-ignored-properties',
10
- './plugins/high-performance-animation',
11
- './plugins/no-nested-media',
12
- './plugins/no-unresolved-module',
13
- './plugins/no-unsupported-browser-features',
14
- './plugins/order',
15
- './plugins/scss',
16
- './plugins/selector-no-empty',
17
- // './plugins/use-nesting',
18
- './plugins/vue',
19
-
20
- './plugins/prettier',
21
-
22
- // optional
23
- // './plugins/optional/gamut',
24
- // './plugins/optional/no-indistinguishable-colors',
25
- // './plugins/optional/logical-css',
98
+ ...connectPlugins(incomingPlugins),
99
+ ...(incomingConfig.extends ?? []),
26
100
  ],
27
101
 
28
102
  ignoreFiles: [
29
- '.*/**',
30
- 'build/**',
31
- 'dist/**',
32
- 'docs/**',
33
- 'node_modules/**',
34
- 'storybook-*/**',
103
+ ...(config.ignoreFiles ?? []),
104
+ ...(incomingConfig.ignoreFiles ?? []),
35
105
  ],
36
106
 
37
- rules: {
38
- 'alpha-value-notation': 'number',
39
- 'annotation-no-unknown': [true, { ignoreAnnotations: ['default'] }],
40
- 'at-rule-disallowed-list': ['debug'],
41
-
42
- 'at-rule-empty-line-before': [
43
- 'always',
44
- {
45
- except: ['blockless-after-same-name-blockless', 'first-nested'],
46
- ignoreAtRules: ['else'],
47
- },
48
- ],
49
-
50
- 'at-rule-no-unknown': null,
51
- 'at-rule-no-vendor-prefix': true,
52
- 'block-no-empty': null,
53
- 'color-function-notation': 'modern',
54
- 'color-hex-length': 'short',
55
- 'color-no-hex': true,
56
- 'color-no-invalid-hex': true,
57
-
58
- 'custom-property-empty-line-before': [
59
- 'always',
60
- {
61
- except: ['after-comment', 'after-custom-property', 'first-nested'],
62
- },
63
- ],
64
-
65
- 'custom-property-pattern': '^_?[a-z]+([a-z0-9-]+[a-z0-9]+)?$',
66
- 'declaration-block-no-redundant-longhand-properties': null,
67
-
68
- 'declaration-property-value-no-unknown': [
69
- true,
70
- {
71
- ignoreProperties: {
72
- '/.+/': /^(v-(bind|deep|global|slotted)|theme|view)|\$/,
73
- },
74
- },
75
- ],
76
-
77
- 'font-family-name-quotes': 'always-unless-keyword',
78
- 'function-no-unknown': null, // delegate to scss/function-no-unknown
79
- 'function-url-quotes': 'always',
80
- 'function-url-scheme-disallowed-list': ['/^data/', 'ftp', '/^http/'],
81
- 'hue-degree-notation': 'angle',
82
- 'keyframes-name-pattern': '^[a-z]+(-[a-z]+)*$',
83
-
84
- 'max-nesting-depth': [
85
- 6,
86
- {
87
- ignoreAtRules: ['each', 'media', 'supports', 'include'],
88
- },
89
- ],
90
-
91
- 'media-feature-name-no-unknown': [
92
- true,
93
- { ignoreMediaFeatureNames: ['screen'] },
94
- ],
95
-
96
- 'media-feature-name-no-vendor-prefix': true,
97
- 'no-descending-specificity': null,
98
- 'no-empty-source': null,
99
- 'no-unknown-animations': true,
100
- 'number-max-precision': 3,
101
-
102
- 'property-no-unknown': [
103
- true,
104
- { ignoreProperties: ['align-tracks', 'animation-timeline'] },
105
- ],
106
-
107
- 'property-no-vendor-prefix': true,
108
-
109
- 'rule-empty-line-before': [
110
- 'always',
111
- {
112
- except: ['first-nested'],
113
- ignore: [],
114
- },
115
- ],
116
-
117
- 'selector-class-pattern': [
118
- '^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$',
119
- {
120
- message:
121
- 'Selector should be written as BEM "block__element--modifier--value" (selector-class-pattern)',
122
- },
123
- ],
124
-
125
- 'selector-combinator-disallowed-list': ['>>>', '/deep/'],
126
-
127
- 'selector-max-compound-selectors': 6,
128
- 'selector-max-id': 0,
129
- 'selector-no-qualifying-type': null,
130
- 'selector-no-vendor-prefix': true,
131
- 'selector-pseudo-element-disallowed-list': ['shadow'],
132
-
133
- 'selector-pseudo-element-no-unknown': [
134
- true,
135
- { ignorePseudoElements: ['v-deep', 'file-selector-button'] },
136
- ],
137
-
138
- 'selector-type-no-unknown': [true, { ignoreTypes: ['ymaps'] }],
139
- 'shorthand-property-no-redundant-values': true,
140
- 'string-no-newline': null,
141
- 'time-min-milliseconds': 16,
142
-
143
- 'value-keyword-case': [
144
- 'lower',
145
- { camelCaseSvgKeywords: true, ignoreFunctions: ['v-bind'] },
146
- ],
147
-
148
- 'value-no-vendor-prefix': true,
149
- },
150
- };
107
+ plugins: [...(config.plugins ?? []), ...(incomingConfig.plugins ?? [])],
108
+
109
+ rules: { ...config.rules, ...incomingConfig.rules },
110
+ });
111
+
112
+ export { createConfig };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexlit/config-stylelint",
3
- "version": "44.0.3",
3
+ "version": "45.0.1",
4
4
  "private": false,
5
5
  "description": "Stylelint config",
6
6
  "keywords": [
@@ -25,6 +25,7 @@
25
25
  "main": "index.js",
26
26
  "files": [
27
27
  "README.md",
28
+ "config.js",
28
29
  "index.js",
29
30
  "plugins"
30
31
  ],
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-a11y](https://github.com/double-great/stylelint-a11y) */
2
1
  export default {
3
2
  plugins: ['@double-great/stylelint-a11y'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-at-rule-no-children](https://github.com/adityavm/stylelint-at-rule-no-children) */
2
1
  export default {
3
2
  plugins: ['stylelint-at-rule-no-children'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-color-format](https://github.com/filipekiss/stylelint-color-format) */
2
1
  export default {
3
2
  plugins: ['stylelint-color-format'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-declaration-block-no-ignored-properties](https://github.com/kristerkari/stylelint-declaration-block-no-ignored-properties) */
2
1
  export default {
3
2
  plugins: ['stylelint-declaration-block-no-ignored-properties'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-gamut](https://github.com/fpetrakov/stylelint-gamut) */
2
1
  export default {
3
2
  plugins: ['stylelint-gamut'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-high-performance-animation](https://github.com/kristerkari/stylelint-high-performance-animation) */
2
1
  export default {
3
2
  plugins: ['stylelint-high-performance-animation'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-plugin-logical-css](https://github.com/yuschick/stylelint-plugin-logical-css) */
2
1
  export default {
3
2
  plugins: ['stylelint-plugin-logical-css'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-no-indistinguishable-colors](https://github.com/ierhyna/stylelint-no-indistinguishable-colors) */
2
1
  export default {
3
2
  plugins: ['stylelint-no-indistinguishable-colors'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-no-nested-media](https://github.com/dkrnl/stylelint-no-nested-media) */
2
1
  export default {
3
2
  plugins: ['stylelint-no-nested-media'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-no-unresolved-module](https://github.com/niksy/stylelint-no-unresolved-module) */
2
1
  export default {
3
2
  plugins: ['stylelint-no-unresolved-module'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-no-unsupported-browser-features](https://github.com/ismay/stylelint-no-unsupported-browser-features) */
2
1
  export default {
3
2
  plugins: ['stylelint-no-unsupported-browser-features'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-order](https://github.com/hudochenkov/stylelint-order) */
2
1
  export default {
3
2
  plugins: ['stylelint-order'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-prettier](https://github.com/prettier/stylelint-prettier) */
2
1
  export default {
3
2
  plugins: ['stylelint-prettier'],
4
3
 
@@ -1,7 +1,6 @@
1
1
  /* eslint-disable unicorn/no-null */
2
2
  const KEBAB_CASE_PATTERN = '^[a-z]+([a-z0-9-]+[a-z0-9]+)?$';
3
3
 
4
- /** @see [stylelint-scss](https://github.com/kristerkari/stylelint-scss) */
5
4
  export default {
6
5
  extends: ['stylelint-config-standard-scss'],
7
6
 
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-selector-no-empty](https://github.com/ssivanatarajan/stylelint-selector-no-empty) */
2
1
  export default {
3
2
  plugins: ['stylelint-selector-no-empty'],
4
3
 
@@ -1,4 +1,3 @@
1
- /** @see [stylelint-use-nesting](https://github.com/csstools/stylelint-use-nesting) */
2
1
  export default {
3
2
  plugins: ['stylelint-use-nesting'],
4
3
 
@@ -1,5 +1,3 @@
1
- /** @see [stylelint-config-recommended-vue](https://github.com/ota-meshi/stylelint-config-recommended-vue) */
2
-
3
1
  export default {
4
2
  extends: 'stylelint-config-recommended-vue',
5
3
  };
@@ -1,14 +1,6 @@
1
- import config from '@alexlit/config-stylelint';
1
+ import { createConfig } from '@alexlit/config-stylelint';
2
2
 
3
- export default {
4
- extends: [
5
- '@alexlit/config-stylelint',
6
-
7
- /* optional */
8
- '@alexlit/config-stylelint/plugins/optional/gamut',
9
- // '@alexlit/config-stylelint/plugins/optional/no-indistinguishable-colors',
10
- '@alexlit/config-stylelint/plugins/optional/logical-css',
11
- ],
12
-
13
- ignoreFiles: [...config.ignoreFiles],
14
- };
3
+ export default createConfig({
4
+ gamut: true,
5
+ 'logical-css': true,
6
+ });