@alexlit/lint-kit 215.0.0 → 216.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.
Files changed (73) hide show
  1. package/eslint.config.js +8 -4
  2. package/package.json +1 -1
  3. package/packages/config-eslint/README.md +57 -32
  4. package/packages/config-eslint/base.js +4 -1
  5. package/packages/config-eslint/index.d.ts +34 -32
  6. package/packages/config-eslint/index.js +5 -2
  7. package/packages/config-eslint/package.json +4 -4
  8. package/packages/config-eslint/plugins/de-morgan.js +4 -2
  9. package/packages/config-eslint/plugins/import-x.js +5 -1
  10. package/packages/config-eslint/plugins/javascript.js +5 -1
  11. package/packages/config-eslint/plugins/jsdoc.js +5 -1
  12. package/packages/config-eslint/plugins/json.js +5 -1
  13. package/packages/config-eslint/plugins/perfectionist.js +5 -1
  14. package/packages/config-eslint/plugins/pinia.js +5 -1
  15. package/packages/config-eslint/plugins/prettier.js +10 -2
  16. package/packages/config-eslint/plugins/regexp.js +5 -1
  17. package/packages/config-eslint/plugins/sonar.js +5 -1
  18. package/packages/config-eslint/plugins/stylistic.js +5 -1
  19. package/packages/config-eslint/plugins/tailwindcss.js +20 -17
  20. package/packages/config-eslint/plugins/tanstack-query.js +5 -1
  21. package/packages/config-eslint/plugins/typescript-type-checked.js +5 -1
  22. package/packages/config-eslint/plugins/typescript.js +5 -1
  23. package/packages/config-eslint/plugins/unicorn.js +5 -1
  24. package/packages/config-eslint/plugins/unocss.js +5 -1
  25. package/packages/config-eslint/plugins/vitest.js +5 -1
  26. package/packages/config-eslint/plugins/vue-accessibility.js +5 -1
  27. package/packages/config-eslint/plugins/vue-i18n.js +10 -5
  28. package/packages/config-eslint/plugins/vue.js +5 -1
  29. package/packages/config-eslint/plugins/zod.js +5 -1
  30. package/packages/config-hooks/README.md +2 -2
  31. package/packages/config-htmllint/README.md +2 -2
  32. package/packages/config-markdownlint/README.md +2 -2
  33. package/packages/config-npmlint/README.md +2 -2
  34. package/packages/config-prettier/README.md +68 -16
  35. package/packages/config-prettier/index.d.ts +9 -1
  36. package/packages/config-prettier/index.js +20 -28
  37. package/packages/config-prettier/package.json +3 -2
  38. package/packages/config-prettier/plugins/jsdoc.js +14 -8
  39. package/packages/config-prettier/plugins/mdc.js +12 -6
  40. package/packages/config-prettier/plugins/packagejson.js +9 -5
  41. package/packages/config-prettier/plugins/php.js +9 -5
  42. package/packages/config-prettier/plugins/pug.js +15 -9
  43. package/packages/config-prettier/plugins/ruby.js +12 -6
  44. package/packages/config-prettier/plugins/sh.js +9 -5
  45. package/packages/config-prettier/plugins/solidity.js +9 -5
  46. package/packages/config-prettier/plugins/sort-json.js +12 -6
  47. package/packages/config-prettier/plugins/sql.js +9 -5
  48. package/packages/config-prettier/plugins/tailwindcss.js +18 -12
  49. package/packages/config-prettier/plugins/xml.js +12 -6
  50. package/packages/config-prettier/utils/merge-configs.js +18 -0
  51. package/packages/config-stylelint/README.md +80 -29
  52. package/packages/config-stylelint/index.d.ts +4 -0
  53. package/packages/config-stylelint/index.js +4 -12
  54. package/packages/config-stylelint/package.json +3 -2
  55. package/packages/config-stylelint/plugins/a11y.js +15 -21
  56. package/packages/config-stylelint/plugins/bem.js +14 -13
  57. package/packages/config-stylelint/plugins/color-format.js +10 -8
  58. package/packages/config-stylelint/plugins/declaration-block-no-ignored-properties.js +10 -12
  59. package/packages/config-stylelint/plugins/gamut.js +9 -9
  60. package/packages/config-stylelint/plugins/high-performance-animation.js +15 -15
  61. package/packages/config-stylelint/plugins/logical-css.js +9 -8
  62. package/packages/config-stylelint/plugins/media-use-custom-media.js +10 -9
  63. package/packages/config-stylelint/plugins/no-indistinguishable-colors.js +10 -12
  64. package/packages/config-stylelint/plugins/no-nested-media.js +9 -9
  65. package/packages/config-stylelint/plugins/no-unresolved-module.js +16 -16
  66. package/packages/config-stylelint/plugins/no-unsupported-browser-features.js +16 -16
  67. package/packages/config-stylelint/plugins/order.js +15 -17
  68. package/packages/config-stylelint/plugins/prettier.js +9 -9
  69. package/packages/config-stylelint/plugins/scss.js +14 -17
  70. package/packages/config-stylelint/plugins/selector-no-empty.js +10 -9
  71. package/packages/config-stylelint/plugins/use-nesting.js +9 -12
  72. package/packages/config-stylelint/plugins/vue.js +6 -7
  73. package/packages/config-stylelint/utils/merge-configs.js +20 -0
@@ -1,23 +1,23 @@
1
+ import { mergeConfigs } from '../utils/merge-configs.js';
2
+
3
+ const DEFAULTS = {
4
+ plugins: ['stylelint-high-performance-animation'],
5
+ rules: {
6
+ 'plugin/no-low-performance-animation-properties': [
7
+ true,
8
+ { ignore: 'paint-properties', ignoreProperties: [] },
9
+ ],
10
+ },
11
+ };
12
+
1
13
  /**
2
14
  * Запрещает анимации, нагружающие рендеринг.
3
15
  *
4
- * @param {Partial<import('stylelint').Config>} [options] - Опции, накладываемые
5
- * поверх значений по умолчанию (shallow merge)
16
+ * @param {Partial<import('stylelint').Config>} [options]
6
17
  *
7
18
  * @returns {import('stylelint').Config}
8
19
  *
9
20
  * @see [stylelint-high-performance-animation](https://github.com/kristerkari/stylelint-high-performance-animation)
10
21
  */
11
- export const highPerformanceAnimation = (options = {}) => ({
12
- plugins: ['stylelint-high-performance-animation'],
13
-
14
- ...options,
15
-
16
- rules: {
17
- 'plugin/no-low-performance-animation-properties': [
18
- true,
19
- { ignore: 'paint-properties', ignoreProperties: [] },
20
- ],
21
- ...options.rules,
22
- },
23
- });
22
+ export const highPerformanceAnimation = (options = {}) =>
23
+ mergeConfigs(DEFAULTS, options);
@@ -1,16 +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-свойств.
3
10
  *
4
- * @param {Partial<import('stylelint').Config>} [options] - Опции, накладываемые
5
- * поверх значений по умолчанию (shallow merge)
11
+ * @param {Partial<import('stylelint').Config>} [options]
6
12
  *
7
13
  * @returns {import('stylelint').Config}
8
14
  *
9
15
  * @see [stylelint-plugin-logical-css](https://github.com/yuschick/stylelint-plugin-logical-css)
10
16
  */
11
- export const logicalCss = (options = {}) => ({
12
- extends: ['stylelint-plugin-logical-css/configs/recommended'],
13
- plugins: ['stylelint-plugin-logical-css'],
14
-
15
- ...options,
16
- });
17
+ export const logicalCss = (options = {}) => mergeConfigs(DEFAULTS, options);
@@ -1,17 +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
  * Требует использования кастомных медиа-запросов.
3
10
  *
4
- * @param {Partial<import('stylelint').Config>} [options] - Опции, накладываемые
5
- * поверх значений по умолчанию (shallow merge)
11
+ * @param {Partial<import('stylelint').Config>} [options]
6
12
  *
7
13
  * @returns {import('stylelint').Config}
8
14
  *
9
15
  * @see [stylelint-media-use-custom-media](https://github.com/csstools/stylelint-media-use-custom-media)
10
16
  */
11
- export const mediaUseCustomMedia = (options = {}) => ({
12
- plugins: ['stylelint-media-use-custom-media'],
13
-
14
- ...options,
15
-
16
- rules: { 'csstools/media-use-custom-media': 'always', ...options.rules },
17
- });
17
+ export const mediaUseCustomMedia = (options = {}) =>
18
+ mergeConfigs(DEFAULTS, options);
@@ -1,20 +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
  * Запрещает неразличимые цвета.
3
10
  *
4
- * @param {Partial<import('stylelint').Config>} [options] - Опции, накладываемые
5
- * поверх значений по умолчанию (shallow merge)
11
+ * @param {Partial<import('stylelint').Config>} [options]
6
12
  *
7
13
  * @returns {import('stylelint').Config}
8
14
  *
9
15
  * @see [stylelint-no-indistinguishable-colors](https://github.com/ierhyna/stylelint-no-indistinguishable-colors)
10
16
  */
11
- export const noIndistinguishableColors = (options = {}) => ({
12
- plugins: ['stylelint-no-indistinguishable-colors'],
13
-
14
- ...options,
15
-
16
- rules: {
17
- 'plugin/stylelint-no-indistinguishable-colors': true,
18
- ...options.rules,
19
- },
20
- });
17
+ export const noIndistinguishableColors = (options = {}) =>
18
+ mergeConfigs(DEFAULTS, options);
@@ -1,17 +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
  * Запрещает вложенные медиа-запросы.
3
10
  *
4
- * @param {Partial<import('stylelint').Config>} [options] - Опции, накладываемые
5
- * поверх значений по умолчанию (shallow merge)
11
+ * @param {Partial<import('stylelint').Config>} [options]
6
12
  *
7
13
  * @returns {import('stylelint').Config}
8
14
  *
9
15
  * @see [stylelint-no-nested-media](https://github.com/dkrnl/stylelint-no-nested-media)
10
16
  */
11
- export const noNestedMedia = (options = {}) => ({
12
- plugins: ['stylelint-no-nested-media'],
13
-
14
- ...options,
15
-
16
- rules: { 'pitcher/no-nested-media': true, ...options.rules },
17
- });
17
+ export const noNestedMedia = (options = {}) => mergeConfigs(DEFAULTS, options);
@@ -1,18 +1,7 @@
1
- /**
2
- * Проверяет разрешение импортов.
3
- *
4
- * @param {Partial<import('stylelint').Config>} [options] - Опции, накладываемые
5
- * поверх значений по умолчанию (shallow merge)
6
- *
7
- * @returns {import('stylelint').Config}
8
- *
9
- * @see [stylelint-no-unresolved-module](https://github.com/niksy/stylelint-no-unresolved-module)
10
- */
11
- export const noUnresolvedModule = (options = {}) => ({
12
- plugins: ['stylelint-no-unresolved-module'],
13
-
14
- ...options,
1
+ import { mergeConfigs } from '../utils/merge-configs.js';
15
2
 
3
+ const DEFAULTS = {
4
+ plugins: ['stylelint-no-unresolved-module'],
16
5
  rules: {
17
6
  'plugin/no-unresolved-module': {
18
7
  alias: { '~assets': 'assets', '~public': 'public', '~static': 'static' },
@@ -27,6 +16,17 @@ export const noUnresolvedModule = (options = {}) => ({
27
16
  'static',
28
17
  ],
29
18
  },
30
- ...options.rules,
31
19
  },
32
- });
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);
@@ -1,18 +1,7 @@
1
- /**
2
- * Проверяет поддержку CSS-функций целевыми браузерами.
3
- *
4
- * @param {Partial<import('stylelint').Config>} [options] - Опции, накладываемые
5
- * поверх значений по умолчанию (shallow merge)
6
- *
7
- * @returns {import('stylelint').Config}
8
- *
9
- * @see [stylelint-no-unsupported-browser-features](https://github.com/ismay/stylelint-no-unsupported-browser-features)
10
- */
11
- export const noUnsupportedBrowserFeatures = (options = {}) => ({
12
- plugins: ['stylelint-no-unsupported-browser-features'],
13
-
14
- ...options,
1
+ import { mergeConfigs } from '../utils/merge-configs.js';
15
2
 
3
+ const DEFAULTS = {
4
+ plugins: ['stylelint-no-unsupported-browser-features'],
16
5
  rules: {
17
6
  'plugin/no-unsupported-browser-features': [
18
7
  true,
@@ -22,6 +11,17 @@ export const noUnsupportedBrowserFeatures = (options = {}) => ({
22
11
  severity: 'warning',
23
12
  },
24
13
  ],
25
- ...options.rules,
26
14
  },
27
- });
15
+ };
16
+
17
+ /**
18
+ * Проверяет поддержку CSS-функций целевыми браузерами.
19
+ *
20
+ * @param {Partial<import('stylelint').Config>} [options]
21
+ *
22
+ * @returns {import('stylelint').Config}
23
+ *
24
+ * @see [stylelint-no-unsupported-browser-features](https://github.com/ismay/stylelint-no-unsupported-browser-features)
25
+ */
26
+ export const noUnsupportedBrowserFeatures = (options = {}) =>
27
+ mergeConfigs(DEFAULTS, options);
@@ -1,3 +1,5 @@
1
+ import { mergeConfigs } from '../utils/merge-configs.js';
2
+
1
3
  const LETTERS = 'abcdefghijklmnopqrstuvwxyz'.split('');
2
4
 
3
5
  const MEDIA_FEATURES = [
@@ -115,21 +117,8 @@ const buildPseudoElementRules = () => [
115
117
  { selector: '::', type: 'rule' },
116
118
  ];
117
119
 
118
- /**
119
- * Настраивает порядок свойств и селекторов.
120
- *
121
- * @param {Partial<import('stylelint').Config>} [options] - Опции, накладываемые
122
- * поверх значений по умолчанию (shallow merge)
123
- *
124
- * @returns {import('stylelint').Config}
125
- *
126
- * @see [stylelint-order](https://github.com/hudochenkov/stylelint-order)
127
- */
128
- export const order = (options = {}) => ({
120
+ const DEFAULTS = {
129
121
  plugins: ['stylelint-order'],
130
-
131
- ...options,
132
-
133
122
  rules: {
134
123
  'order/custom-properties-alphabetical-order': true,
135
124
  'order/order': [
@@ -198,7 +187,16 @@ export const order = (options = {}) => ({
198
187
  ...buildLetterRules('__'),
199
188
  ],
200
189
  'order/properties-alphabetical-order': true,
201
-
202
- ...options.rules,
203
190
  },
204
- });
191
+ };
192
+
193
+ /**
194
+ * Настраивает порядок свойств и селекторов.
195
+ *
196
+ * @param {Partial<import('stylelint').Config>} [options]
197
+ *
198
+ * @returns {import('stylelint').Config}
199
+ *
200
+ * @see [stylelint-order](https://github.com/hudochenkov/stylelint-order)
201
+ */
202
+ export const order = (options = {}) => mergeConfigs(DEFAULTS, options);
@@ -1,17 +1,17 @@
1
+ import { mergeConfigs } from '../utils/merge-configs.js';
2
+
3
+ const DEFAULTS = {
4
+ plugins: ['stylelint-prettier'],
5
+ rules: { 'prettier/prettier': true },
6
+ };
7
+
1
8
  /**
2
9
  * Интегрирует Prettier.
3
10
  *
4
- * @param {Partial<import('stylelint').Config>} [options] - Опции, накладываемые
5
- * поверх значений по умолчанию (shallow merge)
11
+ * @param {Partial<import('stylelint').Config>} [options]
6
12
  *
7
13
  * @returns {import('stylelint').Config}
8
14
  *
9
15
  * @see [stylelint-prettier](https://github.com/prettier/stylelint-prettier)
10
16
  */
11
- export const prettier = (options = {}) => ({
12
- plugins: ['stylelint-prettier'],
13
-
14
- ...options,
15
-
16
- rules: { 'prettier/prettier': true, ...options.rules },
17
- });
17
+ export const prettier = (options = {}) => mergeConfigs(DEFAULTS, options);
@@ -1,23 +1,11 @@
1
1
  /* eslint-disable unicorn/no-null */
2
+ import { mergeConfigs } from '../utils/merge-configs.js';
2
3
 
3
4
  const KEBAB_CASE_PATTERN = '^[a-z]+([a-z0-9-]+[a-z0-9]+)?$';
4
5
 
5
- /**
6
- * Настраивает линтинг SCSS.
7
- *
8
- * @param {Partial<import('stylelint').Config>} [options] - Опции, накладываемые
9
- * поверх значений по умолчанию (shallow merge)
10
- *
11
- * @returns {import('stylelint').Config}
12
- *
13
- * @see [stylelint-scss](https://github.com/kristerkari/stylelint-scss)
14
- */
15
- export const scss = (options = {}) => ({
6
+ const DEFAULTS = {
16
7
  extends: ['stylelint-config-standard-scss'],
17
8
  plugins: ['stylelint-scss'],
18
-
19
- ...options,
20
-
21
9
  rules: {
22
10
  'scss/at-each-key-value-single-line': true,
23
11
  'scss/at-else-if-parentheses-space-before': 'always',
@@ -100,7 +88,16 @@ export const scss = (options = {}) => ({
100
88
  true,
101
89
  { ignoreKeywords: [] },
102
90
  ],
103
-
104
- ...options.rules,
105
91
  },
106
- });
92
+ };
93
+
94
+ /**
95
+ * Настраивает линтинг SCSS.
96
+ *
97
+ * @param {Partial<import('stylelint').Config>} [options]
98
+ *
99
+ * @returns {import('stylelint').Config}
100
+ *
101
+ * @see [stylelint-scss](https://github.com/kristerkari/stylelint-scss)
102
+ */
103
+ export const scss = (options = {}) => mergeConfigs(DEFAULTS, options);
@@ -1,17 +1,18 @@
1
+ import { mergeConfigs } from '../utils/merge-configs.js';
2
+
3
+ const DEFAULTS = {
4
+ plugins: ['stylelint-selector-no-empty'],
5
+ rules: { 'plugin/stylelint-selector-no-empty': true },
6
+ };
7
+
1
8
  /**
2
9
  * Запрещает пустые селекторы.
3
10
  *
4
- * @param {Partial<import('stylelint').Config>} [options] - Опции, накладываемые
5
- * поверх значений по умолчанию (shallow merge)
11
+ * @param {Partial<import('stylelint').Config>} [options]
6
12
  *
7
13
  * @returns {import('stylelint').Config}
8
14
  *
9
15
  * @see [stylelint-selector-no-empty](https://github.com/ssivanatarajan/stylelint-selector-no-empty)
10
16
  */
11
- export const selectorNoEmpty = (options = {}) => ({
12
- plugins: ['stylelint-selector-no-empty'],
13
-
14
- ...options,
15
-
16
- rules: { 'plugin/stylelint-selector-no-empty': true, ...options.rules },
17
- });
17
+ export const selectorNoEmpty = (options = {}) =>
18
+ mergeConfigs(DEFAULTS, options);
@@ -1,20 +1,17 @@
1
+ import { mergeConfigs } from '../utils/merge-configs.js';
2
+
3
+ const DEFAULTS = {
4
+ plugins: ['stylelint-use-nesting'],
5
+ rules: { 'csstools/use-nesting': ['always', { except: [], syntax: 'scss' }] },
6
+ };
7
+
1
8
  /**
2
9
  * Требует использования CSS-вложенности.
3
10
  *
4
- * @param {Partial<import('stylelint').Config>} [options] - Опции, накладываемые
5
- * поверх значений по умолчанию (shallow merge)
11
+ * @param {Partial<import('stylelint').Config>} [options]
6
12
  *
7
13
  * @returns {import('stylelint').Config}
8
14
  *
9
15
  * @see [stylelint-use-nesting](https://github.com/csstools/stylelint-use-nesting)
10
16
  */
11
- export const useNesting = (options = {}) => ({
12
- plugins: ['stylelint-use-nesting'],
13
-
14
- ...options,
15
-
16
- rules: {
17
- 'csstools/use-nesting': ['always', { except: [], syntax: 'scss' }],
18
- ...options.rules,
19
- },
20
- });
17
+ export const useNesting = (options = {}) => mergeConfigs(DEFAULTS, options);
@@ -1,15 +1,14 @@
1
+ import { mergeConfigs } from '../utils/merge-configs.js';
2
+
3
+ const DEFAULTS = { extends: 'stylelint-config-recommended-vue' };
4
+
1
5
  /**
2
6
  * Подключает поддержку Vue.js SFC.
3
7
  *
4
- * @param {Partial<import('stylelint').Config>} [options] - Опции, накладываемые
5
- * поверх значений по умолчанию (shallow merge)
8
+ * @param {Partial<import('stylelint').Config>} [options]
6
9
  *
7
10
  * @returns {import('stylelint').Config}
8
11
  *
9
12
  * @see [stylelint-config-recommended-vue](https://github.com/ota-meshi/stylelint-config-recommended-vue)
10
13
  */
11
- export const vue = (options = {}) => ({
12
- extends: 'stylelint-config-recommended-vue',
13
-
14
- ...options,
15
- });
14
+ export const vue = (options = {}) => mergeConfigs(DEFAULTS, options);
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Объединяет конфиги Stylelint по единой политике.
3
+ *
4
+ * Коллекции (`extends`, `ignoreFiles`, `overrides`, `plugins`) дополняются в
5
+ * порядке аргументов, `plugins` дедуплицируются. `rules` мержатся поверхностно:
6
+ * настройка одноимённого правила из последнего конфига заменяет предыдущую
7
+ * целиком. Остальные поля перезаписываются последним конфигом.
8
+ *
9
+ * @param {...import('stylelint').Config} configs - Конфиги в порядке приоритета
10
+ *
11
+ * @returns {import('stylelint').Config}
12
+ */
13
+ export const mergeConfigs = (...configs) => ({
14
+ ...Object.assign({}, ...configs),
15
+ extends: configs.flatMap((config) => config.extends ?? []),
16
+ ignoreFiles: configs.flatMap((config) => config.ignoreFiles ?? []),
17
+ overrides: configs.flatMap((config) => config.overrides ?? []),
18
+ plugins: [...new Set(configs.flatMap((config) => config.plugins ?? []))],
19
+ rules: Object.assign({}, ...configs.map((config) => config.rules ?? {})),
20
+ });