@itcase/lint 1.1.137 → 1.1.139
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 +23 -0
- package/dist/eslint/index.js +1 -1
- package/dist/eslint/mobx/index.d.ts +0 -3
- package/dist/eslint/perfectionist/index.js +1 -1
- package/dist/eslint/storybook/index.d.ts +25 -25
- package/dist/{sortUnionTypes_2NZizu0R.js → sortUnionTypes_C5VVNaF3.js} +1 -1
- package/dist/stylelint/index.js +410 -0
- package/package.json +26 -26
- package/dist/stylelint/index2.js +0 -237
- package/dist/stylelint/index3.js +0 -421
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
## [1.1.139](https://github.com/ITCase/itcase-lint/compare/v1.1.138...v1.1.139) (2026-12-03)
|
|
2
|
+
|
|
3
|
+
### Continuous Integrations
|
|
4
|
+
|
|
5
|
+
* **other:** add publish permissions and npm github release preset ([501702a](https://github.com/ITCase/itcase-lint/commit/501702abaf0bc91a8f4e1d963f65f77b8ca85894))
|
|
6
|
+
* **other:** bump node version in publish workflow to 26.13 ([27c33a1](https://github.com/ITCase/itcase-lint/commit/27c33a184bcadcc1c50bc917ef5cbab467426c22))
|
|
7
|
+
* **other:** remove npm dependabot configuration ([ca8157c](https://github.com/ITCase/itcase-lint/commit/ca8157c7169693f5e11150ff5188d2116a347cb7))
|
|
8
|
+
|
|
9
|
+
### Dependencies
|
|
10
|
+
|
|
11
|
+
* **other:** bump dependencies ([b56406e](https://github.com/ITCase/itcase-lint/commit/b56406e543e471de08c7a7ae31b1756f7f8b36e6))
|
|
12
|
+
* **eslint:** bump eslint parser and plugin dependencies ([3335fa6](https://github.com/ITCase/itcase-lint/commit/3335fa629d015af2eb552e8e50bbb1418e5430c0))
|
|
13
|
+
|
|
14
|
+
## [1.1.138](https://github.com/ITCase/itcase-lint/compare/v1.1.137...v1.1.138) (2026-11-17)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **stylelint:** clone ast for selector checks and allow postcss-each property names ([d28d96b](https://github.com/ITCase/itcase-lint/commit/d28d96ba136b4e25b6e98f95f0dd7938209b98ca))
|
|
19
|
+
|
|
20
|
+
### Dependencies
|
|
21
|
+
|
|
22
|
+
* **other:** bump typescript-eslint, perfectionist, rollup, and lint-staged ([c3bfa62](https://github.com/ITCase/itcase-lint/commit/c3bfa625cd300555f109cf13dd736fb045a7f2d3))
|
|
23
|
+
|
|
1
24
|
## [1.1.137](https://github.com/ITCase/itcase-lint/compare/v1.1.136...v1.1.137) (2026-11-15)
|
|
2
25
|
|
|
3
26
|
### Features
|
package/dist/eslint/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import eslintReactHooks from 'eslint-plugin-react-hooks';
|
|
|
12
12
|
import eslintReactNative from 'eslint-plugin-react-native';
|
|
13
13
|
import globals from 'globals';
|
|
14
14
|
import eslintTypeScript from 'typescript-eslint';
|
|
15
|
-
import {
|
|
15
|
+
import { s as sortUnionTypes, a as sortObjectTypes, b as sortObjects, c as sortExports, d as sortNamedExports, e as sortMaps, f as sortJSXProps, g as sortIntersectionTypes, h as sortInterfaces, i as sortEnums } from '../sortUnionTypes_C5VVNaF3.js';
|
|
16
16
|
import parser from '@typescript-eslint/parser';
|
|
17
17
|
import { i as itcaseLintPlugin, p as pluginName, r as ruleName, a as pluginName$1, b as ruleName$1, s as storybookConfig } from '../index_CmQAJvhW.js';
|
|
18
18
|
import { noRestrictedSyntaxRestrictWords } from './restrictWords/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { i as sortEnums, c as sortExports, h as sortInterfaces, g as sortIntersectionTypes, f as sortJSXProps, e as sortMaps, d as sortNamedExports, a as sortObjectTypes, b as sortObjects, s as sortUnionTypes } from '../../sortUnionTypes_C5VVNaF3.js';
|
|
2
2
|
|
|
3
3
|
const sortClasses = [
|
|
4
4
|
'error',
|
|
@@ -32,6 +32,7 @@ declare const _default: {
|
|
|
32
32
|
readonly "storybook/default-exports": "error";
|
|
33
33
|
readonly "storybook/hierarchy-separator": "warn";
|
|
34
34
|
readonly "storybook/no-redundant-story-name": "warn";
|
|
35
|
+
readonly "storybook/static-csf-properties": "error";
|
|
35
36
|
readonly "storybook/story-exports": "error";
|
|
36
37
|
readonly "storybook/no-uninstalled-addons"?: undefined;
|
|
37
38
|
};
|
|
@@ -45,6 +46,7 @@ declare const _default: {
|
|
|
45
46
|
readonly "storybook/default-exports"?: undefined;
|
|
46
47
|
readonly "storybook/hierarchy-separator"?: undefined;
|
|
47
48
|
readonly "storybook/no-redundant-story-name"?: undefined;
|
|
49
|
+
readonly "storybook/static-csf-properties"?: undefined;
|
|
48
50
|
readonly "storybook/story-exports"?: undefined;
|
|
49
51
|
};
|
|
50
52
|
})[];
|
|
@@ -101,6 +103,7 @@ declare const _default: {
|
|
|
101
103
|
readonly "storybook/no-redundant-story-name": "warn";
|
|
102
104
|
readonly "storybook/no-renderer-packages": "error";
|
|
103
105
|
readonly "storybook/prefer-pascal-case": "warn";
|
|
106
|
+
readonly "storybook/static-csf-properties": "error";
|
|
104
107
|
readonly "storybook/story-exports": "error";
|
|
105
108
|
readonly "storybook/use-storybook-expect": "error";
|
|
106
109
|
readonly "storybook/use-storybook-testing-library": "error";
|
|
@@ -119,6 +122,7 @@ declare const _default: {
|
|
|
119
122
|
readonly "storybook/no-redundant-story-name"?: undefined;
|
|
120
123
|
readonly "storybook/no-renderer-packages"?: undefined;
|
|
121
124
|
readonly "storybook/prefer-pascal-case"?: undefined;
|
|
125
|
+
readonly "storybook/static-csf-properties"?: undefined;
|
|
122
126
|
readonly "storybook/story-exports"?: undefined;
|
|
123
127
|
readonly "storybook/use-storybook-expect"?: undefined;
|
|
124
128
|
readonly "storybook/use-storybook-testing-library"?: undefined;
|
|
@@ -150,11 +154,6 @@ declare const _default: {
|
|
|
150
154
|
"hierarchy-separator": import("@typescript-eslint/utils/ts-eslint").RuleModule<"useCorrectSeparators" | "deprecatedHierarchySeparator", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
151
155
|
name: string;
|
|
152
156
|
};
|
|
153
|
-
"meta-inline-properties": import("@typescript-eslint/utils/ts-eslint").RuleModule<"metaShouldHaveInlineProperties", {
|
|
154
|
-
csfVersion: number;
|
|
155
|
-
}[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
156
|
-
name: string;
|
|
157
|
-
};
|
|
158
157
|
"meta-satisfies-type": import("@typescript-eslint/utils/ts-eslint").RuleModule<"metaShouldSatisfyType", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
159
158
|
name: string;
|
|
160
159
|
};
|
|
@@ -179,6 +178,9 @@ declare const _default: {
|
|
|
179
178
|
"prefer-pascal-case": import("@typescript-eslint/utils/ts-eslint").RuleModule<"convertToPascalCase" | "usePascalCase", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
180
179
|
name: string;
|
|
181
180
|
};
|
|
181
|
+
"static-csf-properties": import("@typescript-eslint/utils/ts-eslint").RuleModule<"dynamicProperty" | "propertyBeforeSpread" | "movePropertyAfterSpread" | "unresolvableFactoryMeta" | "invalidPreviewImport", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
182
|
+
name: string;
|
|
183
|
+
};
|
|
182
184
|
"story-exports": import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldHaveStoryExport" | "shouldHaveStoryExportWithFilters" | "addStoryExport", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
183
185
|
name: string;
|
|
184
186
|
};
|
|
@@ -205,6 +207,7 @@ declare const _default: {
|
|
|
205
207
|
readonly "storybook/default-exports": "error";
|
|
206
208
|
readonly "storybook/hierarchy-separator": "warn";
|
|
207
209
|
readonly "storybook/no-redundant-story-name": "warn";
|
|
210
|
+
readonly "storybook/static-csf-properties": "error";
|
|
208
211
|
readonly "storybook/story-exports": "error";
|
|
209
212
|
readonly "storybook/no-uninstalled-addons"?: undefined;
|
|
210
213
|
};
|
|
@@ -220,6 +223,7 @@ declare const _default: {
|
|
|
220
223
|
readonly "storybook/default-exports"?: undefined;
|
|
221
224
|
readonly "storybook/hierarchy-separator"?: undefined;
|
|
222
225
|
readonly "storybook/no-redundant-story-name"?: undefined;
|
|
226
|
+
readonly "storybook/static-csf-properties"?: undefined;
|
|
223
227
|
readonly "storybook/story-exports"?: undefined;
|
|
224
228
|
};
|
|
225
229
|
plugins?: undefined;
|
|
@@ -249,11 +253,6 @@ declare const _default: {
|
|
|
249
253
|
"hierarchy-separator": import("@typescript-eslint/utils/ts-eslint").RuleModule<"useCorrectSeparators" | "deprecatedHierarchySeparator", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
250
254
|
name: string;
|
|
251
255
|
};
|
|
252
|
-
"meta-inline-properties": import("@typescript-eslint/utils/ts-eslint").RuleModule<"metaShouldHaveInlineProperties", {
|
|
253
|
-
csfVersion: number;
|
|
254
|
-
}[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
255
|
-
name: string;
|
|
256
|
-
};
|
|
257
256
|
"meta-satisfies-type": import("@typescript-eslint/utils/ts-eslint").RuleModule<"metaShouldSatisfyType", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
258
257
|
name: string;
|
|
259
258
|
};
|
|
@@ -278,6 +277,9 @@ declare const _default: {
|
|
|
278
277
|
"prefer-pascal-case": import("@typescript-eslint/utils/ts-eslint").RuleModule<"convertToPascalCase" | "usePascalCase", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
279
278
|
name: string;
|
|
280
279
|
};
|
|
280
|
+
"static-csf-properties": import("@typescript-eslint/utils/ts-eslint").RuleModule<"dynamicProperty" | "propertyBeforeSpread" | "movePropertyAfterSpread" | "unresolvableFactoryMeta" | "invalidPreviewImport", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
281
|
+
name: string;
|
|
282
|
+
};
|
|
281
283
|
"story-exports": import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldHaveStoryExport" | "shouldHaveStoryExportWithFilters" | "addStoryExport", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
282
284
|
name: string;
|
|
283
285
|
};
|
|
@@ -304,6 +306,7 @@ declare const _default: {
|
|
|
304
306
|
readonly "storybook/default-exports": "error";
|
|
305
307
|
readonly "storybook/hierarchy-separator": "warn";
|
|
306
308
|
readonly "storybook/no-redundant-story-name": "warn";
|
|
309
|
+
readonly "storybook/static-csf-properties": "error";
|
|
307
310
|
readonly "storybook/story-exports": "error";
|
|
308
311
|
readonly "storybook/no-uninstalled-addons"?: undefined;
|
|
309
312
|
};
|
|
@@ -319,6 +322,7 @@ declare const _default: {
|
|
|
319
322
|
readonly "storybook/default-exports"?: undefined;
|
|
320
323
|
readonly "storybook/hierarchy-separator"?: undefined;
|
|
321
324
|
readonly "storybook/no-redundant-story-name"?: undefined;
|
|
325
|
+
readonly "storybook/static-csf-properties"?: undefined;
|
|
322
326
|
readonly "storybook/story-exports"?: undefined;
|
|
323
327
|
};
|
|
324
328
|
plugins?: undefined;
|
|
@@ -357,11 +361,6 @@ declare const _default: {
|
|
|
357
361
|
"hierarchy-separator": import("@typescript-eslint/utils/ts-eslint").RuleModule<"useCorrectSeparators" | "deprecatedHierarchySeparator", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
358
362
|
name: string;
|
|
359
363
|
};
|
|
360
|
-
"meta-inline-properties": import("@typescript-eslint/utils/ts-eslint").RuleModule<"metaShouldHaveInlineProperties", {
|
|
361
|
-
csfVersion: number;
|
|
362
|
-
}[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
363
|
-
name: string;
|
|
364
|
-
};
|
|
365
364
|
"meta-satisfies-type": import("@typescript-eslint/utils/ts-eslint").RuleModule<"metaShouldSatisfyType", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
366
365
|
name: string;
|
|
367
366
|
};
|
|
@@ -386,6 +385,9 @@ declare const _default: {
|
|
|
386
385
|
"prefer-pascal-case": import("@typescript-eslint/utils/ts-eslint").RuleModule<"convertToPascalCase" | "usePascalCase", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
387
386
|
name: string;
|
|
388
387
|
};
|
|
388
|
+
"static-csf-properties": import("@typescript-eslint/utils/ts-eslint").RuleModule<"dynamicProperty" | "propertyBeforeSpread" | "movePropertyAfterSpread" | "unresolvableFactoryMeta" | "invalidPreviewImport", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
389
|
+
name: string;
|
|
390
|
+
};
|
|
389
391
|
"story-exports": import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldHaveStoryExport" | "shouldHaveStoryExportWithFilters" | "addStoryExport", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
390
392
|
name: string;
|
|
391
393
|
};
|
|
@@ -454,11 +456,6 @@ declare const _default: {
|
|
|
454
456
|
"hierarchy-separator": import("@typescript-eslint/utils/ts-eslint").RuleModule<"useCorrectSeparators" | "deprecatedHierarchySeparator", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
455
457
|
name: string;
|
|
456
458
|
};
|
|
457
|
-
"meta-inline-properties": import("@typescript-eslint/utils/ts-eslint").RuleModule<"metaShouldHaveInlineProperties", {
|
|
458
|
-
csfVersion: number;
|
|
459
|
-
}[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
460
|
-
name: string;
|
|
461
|
-
};
|
|
462
459
|
"meta-satisfies-type": import("@typescript-eslint/utils/ts-eslint").RuleModule<"metaShouldSatisfyType", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
463
460
|
name: string;
|
|
464
461
|
};
|
|
@@ -483,6 +480,9 @@ declare const _default: {
|
|
|
483
480
|
"prefer-pascal-case": import("@typescript-eslint/utils/ts-eslint").RuleModule<"convertToPascalCase" | "usePascalCase", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
484
481
|
name: string;
|
|
485
482
|
};
|
|
483
|
+
"static-csf-properties": import("@typescript-eslint/utils/ts-eslint").RuleModule<"dynamicProperty" | "propertyBeforeSpread" | "movePropertyAfterSpread" | "unresolvableFactoryMeta" | "invalidPreviewImport", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
484
|
+
name: string;
|
|
485
|
+
};
|
|
486
486
|
"story-exports": import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldHaveStoryExport" | "shouldHaveStoryExportWithFilters" | "addStoryExport", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
487
487
|
name: string;
|
|
488
488
|
};
|
|
@@ -512,6 +512,7 @@ declare const _default: {
|
|
|
512
512
|
readonly "storybook/no-redundant-story-name": "warn";
|
|
513
513
|
readonly "storybook/no-renderer-packages": "error";
|
|
514
514
|
readonly "storybook/prefer-pascal-case": "warn";
|
|
515
|
+
readonly "storybook/static-csf-properties": "error";
|
|
515
516
|
readonly "storybook/story-exports": "error";
|
|
516
517
|
readonly "storybook/use-storybook-expect": "error";
|
|
517
518
|
readonly "storybook/use-storybook-testing-library": "error";
|
|
@@ -532,6 +533,7 @@ declare const _default: {
|
|
|
532
533
|
readonly "storybook/no-redundant-story-name"?: undefined;
|
|
533
534
|
readonly "storybook/no-renderer-packages"?: undefined;
|
|
534
535
|
readonly "storybook/prefer-pascal-case"?: undefined;
|
|
536
|
+
readonly "storybook/static-csf-properties"?: undefined;
|
|
535
537
|
readonly "storybook/story-exports"?: undefined;
|
|
536
538
|
readonly "storybook/use-storybook-expect"?: undefined;
|
|
537
539
|
readonly "storybook/use-storybook-testing-library"?: undefined;
|
|
@@ -559,11 +561,6 @@ declare const _default: {
|
|
|
559
561
|
"hierarchy-separator": import("@typescript-eslint/utils/ts-eslint").RuleModule<"useCorrectSeparators" | "deprecatedHierarchySeparator", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
560
562
|
name: string;
|
|
561
563
|
};
|
|
562
|
-
"meta-inline-properties": import("@typescript-eslint/utils/ts-eslint").RuleModule<"metaShouldHaveInlineProperties", {
|
|
563
|
-
csfVersion: number;
|
|
564
|
-
}[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
565
|
-
name: string;
|
|
566
|
-
};
|
|
567
564
|
"meta-satisfies-type": import("@typescript-eslint/utils/ts-eslint").RuleModule<"metaShouldSatisfyType", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
568
565
|
name: string;
|
|
569
566
|
};
|
|
@@ -588,6 +585,9 @@ declare const _default: {
|
|
|
588
585
|
"prefer-pascal-case": import("@typescript-eslint/utils/ts-eslint").RuleModule<"convertToPascalCase" | "usePascalCase", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
589
586
|
name: string;
|
|
590
587
|
};
|
|
588
|
+
"static-csf-properties": import("@typescript-eslint/utils/ts-eslint").RuleModule<"dynamicProperty" | "propertyBeforeSpread" | "movePropertyAfterSpread" | "unresolvableFactoryMeta" | "invalidPreviewImport", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
589
|
+
name: string;
|
|
590
|
+
};
|
|
591
591
|
"story-exports": import("@typescript-eslint/utils/ts-eslint").RuleModule<"shouldHaveStoryExport" | "shouldHaveStoryExportWithFilters" | "addStoryExport", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
592
592
|
name: string;
|
|
593
593
|
};
|
|
@@ -547,4 +547,4 @@ const sortUnionTypes = [
|
|
|
547
547
|
},
|
|
548
548
|
];
|
|
549
549
|
|
|
550
|
-
export {
|
|
550
|
+
export { sortObjectTypes as a, sortObjects as b, sortExports as c, sortNamedExports as d, sortMaps as e, sortJSXProps as f, sortIntersectionTypes as g, sortInterfaces as h, sortEnums as i, sortUnionTypes as s };
|
package/dist/stylelint/index.js
CHANGED
|
@@ -1 +1,411 @@
|
|
|
1
|
+
import stylelint from 'stylelint';
|
|
2
|
+
import orderPlugins from 'stylelint-order';
|
|
1
3
|
|
|
4
|
+
// postcss-nested: ^& / ^^& / &^&. Не [attr^="..."] — там после ^ стоит =, не &.
|
|
5
|
+
const postcssNestedParentSelector = /(?:^|[\s>~+,])\^+&|&\^+&/;
|
|
6
|
+
// Кусок после &: БЭМ, псевдо, атрибут, класс или тег. $(token) из postcss-each.
|
|
7
|
+
const nestedSelectorChunk = '(?:(?:__|--|_|-)[\\w$().-]*|::[\\w-]+|:[\\w-]+(?:\\([^)]*\\))?|\\[[^\\]]+\\]|\\.[\\w$().-]+|[A-Za-z0-9]+)?';
|
|
8
|
+
const nestedSelectorPattern = [
|
|
9
|
+
'^(?:[a-z]+&+|\\.[a-z][\\w-]*&+|>\\s+\\^+&+|&+\\^+&+|\\^+&+|&+)',
|
|
10
|
+
nestedSelectorChunk,
|
|
11
|
+
'(?:\\s*[>~+]\\s+\\S+|\\s+\\S+|\\.[\\w$().-]+|::[\\w-]+|:[\\w-]+(?:\\([^)]*\\))?|\\[[^\\]]+\\]|',
|
|
12
|
+
'&+',
|
|
13
|
+
nestedSelectorChunk,
|
|
14
|
+
')*$',
|
|
15
|
+
].join('');
|
|
16
|
+
function readRuleSelector(ruleNode) {
|
|
17
|
+
const raw = ruleNode.raws.selector;
|
|
18
|
+
if (typeof raw === 'string' && raw)
|
|
19
|
+
return raw;
|
|
20
|
+
if (raw &&
|
|
21
|
+
typeof raw === 'object' &&
|
|
22
|
+
'raw' in raw &&
|
|
23
|
+
typeof raw.raw === 'string') {
|
|
24
|
+
return raw.raw;
|
|
25
|
+
}
|
|
26
|
+
return ruleNode.selector;
|
|
27
|
+
}
|
|
28
|
+
function collectParked(walkRules) {
|
|
29
|
+
const parked = [];
|
|
30
|
+
walkRules((ruleNode) => {
|
|
31
|
+
if (!postcssNestedParentSelector.test(readRuleSelector(ruleNode)))
|
|
32
|
+
return;
|
|
33
|
+
parked.push({
|
|
34
|
+
next: ruleNode.next(),
|
|
35
|
+
node: ruleNode,
|
|
36
|
+
parent: ruleNode.parent,
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
return parked;
|
|
40
|
+
}
|
|
41
|
+
// order/properties-order — порядок свойств компонента.
|
|
42
|
+
// У @page другие дескрипторы (size, margin, padding), их из проверки убираем.
|
|
43
|
+
function collectPageAtRules(walkAtRules) {
|
|
44
|
+
const parked = [];
|
|
45
|
+
walkAtRules((atRule) => {
|
|
46
|
+
parked.push({
|
|
47
|
+
next: atRule.next(),
|
|
48
|
+
node: atRule,
|
|
49
|
+
parent: atRule.parent,
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
return parked;
|
|
53
|
+
}
|
|
54
|
+
function restorePageAtRules(parked) {
|
|
55
|
+
// С конца: соседний @page уже снова в дереве, insertBefore попадает в него.
|
|
56
|
+
for (let index = parked.length - 1; index >= 0; index -= 1) {
|
|
57
|
+
const item = parked[index];
|
|
58
|
+
if (!item.parent)
|
|
59
|
+
continue;
|
|
60
|
+
if (item.next && item.next.parent === item.parent) {
|
|
61
|
+
item.parent.insertBefore(item.next, item.node);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
item.parent.append(item.node);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function skipPageDescriptors(orderRule) {
|
|
69
|
+
const wrapped = (primary, secondaryOptions, context) => {
|
|
70
|
+
return (root, result) => {
|
|
71
|
+
const parked = collectPageAtRules((callback) => {
|
|
72
|
+
root.walkAtRules('page', callback);
|
|
73
|
+
});
|
|
74
|
+
for (let index = parked.length - 1; index >= 0; index -= 1) {
|
|
75
|
+
parked[index].node.remove();
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
const outcome = orderRule(primary, secondaryOptions, context)(root, result);
|
|
79
|
+
if (outcome instanceof Promise) {
|
|
80
|
+
return outcome.finally(() => {
|
|
81
|
+
restorePageAtRules(parked);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
restorePageAtRules(parked);
|
|
85
|
+
return outcome;
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
restorePageAtRules(parked);
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
return Object.assign(wrapped, {
|
|
94
|
+
messages: orderRule.messages,
|
|
95
|
+
meta: orderRule.meta,
|
|
96
|
+
primaryOptionArray: orderRule.primaryOptionArray,
|
|
97
|
+
ruleName: orderRule.ruleName,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// css-tree в selector-no-invalid не парсит ^&. Снимаем такие правила на время проверки.
|
|
101
|
+
const selectorNoInvalidRuleName = 'itcase/selector-no-invalid';
|
|
102
|
+
const selectorNoInvalidRule = Object.assign((primary, _secondaryOptions, context) => {
|
|
103
|
+
return async (root, result) => {
|
|
104
|
+
if (primary !== true)
|
|
105
|
+
return;
|
|
106
|
+
// Клон: правила stylelint идут параллельно и видят один root.
|
|
107
|
+
// Снимать ^& с оригинала нельзя — пропадают проверки свойств внутри.
|
|
108
|
+
const clone = root.clone();
|
|
109
|
+
const parked = collectParked((callback) => {
|
|
110
|
+
clone.walkRules(callback);
|
|
111
|
+
});
|
|
112
|
+
for (let index = parked.length - 1; index >= 0; index -= 1) {
|
|
113
|
+
parked[index].node.remove();
|
|
114
|
+
}
|
|
115
|
+
const coreRule = await stylelint.rules['selector-no-invalid'];
|
|
116
|
+
await coreRule(true, {}, context)(clone, result);
|
|
117
|
+
};
|
|
118
|
+
}, {
|
|
119
|
+
messages: {},
|
|
120
|
+
ruleName: selectorNoInvalidRuleName,
|
|
121
|
+
});
|
|
122
|
+
// eslint-disable-next-line import/no-default-export
|
|
123
|
+
var index = {
|
|
124
|
+
extends: ['stylelint-config-standard'],
|
|
125
|
+
ignoreFiles: [
|
|
126
|
+
'**/__*.css',
|
|
127
|
+
'**/import.css',
|
|
128
|
+
'**/vendor/**/*.css',
|
|
129
|
+
'**/vendor/*.css',
|
|
130
|
+
'__*.css',
|
|
131
|
+
'**/*.ts',
|
|
132
|
+
'**/*.tsx',
|
|
133
|
+
'**/*.js',
|
|
134
|
+
'**/*.jsx',
|
|
135
|
+
'**/*.mjs',
|
|
136
|
+
'**/*.md',
|
|
137
|
+
'ios/**/*',
|
|
138
|
+
'android/**/*',
|
|
139
|
+
],
|
|
140
|
+
plugins: [
|
|
141
|
+
'stylelint-prettier',
|
|
142
|
+
...orderPlugins.map((plugin) => {
|
|
143
|
+
if (plugin.ruleName !== 'order/properties-order')
|
|
144
|
+
return plugin;
|
|
145
|
+
return stylelint.createPlugin(plugin.ruleName, skipPageDescriptors(plugin.rule));
|
|
146
|
+
}),
|
|
147
|
+
'stylelint-no-unsupported-browser-features',
|
|
148
|
+
stylelint.createPlugin(selectorNoInvalidRuleName, selectorNoInvalidRule),
|
|
149
|
+
],
|
|
150
|
+
rules: {
|
|
151
|
+
'max-nesting-depth': 20,
|
|
152
|
+
'alpha-value-notation': [
|
|
153
|
+
'number',
|
|
154
|
+
{
|
|
155
|
+
exceptProperties: ['opacity'],
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
'at-rule-empty-line-before': [
|
|
159
|
+
'always',
|
|
160
|
+
{
|
|
161
|
+
except: ['inside-block'],
|
|
162
|
+
ignore: [
|
|
163
|
+
'after-comment',
|
|
164
|
+
'first-nested',
|
|
165
|
+
'blockless-after-same-name-blockless',
|
|
166
|
+
'blockless-after-blockless',
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
'at-rule-no-unknown': [
|
|
171
|
+
true,
|
|
172
|
+
{
|
|
173
|
+
ignoreAtRules: [
|
|
174
|
+
'import-glob',
|
|
175
|
+
'for',
|
|
176
|
+
'each',
|
|
177
|
+
'mixin',
|
|
178
|
+
'extend',
|
|
179
|
+
'define-mixin',
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
'block-no-empty': null,
|
|
184
|
+
'color-function-notation': 'legacy',
|
|
185
|
+
'color-no-hex': true,
|
|
186
|
+
'comment-empty-line-before': [
|
|
187
|
+
'always',
|
|
188
|
+
{
|
|
189
|
+
except: ['first-nested'],
|
|
190
|
+
ignore: ['after-comment'],
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
'custom-property-empty-line-before': null,
|
|
194
|
+
// kebab-case и _, плюс $(token) из postcss-each.
|
|
195
|
+
// value-parser режет $(token) внутри var(): имя доходит как префикс с $ на конце.
|
|
196
|
+
'custom-property-pattern': '^(?:[a-z]|\\$\\([A-Za-z0-9_-]+\\))(?:[a-z0-9_-]|\\$\\([A-Za-z0-9_-]+\\))*\\$?$',
|
|
197
|
+
'declaration-empty-line-before': 'never',
|
|
198
|
+
'declaration-property-value-no-unknown': [
|
|
199
|
+
true,
|
|
200
|
+
{
|
|
201
|
+
ignoreProperties: {
|
|
202
|
+
top: '/.+/',
|
|
203
|
+
right: '/.+/',
|
|
204
|
+
bottom: '/.+/',
|
|
205
|
+
left: '/.+/',
|
|
206
|
+
border: '/.+/',
|
|
207
|
+
margin: '/.+/',
|
|
208
|
+
padding: '/.+/',
|
|
209
|
+
gap: '/.+/',
|
|
210
|
+
'/-gap$/': '/.+/',
|
|
211
|
+
'/^border-/': '/.+/',
|
|
212
|
+
'/^margin-/': '/.+/',
|
|
213
|
+
'/^padding-/': '/.+/',
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
'function-no-unknown': [true, { ignoreFunctions: ['$', 'fluid'] }],
|
|
218
|
+
'function-url-quotes': 'always',
|
|
219
|
+
'hue-degree-notation': 'number',
|
|
220
|
+
'import-notation': 'string',
|
|
221
|
+
'itcase/selector-no-invalid': true,
|
|
222
|
+
'keyframes-name-pattern': [
|
|
223
|
+
'^([a-z]+)([A-Z]?[a-z]+)+$',
|
|
224
|
+
{ message: 'Expected keyframe name to be camelCase' },
|
|
225
|
+
],
|
|
226
|
+
'no-descending-specificity': null,
|
|
227
|
+
'order/order': [
|
|
228
|
+
[
|
|
229
|
+
'declarations',
|
|
230
|
+
{
|
|
231
|
+
type: 'at-rule',
|
|
232
|
+
name: 'extend',
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
type: 'at-rule',
|
|
236
|
+
name: 'mixin',
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
type: 'at-rule',
|
|
240
|
+
name: 'media',
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
type: 'rule',
|
|
244
|
+
selector: '^&::(before|after)',
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
type: 'rule',
|
|
248
|
+
selector: '^&:\\w',
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
type: 'rule',
|
|
252
|
+
selector: '^&_',
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
type: 'rule',
|
|
256
|
+
selector: '^.',
|
|
257
|
+
},
|
|
258
|
+
],
|
|
259
|
+
{
|
|
260
|
+
unspecified: 'bottom',
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
'order/properties-order': [
|
|
264
|
+
[
|
|
265
|
+
'width',
|
|
266
|
+
'height',
|
|
267
|
+
'min-width',
|
|
268
|
+
'min-height',
|
|
269
|
+
'max-width',
|
|
270
|
+
'max-height',
|
|
271
|
+
'aspect-ratio',
|
|
272
|
+
'font',
|
|
273
|
+
'font-size',
|
|
274
|
+
'font-range',
|
|
275
|
+
'font-weight',
|
|
276
|
+
'color',
|
|
277
|
+
'text-shadow',
|
|
278
|
+
'text-decoration',
|
|
279
|
+
'text-transform',
|
|
280
|
+
'text-align',
|
|
281
|
+
'text-rendering',
|
|
282
|
+
'white-space',
|
|
283
|
+
'line-height',
|
|
284
|
+
'line-height-range',
|
|
285
|
+
'letter-spacing',
|
|
286
|
+
'background',
|
|
287
|
+
'background-position',
|
|
288
|
+
'background-repeat',
|
|
289
|
+
'background-size',
|
|
290
|
+
'padding',
|
|
291
|
+
'margin',
|
|
292
|
+
'border',
|
|
293
|
+
'border-width',
|
|
294
|
+
'border-color',
|
|
295
|
+
'border-style',
|
|
296
|
+
'border-radius',
|
|
297
|
+
'border-left',
|
|
298
|
+
'border-top',
|
|
299
|
+
'border-right',
|
|
300
|
+
'border-bottom',
|
|
301
|
+
'float',
|
|
302
|
+
'clear',
|
|
303
|
+
'position',
|
|
304
|
+
'overflow',
|
|
305
|
+
'content',
|
|
306
|
+
'display',
|
|
307
|
+
'flex',
|
|
308
|
+
'flex-direction',
|
|
309
|
+
'flex-wrap',
|
|
310
|
+
'flex-flow',
|
|
311
|
+
'order',
|
|
312
|
+
'justify-content',
|
|
313
|
+
'align-items',
|
|
314
|
+
'align-self',
|
|
315
|
+
'align-content',
|
|
316
|
+
'flex-grow',
|
|
317
|
+
'flex-shrink',
|
|
318
|
+
'flex-basis',
|
|
319
|
+
'visibility',
|
|
320
|
+
'box-sizing',
|
|
321
|
+
'box-shadow',
|
|
322
|
+
'left',
|
|
323
|
+
'top',
|
|
324
|
+
'right',
|
|
325
|
+
'bottom',
|
|
326
|
+
'vertical-align',
|
|
327
|
+
'z-index',
|
|
328
|
+
'transform',
|
|
329
|
+
'transition',
|
|
330
|
+
'animation',
|
|
331
|
+
'animation-delay',
|
|
332
|
+
'animation-direction',
|
|
333
|
+
'animation-duration',
|
|
334
|
+
'animation-fill-mode',
|
|
335
|
+
'animation-iteration-count',
|
|
336
|
+
'animation-name',
|
|
337
|
+
'animation-play-state',
|
|
338
|
+
'animation-timing-function',
|
|
339
|
+
'opacity',
|
|
340
|
+
'cursor',
|
|
341
|
+
],
|
|
342
|
+
],
|
|
343
|
+
'plugin/no-unsupported-browser-features': [
|
|
344
|
+
true,
|
|
345
|
+
{
|
|
346
|
+
browsers: [
|
|
347
|
+
'defaults',
|
|
348
|
+
'not op_mini all',
|
|
349
|
+
'not kaios >= 0',
|
|
350
|
+
'not and_uc >= 0',
|
|
351
|
+
'not and_qq >= 0',
|
|
352
|
+
],
|
|
353
|
+
ignore: [
|
|
354
|
+
'css-autofill',
|
|
355
|
+
'css-nesting',
|
|
356
|
+
'css-paged-media',
|
|
357
|
+
'css-variables',
|
|
358
|
+
'prefers-color-scheme',
|
|
359
|
+
],
|
|
360
|
+
},
|
|
361
|
+
],
|
|
362
|
+
'prettier/prettier': true,
|
|
363
|
+
'property-disallowed-list': ['/^margin-/', '/^padding-/'],
|
|
364
|
+
'property-no-unknown': [
|
|
365
|
+
true,
|
|
366
|
+
{
|
|
367
|
+
ignoreProperties: [
|
|
368
|
+
'letter-spacing-range',
|
|
369
|
+
'aspect-ratio',
|
|
370
|
+
'font-range',
|
|
371
|
+
'line-height-range',
|
|
372
|
+
],
|
|
373
|
+
},
|
|
374
|
+
],
|
|
375
|
+
'rule-empty-line-before': [
|
|
376
|
+
'always',
|
|
377
|
+
{
|
|
378
|
+
except: ['first-nested', 'inside-block'],
|
|
379
|
+
ignore: ['after-comment'],
|
|
380
|
+
},
|
|
381
|
+
],
|
|
382
|
+
// block[-part][__element]*[_modifier]*[--modifier]*, $(token) в частях.
|
|
383
|
+
'selector-class-pattern': [
|
|
384
|
+
'^[a-z][a-z0-9]*(-[a-z0-9]+)*(?:__[a-zA-Z0-9$()-]+)*(?:_[a-zA-Z0-9$()-]+)*(?:--[a-zA-Z0-9$()-]+)*$',
|
|
385
|
+
{
|
|
386
|
+
severity: 'warning',
|
|
387
|
+
},
|
|
388
|
+
],
|
|
389
|
+
// kebab-case, плюс #__next — корень Next.js.
|
|
390
|
+
'selector-id-pattern': [
|
|
391
|
+
'^(?:__next|[a-z][a-z0-9]*(?:-[a-z0-9]+)*)$',
|
|
392
|
+
{
|
|
393
|
+
message: (selector) => `Expected id selector "${selector}" to be kebab-case`,
|
|
394
|
+
},
|
|
395
|
+
],
|
|
396
|
+
// Вложенный селектор: & / ^& / && / &_mod&_mod, дальше БЭМ, псевдо, атрибут или комбинатор.
|
|
397
|
+
// splitList — каждая часть списка селекторов отдельно.
|
|
398
|
+
'selector-nested-pattern': [
|
|
399
|
+
nestedSelectorPattern,
|
|
400
|
+
{
|
|
401
|
+
splitList: true,
|
|
402
|
+
},
|
|
403
|
+
],
|
|
404
|
+
// css-tree не парсит postcss-nested ^&. Проверка в itcase/selector-no-invalid.
|
|
405
|
+
'selector-no-invalid': null,
|
|
406
|
+
'selector-type-no-unknown': null,
|
|
407
|
+
'shorthand-property-no-redundant-values': null,
|
|
408
|
+
},
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
export { index as default };
|