@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/lint",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.139",
|
|
4
4
|
"author": "ITCase",
|
|
5
5
|
"description": "Code style linter configuration presets ",
|
|
6
6
|
"engines": {
|
|
@@ -44,55 +44,55 @@
|
|
|
44
44
|
"registry": "https://registry.npmjs.org/"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@babel/eslint-parser": "^8.1.
|
|
48
|
-
"@babel/eslint-plugin": "^8.1.
|
|
47
|
+
"@babel/eslint-parser": "^8.1.5",
|
|
48
|
+
"@babel/eslint-plugin": "^8.1.5",
|
|
49
49
|
"@eslint/compat": "^2.1.1",
|
|
50
50
|
"@eslint/js": "^10.0.1",
|
|
51
|
-
"@eslint/markdown": "^
|
|
51
|
+
"@eslint/markdown": "^9.0.0",
|
|
52
52
|
"@figma/eslint-plugin-figma-plugins": "^1.0.0",
|
|
53
|
-
"@html-eslint/eslint-plugin": "^0.
|
|
54
|
-
"@html-eslint/parser": "^0.
|
|
53
|
+
"@html-eslint/eslint-plugin": "^0.69.0",
|
|
54
|
+
"@html-eslint/parser": "^0.69.0",
|
|
55
55
|
"@ianvs/prettier-plugin-sort-imports": "^4.7.1",
|
|
56
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
57
|
-
"@typescript-eslint/parser": "^8.
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^8.74.0",
|
|
57
|
+
"@typescript-eslint/parser": "^8.74.0",
|
|
58
58
|
"eslint": "9.39.2",
|
|
59
|
-
"eslint-config-prettier": "^10.1.
|
|
59
|
+
"eslint-config-prettier": "^10.1.9",
|
|
60
60
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
61
61
|
"eslint-plugin-html": "^8.2.1",
|
|
62
62
|
"eslint-plugin-import": "^2.32.0",
|
|
63
63
|
"eslint-plugin-json": "^5.0.0",
|
|
64
|
-
"eslint-plugin-mobx": "^0.
|
|
65
|
-
"eslint-plugin-n": "^18.
|
|
64
|
+
"eslint-plugin-mobx": "^1.0.0",
|
|
65
|
+
"eslint-plugin-n": "^18.6.0",
|
|
66
66
|
"eslint-plugin-node": "^11.1.0",
|
|
67
|
-
"eslint-plugin-perfectionist": "^5.
|
|
67
|
+
"eslint-plugin-perfectionist": "^5.14.0",
|
|
68
68
|
"eslint-plugin-prettier": "^5.5.7",
|
|
69
69
|
"eslint-plugin-promise": "^7.3.0",
|
|
70
70
|
"eslint-plugin-react": "^7.37.5",
|
|
71
71
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
72
72
|
"eslint-plugin-react-native": "^5.0.0",
|
|
73
73
|
"eslint-plugin-react-refresh": "^0.5.8",
|
|
74
|
-
"eslint-plugin-storybook": "^
|
|
75
|
-
"globals": "^17.
|
|
76
|
-
"prettier": "^3.10.
|
|
77
|
-
"stylelint": "^18.
|
|
78
|
-
"stylelint-config-standard": "^41.
|
|
74
|
+
"eslint-plugin-storybook": "^11.0.1",
|
|
75
|
+
"globals": "^17.15.0",
|
|
76
|
+
"prettier": "^3.10.2",
|
|
77
|
+
"stylelint": "^18.2.0",
|
|
78
|
+
"stylelint-config-standard": "^41.1.0",
|
|
79
79
|
"stylelint-no-unsupported-browser-features": "^8.1.2",
|
|
80
|
-
"stylelint-order": "^
|
|
80
|
+
"stylelint-order": "^9.0.0",
|
|
81
81
|
"stylelint-prettier": "^5.1.0",
|
|
82
|
-
"typescript-eslint": "^8.
|
|
82
|
+
"typescript-eslint": "^8.74.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@itcase/config": "^1.7.
|
|
85
|
+
"@itcase/config": "^1.7.45",
|
|
86
86
|
"@rollup/plugin-typescript": "^12.3.1",
|
|
87
|
-
"@types/node": "^26.6.
|
|
88
|
-
"@types/react": "^19.3.
|
|
89
|
-
"@typescript-eslint/rule-tester": "^8.
|
|
87
|
+
"@types/node": "^26.6.11",
|
|
88
|
+
"@types/react": "^19.3.3",
|
|
89
|
+
"@typescript-eslint/rule-tester": "^8.74.0",
|
|
90
90
|
"del-cli": "^8.0.1",
|
|
91
91
|
"husky": "^9.1.7",
|
|
92
|
-
"lint-staged": "^17.6.
|
|
92
|
+
"lint-staged": "^17.6.3",
|
|
93
93
|
"react": "^19.3.1",
|
|
94
|
-
"rollup": "4.
|
|
95
|
-
"storybook": "^
|
|
94
|
+
"rollup": "4.69.3",
|
|
95
|
+
"storybook": "^11.0.1",
|
|
96
96
|
"tsx": "^4.23.15",
|
|
97
97
|
"typescript": "^6.0.3"
|
|
98
98
|
}
|
package/dist/stylelint/index2.js
DELETED
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { describe, it } from 'node:test';
|
|
3
|
-
import stylelint from 'stylelint';
|
|
4
|
-
import config from './index3.js';
|
|
5
|
-
import 'stylelint-order';
|
|
6
|
-
|
|
7
|
-
// `prettier/prettier` грузит `prettier.config.js`, а тот импортирует `dist`.
|
|
8
|
-
// В CI сборки ещё нет. Эти тесты проверяют другие правила.
|
|
9
|
-
const testConfig = {
|
|
10
|
-
...config,
|
|
11
|
-
rules: {
|
|
12
|
-
...config.rules,
|
|
13
|
-
'prettier/prettier': null,
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
const nestedFormsCss = `
|
|
17
|
-
.form {
|
|
18
|
-
&__group {
|
|
19
|
-
&_hidden {
|
|
20
|
-
display: none;
|
|
21
|
-
}
|
|
22
|
-
&_type_row&_hidden {
|
|
23
|
-
display: none;
|
|
24
|
-
}
|
|
25
|
-
&_column {
|
|
26
|
-
@each $count in 2, 3 {
|
|
27
|
-
&_$(count) {
|
|
28
|
-
^^&-items {
|
|
29
|
-
display: grid;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
&-wrapper {
|
|
35
|
-
^&-message {
|
|
36
|
-
&_type_error {
|
|
37
|
-
display: block;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.form-field {
|
|
45
|
-
&-code {
|
|
46
|
-
&^&_type_classic {
|
|
47
|
-
^^&__label {
|
|
48
|
-
display: block;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
&^&_size {
|
|
52
|
-
@each $size in m, s {
|
|
53
|
-
&_$(size) {
|
|
54
|
-
gap: var(--form-filed-code-size-$(size)-gap);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
`;
|
|
61
|
-
async function warningsFor(code, rule) {
|
|
62
|
-
const result = await stylelint.lint({
|
|
63
|
-
config: testConfig,
|
|
64
|
-
code,
|
|
65
|
-
codeFilename: 'fixture.css',
|
|
66
|
-
});
|
|
67
|
-
return result.results[0].warnings
|
|
68
|
-
.filter((warning) => warning.rule === rule)
|
|
69
|
-
.map((warning) => warning.text);
|
|
70
|
-
}
|
|
71
|
-
function mentions(warnings, text) {
|
|
72
|
-
return warnings.some((warning) => warning.includes(text));
|
|
73
|
-
}
|
|
74
|
-
describe('stylelint config', () => {
|
|
75
|
-
it('allows form custom properties with _ and $(token)', async () => {
|
|
76
|
-
const warnings = await warningsFor(`
|
|
77
|
-
.block {
|
|
78
|
-
--form-field_type_classic-padding: 0;
|
|
79
|
-
--form-filed-code-size-$(size)-gap: 0;
|
|
80
|
-
}
|
|
81
|
-
`, 'custom-property-pattern');
|
|
82
|
-
assert.equal(warnings.length, 0);
|
|
83
|
-
});
|
|
84
|
-
it('rejects a custom property that starts with a capital letter', async () => {
|
|
85
|
-
const warnings = await warningsFor(`
|
|
86
|
-
.block {
|
|
87
|
-
--Padding: 0;
|
|
88
|
-
}
|
|
89
|
-
`, 'custom-property-pattern');
|
|
90
|
-
assert.equal(mentions(warnings, 'Padding'), true);
|
|
91
|
-
});
|
|
92
|
-
it('allows BEM classes used by forms', async () => {
|
|
93
|
-
const warnings = await warningsFor(`
|
|
94
|
-
.form__group_type_row {
|
|
95
|
-
display: block;
|
|
96
|
-
}
|
|
97
|
-
`, 'selector-class-pattern');
|
|
98
|
-
assert.equal(warnings.length, 0);
|
|
99
|
-
});
|
|
100
|
-
it('rejects a class that starts with a capital letter', async () => {
|
|
101
|
-
const warnings = await warningsFor(`
|
|
102
|
-
.Form {
|
|
103
|
-
display: block;
|
|
104
|
-
}
|
|
105
|
-
`, 'selector-class-pattern');
|
|
106
|
-
assert.equal(mentions(warnings, 'Form'), true);
|
|
107
|
-
});
|
|
108
|
-
it('allows postcss-nested selectors from forms css', async () => {
|
|
109
|
-
const warnings = await warningsFor(nestedFormsCss, 'selector-nested-pattern');
|
|
110
|
-
assert.equal(warnings.length, 0);
|
|
111
|
-
});
|
|
112
|
-
it('rejects a nested selector outside the pattern', async () => {
|
|
113
|
-
const warnings = await warningsFor(`
|
|
114
|
-
.form {
|
|
115
|
-
NOT_A_SELECTOR {
|
|
116
|
-
display: block;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
`, 'selector-nested-pattern');
|
|
120
|
-
assert.equal(mentions(warnings, 'NOT_A_SELECTOR'), true);
|
|
121
|
-
});
|
|
122
|
-
it('does not flag ^& and still flags an invalid pseudo', async () => {
|
|
123
|
-
const code = `
|
|
124
|
-
.form {
|
|
125
|
-
^&-message {
|
|
126
|
-
display: block;
|
|
127
|
-
}
|
|
128
|
-
&:dir(sideways) {
|
|
129
|
-
display: block;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
`;
|
|
133
|
-
const invalid = await warningsFor(code, 'selector-no-invalid');
|
|
134
|
-
const itcaseInvalid = await warningsFor(code, 'itcase/selector-no-invalid');
|
|
135
|
-
assert.equal(mentions(invalid, '^&'), false);
|
|
136
|
-
assert.equal(mentions(itcaseInvalid, '^&'), false);
|
|
137
|
-
assert.equal(mentions(invalid, ':dir(sideways)'), true);
|
|
138
|
-
});
|
|
139
|
-
it('allows a camelCase keyframe and rejects kebab-case', async () => {
|
|
140
|
-
const allowed = await warningsFor(`
|
|
141
|
-
@keyframes fadeIn {
|
|
142
|
-
from { opacity: 0; }
|
|
143
|
-
to { opacity: 1; }
|
|
144
|
-
}
|
|
145
|
-
`, 'keyframes-name-pattern');
|
|
146
|
-
const rejected = await warningsFor(`
|
|
147
|
-
@keyframes fade-in {
|
|
148
|
-
from { opacity: 0; }
|
|
149
|
-
to { opacity: 1; }
|
|
150
|
-
}
|
|
151
|
-
`, 'keyframes-name-pattern');
|
|
152
|
-
assert.equal(allowed.length, 0);
|
|
153
|
-
assert.equal(mentions(rejected, 'camelCase'), true);
|
|
154
|
-
});
|
|
155
|
-
it('allows @each and rejects an unknown at-rule', async () => {
|
|
156
|
-
const allowed = await warningsFor(`
|
|
157
|
-
@each $count in 2, 3 {
|
|
158
|
-
.item { display: block; }
|
|
159
|
-
}
|
|
160
|
-
`, 'at-rule-no-unknown');
|
|
161
|
-
const rejected = await warningsFor(`
|
|
162
|
-
@not-a-rule {
|
|
163
|
-
.item { display: block; }
|
|
164
|
-
}
|
|
165
|
-
`, 'at-rule-no-unknown');
|
|
166
|
-
assert.equal(allowed.length, 0);
|
|
167
|
-
assert.equal(mentions(rejected, 'not-a-rule'), true);
|
|
168
|
-
});
|
|
169
|
-
it('allows @page descriptors and still orders padding before margin', async () => {
|
|
170
|
-
const pageCss = `
|
|
171
|
-
@media print {
|
|
172
|
-
@page {
|
|
173
|
-
width: 210mm;
|
|
174
|
-
height: 297mm;
|
|
175
|
-
size: a4;
|
|
176
|
-
margin: 0;
|
|
177
|
-
padding: 5mm;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
`;
|
|
181
|
-
const orderWarnings = await warningsFor(`
|
|
182
|
-
${pageCss}
|
|
183
|
-
.block {
|
|
184
|
-
margin: 0;
|
|
185
|
-
padding: 0;
|
|
186
|
-
}
|
|
187
|
-
`, 'order/properties-order');
|
|
188
|
-
const browserWarnings = await warningsFor(pageCss, 'plugin/no-unsupported-browser-features');
|
|
189
|
-
assert.equal(orderWarnings.length, 1);
|
|
190
|
-
assert.equal(mentions(orderWarnings, 'padding'), true);
|
|
191
|
-
assert.equal(browserWarnings.length, 0);
|
|
192
|
-
});
|
|
193
|
-
it('allows #__next in a nested print block and rejects a non-kebab id', async () => {
|
|
194
|
-
const result = await stylelint.lint({
|
|
195
|
-
config: testConfig,
|
|
196
|
-
code: `
|
|
197
|
-
.page {
|
|
198
|
-
& > #__next {
|
|
199
|
-
position: relative;
|
|
200
|
-
overflow: hidden;
|
|
201
|
-
display: flex;
|
|
202
|
-
flex-direction: column;
|
|
203
|
-
@media print {
|
|
204
|
-
width: 100%;
|
|
205
|
-
height: auto !important;
|
|
206
|
-
overflow: auto;
|
|
207
|
-
display: block;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
`,
|
|
212
|
-
codeFilename: 'fixture.css',
|
|
213
|
-
});
|
|
214
|
-
const rejected = await warningsFor(`
|
|
215
|
-
#next_root {
|
|
216
|
-
display: block;
|
|
217
|
-
}
|
|
218
|
-
`, 'selector-id-pattern');
|
|
219
|
-
assert.deepEqual(result.results[0].warnings, []);
|
|
220
|
-
assert.equal(mentions(rejected, 'next_root'), true);
|
|
221
|
-
});
|
|
222
|
-
it('allows $() and fluid() and rejects an unknown function', async () => {
|
|
223
|
-
const allowed = await warningsFor(`
|
|
224
|
-
.item {
|
|
225
|
-
width: $(count);
|
|
226
|
-
font-size: fluid(16, 24);
|
|
227
|
-
}
|
|
228
|
-
`, 'function-no-unknown');
|
|
229
|
-
const rejected = await warningsFor(`
|
|
230
|
-
.item {
|
|
231
|
-
width: nope(1);
|
|
232
|
-
}
|
|
233
|
-
`, 'function-no-unknown');
|
|
234
|
-
assert.equal(allowed.length, 0);
|
|
235
|
-
assert.equal(mentions(rejected, 'nope'), true);
|
|
236
|
-
});
|
|
237
|
-
});
|