@itcase/lint 1.1.109 → 1.1.111

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 CHANGED
@@ -1,3 +1,19 @@
1
+ ## [1.1.111](https://github.com/ITCase/itcase-lint/compare/v1.1.110...v1.1.111) (2026-05-13)
2
+
3
+ ### Features
4
+
5
+ * **eslint:** Add yup sort ([e9f0221](https://github.com/ITCase/itcase-lint/commit/e9f022151970a5c58afd1af87960b15c2b22245c))
6
+
7
+ ### Dependencies
8
+
9
+ * **other:** bump the npm-dependencies group across 1 directory with 21 updates ([afdd402](https://github.com/ITCase/itcase-lint/commit/afdd4020aff67ebbda1d0fb3929a1daf88c0482f))
10
+
11
+ ## [1.1.110](https://github.com/ITCase/itcase-lint/compare/v1.1.109...v1.1.110) (2026-04-23)
12
+
13
+ ### Features
14
+
15
+ * **stylelint:** Add css-autofill ([83078c3](https://github.com/ITCase/itcase-lint/commit/83078c30c98ea0955c0d30f30d4a9a55efc14d14))
16
+
1
17
  ## [1.1.109](https://github.com/ITCase/itcase-lint/compare/v1.1.108...v1.1.109) (2026-04-20)
2
18
 
3
19
  ### Features
package/README.md CHANGED
@@ -87,6 +87,7 @@ export default [...eslint, ...eslintMobx, ...eslintReactNative]
87
87
  | Плагин | Описание | Подключение |
88
88
  |--------|----------|-------------|
89
89
  | **itcase-lint/react-data-test-id** | Требует атрибут `data-test-id` / `dataTestId` у указанных компонентов | Входит в базовый `@itcase/lint/eslint`, правило включается вручную для нужных путей |
90
+ | **itcase-lint/yup-validation-sort** | Порядок методов yup и формат `.required({ key, message })` на цепочках от `yup` | Входит в базовый `@itcase/lint/eslint` (`error`) |
90
91
  | **itcase-lint/storybook-meta-parameters-design** | Требует в Storybook-сториз ссылку на Figma в `parameters.design` | `import eslintStorybook from '@itcase/lint/eslint/storybook'` и `...eslintStorybook` в конфиге |
91
92
 
92
93
  Ниже — подробное описание и примеры для каждого плагина.
@@ -190,6 +191,44 @@ export default {
190
191
  }
191
192
  ```
192
193
 
194
+ ### Yup: `itcase-lint/yup-validation-sort` и `yupMethodOrderViolation`
195
+
196
+ В базовом `@itcase/lint/eslint` включено правило **`itcase-lint/yup-validation-sort`** (уровень `error`) для цепочек, начинающихся с импорта **`yup`** (например `yup.string()…`).
197
+
198
+ Сообщения ESLint:
199
+
200
+ | `messageId` | Смысл |
201
+ |-------------|--------|
202
+ | **`yupMethodOrderViolation`** | Если на одной цепочке встречаются вызовы **`.label()`**, **`.required()`**, **`.matches()`**, **`.min()`**, **`.max()`**, их относительный порядок должен быть: **`label` → `required` → `matches` → `min` → `max`**. Между ними допустимы другие методы (например **`.test()`**), если они не нарушают этот порядок для перечисленных пяти. |
203
+ | `requiredMustUseKeyMessageObject` | **`.required()`** вызывается одним аргументом — объектом с полями **`key`** и **`message`** (например `.required({ key: 'required', message: FIELDS_MESSAGES.field.required })`). |
204
+
205
+ Пример допустимой цепочки:
206
+
207
+ ```ts
208
+ import * as yup from 'yup'
209
+
210
+ const schema = yup
211
+ .string()
212
+ .label('email')
213
+ .required({ key: 'required', message: MESSAGES.email.required })
214
+ .matches(/@/, { message: MESSAGES.email.invalid })
215
+ .min(5, MESSAGES.email.min)
216
+ .max(255, MESSAGES.email.max)
217
+ ```
218
+
219
+ Неверный порядок (например `.required()` до `.label()`) приведёт к срабатыванию **`yupMethodOrderViolation`**.
220
+
221
+ Чтобы отключить или ослабить правило, переопределите его в своём `eslint.config.mjs`:
222
+
223
+ ```js
224
+ {
225
+ files: ['**/*.{ts,tsx,js,jsx}'],
226
+ rules: {
227
+ 'itcase-lint/yup-validation-sort': 'off', // или 'warn'
228
+ },
229
+ }
230
+ ```
231
+
193
232
  ### Stylelint
194
233
 
195
234
  Create a `eslint.config.mjs` configuration file in the root of your project with the following content:
@@ -12,6 +12,9 @@ declare const itcaseLintPlugin: {
12
12
  "storybook-meta-parameters-design": TSESLint.RuleModule<"missingOrEmptyUrl" | "typeMustBeFigma" | "urlMustContainFigma", [], unknown, TSESLint.RuleListener> & {
13
13
  name: string;
14
14
  };
15
+ "yup-validation-sort": TSESLint.RuleModule<"requiredMustUseKeyMessageObject" | "yupMethodOrderViolation", [], unknown, TSESLint.RuleListener> & {
16
+ name: string;
17
+ };
15
18
  };
16
19
  };
17
20
  export { itcaseLintPlugin };
@@ -21,6 +21,9 @@ declare const pluginWithConfigs: {
21
21
  "storybook-meta-parameters-design": TSESLint.RuleModule<"missingOrEmptyUrl" | "typeMustBeFigma" | "urlMustContainFigma", [], unknown, TSESLint.RuleListener> & {
22
22
  name: string;
23
23
  };
24
+ "yup-validation-sort": TSESLint.RuleModule<"requiredMustUseKeyMessageObject" | "yupMethodOrderViolation", [], unknown, TSESLint.RuleListener> & {
25
+ name: string;
26
+ };
24
27
  };
25
28
  };
26
29
  };
@@ -41,6 +44,9 @@ declare const pluginWithConfigs: {
41
44
  "storybook-meta-parameters-design": TSESLint.RuleModule<"missingOrEmptyUrl" | "typeMustBeFigma" | "urlMustContainFigma", [], unknown, TSESLint.RuleListener> & {
42
45
  name: string;
43
46
  };
47
+ "yup-validation-sort": TSESLint.RuleModule<"requiredMustUseKeyMessageObject" | "yupMethodOrderViolation", [], unknown, TSESLint.RuleListener> & {
48
+ name: string;
49
+ };
44
50
  };
45
51
  };
46
52
  export default pluginWithConfigs;
@@ -14,6 +14,9 @@ declare const _default: {
14
14
  "storybook-meta-parameters-design": import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingOrEmptyUrl" | "typeMustBeFigma" | "urlMustContainFigma", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
15
15
  name: string;
16
16
  };
17
+ "yup-validation-sort": import("@typescript-eslint/utils/ts-eslint").RuleModule<"requiredMustUseKeyMessageObject" | "yupMethodOrderViolation", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
18
+ name: string;
19
+ };
17
20
  };
18
21
  };
19
22
  storybook: {
@@ -1,3 +1,3 @@
1
1
  import 'eslint-plugin-storybook';
2
- export { s as default } from '../index_BUaP0Zu6.js';
2
+ export { s as default } from '../index_Bb7Jg_Ul.js';
3
3
  import '@typescript-eslint/utils';
@@ -0,0 +1,10 @@
1
+ declare const MESSAGE_IDS: {
2
+ readonly requiredMustUseKeyMessageObject: "requiredMustUseKeyMessageObject";
3
+ readonly yupMethodOrderViolation: "yupMethodOrderViolation";
4
+ };
5
+ type MessageIds = keyof typeof MESSAGE_IDS;
6
+ declare const MESSAGES: {
7
+ requiredMustUseKeyMessageObject: string;
8
+ yupMethodOrderViolation: string;
9
+ };
10
+ export { MESSAGE_IDS, type MessageIds, MESSAGES };
@@ -0,0 +1,8 @@
1
+ import type { Context, Options, RuleVisitorsType } from './interface';
2
+ declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<import("@typescript-eslint/utils/eslint-utils").RuleWithMetaAndName<Options, MessageIds, unknown>>) => import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, Options, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
3
+ name: string;
4
+ };
5
+ declare const ruleName = "yup-validation-sort";
6
+ declare const pluginName = "itcase-lint";
7
+ declare const defaultOptions: Options;
8
+ export { type Context, createRule, defaultOptions, type Options, pluginName, ruleName, type RuleVisitorsType as RuleVisitors, };
@@ -0,0 +1,6 @@
1
+ import type { RuleContext, RuleVisitors } from '../../utils/types';
2
+ import { type MessageIds } from './constants';
3
+ type Options = [];
4
+ type Context = RuleContext<MessageIds, Options>;
5
+ type RuleVisitorsType = RuleVisitors<MessageIds, Options>;
6
+ export type { Context, Options, RuleVisitorsType };
@@ -0,0 +1,52 @@
1
+ import parser from '@typescript-eslint/parser';
2
+ import { TSESLint } from '@typescript-eslint/utils';
3
+ declare const pluginWithConfigs: {
4
+ configs: {
5
+ recommended: {
6
+ languageOptions: {
7
+ ecmaVersion: "latest";
8
+ parser: typeof parser;
9
+ };
10
+ plugins: {
11
+ "itcase-lint": {
12
+ meta: {
13
+ name: string;
14
+ version: string;
15
+ };
16
+ processors: {};
17
+ rules: {
18
+ "react-data-test-id": TSESLint.RuleModule<"missingAttribute" | "missingAttributeValue", import("../../react/dataTestIdPlugin/interface").Options, unknown, TSESLint.RuleListener> & {
19
+ name: string;
20
+ };
21
+ "storybook-meta-parameters-design": TSESLint.RuleModule<"missingOrEmptyUrl" | "typeMustBeFigma" | "urlMustContainFigma", [], unknown, TSESLint.RuleListener> & {
22
+ name: string;
23
+ };
24
+ "yup-validation-sort": TSESLint.RuleModule<"requiredMustUseKeyMessageObject" | "yupMethodOrderViolation", [], unknown, TSESLint.RuleListener> & {
25
+ name: string;
26
+ };
27
+ };
28
+ };
29
+ };
30
+ rules: {
31
+ "itcase-lint/yup-validation-sort": "error";
32
+ };
33
+ };
34
+ };
35
+ meta: {
36
+ name: string;
37
+ version: string;
38
+ };
39
+ processors: {};
40
+ rules: {
41
+ "react-data-test-id": TSESLint.RuleModule<"missingAttribute" | "missingAttributeValue", import("../../react/dataTestIdPlugin/interface").Options, unknown, TSESLint.RuleListener> & {
42
+ name: string;
43
+ };
44
+ "storybook-meta-parameters-design": TSESLint.RuleModule<"missingOrEmptyUrl" | "typeMustBeFigma" | "urlMustContainFigma", [], unknown, TSESLint.RuleListener> & {
45
+ name: string;
46
+ };
47
+ "yup-validation-sort": TSESLint.RuleModule<"requiredMustUseKeyMessageObject" | "yupMethodOrderViolation", [], unknown, TSESLint.RuleListener> & {
48
+ name: string;
49
+ };
50
+ };
51
+ };
52
+ export default pluginWithConfigs;
@@ -0,0 +1,5 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+ declare const rule: ESLintUtils.RuleModule<"requiredMustUseKeyMessageObject" | "yupMethodOrderViolation", [], unknown, ESLintUtils.RuleListener> & {
3
+ name: string;
4
+ };
5
+ export { rule };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { type RuleVisitors } from './extra';
2
+ declare const ruleVisitors: RuleVisitors;
3
+ export { ruleVisitors };
package/dist/eslint.js CHANGED
@@ -13,14 +13,14 @@ import globals from 'globals';
13
13
  import eslintTypeScript from 'typescript-eslint';
14
14
  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_B60tZBM_.js';
15
15
  import parser from '@typescript-eslint/parser';
16
- import { i as itcaseLintPlugin, p as pluginName, r as ruleName, s as storybookConfig } from './index_BUaP0Zu6.js';
16
+ import { i as itcaseLintPlugin, p as pluginName, r as ruleName, a as pluginName$1, b as ruleName$1, s as storybookConfig } from './index_Bb7Jg_Ul.js';
17
17
  import { noRestrictedSyntaxRestrictWords } from './eslint/restrictWords.js';
18
18
  export { default as eslintFigma } from './eslint/figma.js';
19
19
  import 'eslint-plugin-storybook';
20
20
  import '@typescript-eslint/utils';
21
21
  import '@figma/eslint-plugin-figma-plugins';
22
22
 
23
- const pluginWithConfigs = {
23
+ const pluginWithConfigs$1 = {
24
24
  ...itcaseLintPlugin,
25
25
  configs: {
26
26
  recommended: {
@@ -39,6 +39,20 @@ const pluginWithConfigs = {
39
39
  },
40
40
  };
41
41
 
42
+ const pluginWithConfigs = {
43
+ ...itcaseLintPlugin,
44
+ configs: {
45
+ recommended: {
46
+ plugins: {
47
+ [pluginName$1]: itcaseLintPlugin,
48
+ },
49
+ rules: {
50
+ [`${pluginName$1}/${ruleName$1}`]: 'error',
51
+ },
52
+ },
53
+ },
54
+ };
55
+
42
56
  /* eslint-disable perfectionist/sort-objects */
43
57
  const eslintConfig = [
44
58
  eslintJs.configs.recommended,
@@ -46,7 +60,7 @@ const eslintConfig = [
46
60
  eslintPluginPrettierRecommended,
47
61
  {
48
62
  languageOptions: {
49
- ...pluginWithConfigs.configs.recommended.languageOptions,
63
+ ...pluginWithConfigs$1.configs.recommended.languageOptions,
50
64
  globals: {
51
65
  ...globals.browser,
52
66
  ...globals.node,
@@ -55,6 +69,7 @@ const eslintConfig = [
55
69
  },
56
70
  {
57
71
  plugins: {
72
+ ...pluginWithConfigs$1.configs.recommended.plugins,
58
73
  ...pluginWithConfigs.configs.recommended.plugins,
59
74
  react: eslintReact,
60
75
  // "eslint-plugin-react-hooks" already supports flat config, but "fixupPluginRules"
@@ -94,6 +109,7 @@ const eslintConfig = [
94
109
  rules: {
95
110
  // "react-hooks" config recommended rules
96
111
  ...eslintReactHooks.configs.recommended.rules,
112
+ ...pluginWithConfigs$1.configs.recommended.rules,
97
113
  ...pluginWithConfigs.configs.recommended.rules,
98
114
  'react/jsx-fragments': ['error', 'element'],
99
115
  // @typescript-eslint
@@ -6,11 +6,11 @@ function createRuleCreator(pluginPath) {
6
6
  return ESLintUtils.RuleCreator((name) => pluginPath ? `${DOC_BASE}/${pluginPath}#${name}` : '');
7
7
  }
8
8
 
9
- const createRule$1 = createRuleCreator('react/dataTestIdPlugin');
10
- const ruleName$1 = 'react-data-test-id';
9
+ const createRule$2 = createRuleCreator('react/dataTestIdPlugin');
10
+ const ruleName$2 = 'react-data-test-id';
11
11
  // Use a shared namespace for our custom rules.
12
- const pluginName$1 = 'itcase-lint';
13
- const defaultOptions$1 = [
12
+ const pluginName$2 = 'itcase-lint';
13
+ const defaultOptions$2 = [
14
14
  {
15
15
  appendElementNamesToCheck: null,
16
16
  overrideElementNamesToCheck: null,
@@ -18,13 +18,13 @@ const defaultOptions$1 = [
18
18
  },
19
19
  ];
20
20
 
21
- const MESSAGE_IDS$1 = {
21
+ const MESSAGE_IDS$2 = {
22
22
  missingAttribute: 'missingAttribute',
23
23
  missingAttributeValue: 'missingAttributeValue',
24
24
  };
25
- const MESSAGES$1 = {
26
- [MESSAGE_IDS$1.missingAttribute]: 'JSX element is missing the required "{{propName}}" attribute.',
27
- [MESSAGE_IDS$1.missingAttributeValue]: 'JSX element has a "{{propName}}" attribute with a missing value.',
25
+ const MESSAGES$2 = {
26
+ [MESSAGE_IDS$2.missingAttribute]: 'JSX element is missing the required "{{propName}}" attribute.',
27
+ [MESSAGE_IDS$2.missingAttributeValue]: 'JSX element has a "{{propName}}" attribute with a missing value.',
28
28
  };
29
29
  const ASSERT_DEFAULT_MESSAGE = 'Assert violation';
30
30
  /**
@@ -141,7 +141,7 @@ const handleReturnStatement = (context, returnStatementNode, options) => {
141
141
  if (!propNodeWeLookingFor) {
142
142
  // If we reach here - the prop is missing - report it
143
143
  context.report({
144
- messageId: MESSAGE_IDS$1.missingAttribute,
144
+ messageId: MESSAGE_IDS$2.missingAttribute,
145
145
  fix: (fixer) => {
146
146
  const propName = propNameWeLookingFor.name;
147
147
  const parentName = parentComponentNameItem.name;
@@ -165,7 +165,7 @@ const handleReturnStatement = (context, returnStatementNode, options) => {
165
165
  assert(!propNodeWeLookingFor.value);
166
166
  // If we reach here - the prop exists but has no value - report it
167
167
  context.report({
168
- messageId: MESSAGE_IDS$1.missingAttributeValue,
168
+ messageId: MESSAGE_IDS$2.missingAttributeValue,
169
169
  fix: (fixer) => {
170
170
  const propName = propNameWeLookingFor.name;
171
171
  const parentName = parentComponentNameItem.name;
@@ -184,7 +184,7 @@ const handleReturnStatement = (context, returnStatementNode, options) => {
184
184
  node: openingElement,
185
185
  });
186
186
  };
187
- const ruleVisitors$1 = (context, optionsWithDefault) => {
187
+ const ruleVisitors$2 = (context, optionsWithDefault) => {
188
188
  const [options] = optionsWithDefault;
189
189
  const { appendElementNamesToCheck, overrideElementNamesToCheck, overrideElementNamesToIgnore, } = options;
190
190
  let elementNamesToCheck = ELEMENT_NAMES_TO_CHECK.slice();
@@ -219,15 +219,15 @@ const ruleVisitors$1 = (context, optionsWithDefault) => {
219
219
  return;
220
220
  }
221
221
  // Log other errors
222
- console.log(`${pluginName$1} visitor error:`, error);
222
+ console.log(`${pluginName$2} visitor error:`, error);
223
223
  }
224
224
  },
225
225
  };
226
226
  };
227
227
 
228
- const ruleMeta$1 = {
228
+ const ruleMeta$2 = {
229
229
  type: 'suggestion',
230
- messages: MESSAGES$1,
230
+ messages: MESSAGES$2,
231
231
  docs: {
232
232
  description: '',
233
233
  },
@@ -242,47 +242,47 @@ const ruleMeta$1 = {
242
242
  { type: 'array', items: { type: 'string' } },
243
243
  { type: 'null' },
244
244
  ],
245
- default: defaultOptions$1[0].appendElementNamesToCheck,
245
+ default: defaultOptions$2[0].appendElementNamesToCheck,
246
246
  },
247
247
  overrideElementNamesToCheck: {
248
248
  anyOf: [
249
249
  { type: 'array', items: { type: 'string' } },
250
250
  { type: 'null' },
251
251
  ],
252
- default: defaultOptions$1[0].overrideElementNamesToCheck,
252
+ default: defaultOptions$2[0].overrideElementNamesToCheck,
253
253
  },
254
254
  overrideElementNamesToIgnore: {
255
255
  anyOf: [
256
256
  { type: 'array', items: { type: 'string' } },
257
257
  { type: 'null' },
258
258
  ],
259
- default: defaultOptions$1[0].overrideElementNamesToIgnore,
259
+ default: defaultOptions$2[0].overrideElementNamesToIgnore,
260
260
  },
261
261
  },
262
262
  },
263
263
  ],
264
264
  };
265
- const rule$1 = createRule$1({
266
- name: ruleName$1,
267
- create: ruleVisitors$1,
268
- defaultOptions: defaultOptions$1,
269
- meta: ruleMeta$1,
265
+ const rule$2 = createRule$2({
266
+ name: ruleName$2,
267
+ create: ruleVisitors$2,
268
+ defaultOptions: defaultOptions$2,
269
+ meta: ruleMeta$2,
270
270
  });
271
271
 
272
- const createRule = createRuleCreator('storybook/metaParametersDesign');
273
- const ruleName = 'storybook-meta-parameters-design';
274
- const pluginName = 'itcase-lint';
275
- const defaultOptions = [];
272
+ const createRule$1 = createRuleCreator('storybook/metaParametersDesign');
273
+ const ruleName$1 = 'storybook-meta-parameters-design';
274
+ const pluginName$1 = 'itcase-lint';
275
+ const defaultOptions$1 = [];
276
276
 
277
- const MESSAGE_IDS = {
277
+ const MESSAGE_IDS$1 = {
278
278
  missingOrEmptyUrl: 'missingOrEmptyUrl',
279
279
  typeMustBeFigma: 'typeMustBeFigma',
280
280
  urlMustContainFigma: 'urlMustContainFigma',
281
281
  };
282
- const MESSAGES = {
283
- [MESSAGE_IDS.missingOrEmptyUrl]: 'parameters.design.url is required and must not be empty.',
284
- [MESSAGE_IDS.typeMustBeFigma]: 'parameters.design.type must be "figma".',
285
- [MESSAGE_IDS.urlMustContainFigma]: 'parameters.design.url must contain a link to figma.com.',
282
+ const MESSAGES$1 = {
283
+ [MESSAGE_IDS$1.missingOrEmptyUrl]: 'parameters.design.url is required and must not be empty.',
284
+ [MESSAGE_IDS$1.typeMustBeFigma]: 'parameters.design.type must be "figma".',
285
+ [MESSAGE_IDS$1.urlMustContainFigma]: 'parameters.design.url must contain a link to figma.com.',
286
286
  };
287
287
 
288
288
  function getPropertyName(key) {
@@ -331,7 +331,7 @@ function resolveMetaObject(declaration, sourceCode) {
331
331
  }
332
332
 
333
333
  const FIGMA_DOMAIN = 'figma.com';
334
- const ruleVisitors = (context, optionsWithDefault) => {
334
+ const ruleVisitors$1 = (context, optionsWithDefault) => {
335
335
  const sourceCode = context.sourceCode.ast;
336
336
  return {
337
337
  ExportDefaultDeclaration(node) {
@@ -347,7 +347,7 @@ const ruleVisitors = (context, optionsWithDefault) => {
347
347
  const designProp = findProperty(parametersValue, 'design');
348
348
  if (!designProp) {
349
349
  context.report({
350
- messageId: MESSAGE_IDS.missingOrEmptyUrl,
350
+ messageId: MESSAGE_IDS$1.missingOrEmptyUrl,
351
351
  node: parametersProp,
352
352
  });
353
353
  return;
@@ -355,7 +355,7 @@ const ruleVisitors = (context, optionsWithDefault) => {
355
355
  const designValue = designProp.value;
356
356
  if (designValue.type !== AST_NODE_TYPES.ObjectExpression) {
357
357
  context.report({
358
- messageId: MESSAGE_IDS.missingOrEmptyUrl,
358
+ messageId: MESSAGE_IDS$1.missingOrEmptyUrl,
359
359
  node: designProp,
360
360
  });
361
361
  return;
@@ -366,7 +366,7 @@ const ruleVisitors = (context, optionsWithDefault) => {
366
366
  : undefined;
367
367
  if (typeStr !== 'figma') {
368
368
  context.report({
369
- messageId: MESSAGE_IDS.typeMustBeFigma,
369
+ messageId: MESSAGE_IDS$1.typeMustBeFigma,
370
370
  node: designProp,
371
371
  });
372
372
  return;
@@ -375,14 +375,14 @@ const ruleVisitors = (context, optionsWithDefault) => {
375
375
  const urlStr = urlProp ? getStringLiteralValue(urlProp.value) : undefined;
376
376
  if (urlStr === undefined || urlStr.trim() === '') {
377
377
  context.report({
378
- messageId: MESSAGE_IDS.missingOrEmptyUrl,
378
+ messageId: MESSAGE_IDS$1.missingOrEmptyUrl,
379
379
  node: designProp,
380
380
  });
381
381
  return;
382
382
  }
383
383
  if (!urlStr.includes(FIGMA_DOMAIN)) {
384
384
  context.report({
385
- messageId: MESSAGE_IDS.urlMustContainFigma,
385
+ messageId: MESSAGE_IDS$1.urlMustContainFigma,
386
386
  node: urlProp ?? designProp,
387
387
  });
388
388
  }
@@ -390,11 +390,180 @@ const ruleVisitors = (context, optionsWithDefault) => {
390
390
  };
391
391
  };
392
392
 
393
+ const ruleMeta$1 = {
394
+ type: 'suggestion',
395
+ messages: MESSAGES$1,
396
+ docs: {
397
+ description: 'Require parameters.design.url to be non-empty and contain a figma.com link.',
398
+ },
399
+ schema: [],
400
+ };
401
+ const rule$1 = createRule$1({
402
+ name: ruleName$1,
403
+ create: ruleVisitors$1,
404
+ defaultOptions: defaultOptions$1,
405
+ meta: ruleMeta$1,
406
+ });
407
+
408
+ const createRule = createRuleCreator('yup/validationSort');
409
+ const ruleName = 'yup-validation-sort';
410
+ const pluginName = 'itcase-lint';
411
+ const defaultOptions = [];
412
+
413
+ const MESSAGE_IDS = {
414
+ requiredMustUseKeyMessageObject: 'requiredMustUseKeyMessageObject',
415
+ yupMethodOrderViolation: 'yupMethodOrderViolation',
416
+ };
417
+ const YUP_ORDERED_METHODS = 'label → required → matches → min → max';
418
+ const MESSAGES = {
419
+ [MESSAGE_IDS.requiredMustUseKeyMessageObject]: "On yup chains rooted at `yup`, call .required() with exactly one object argument that includes both `key` and `message` (e.g. .required({ key: 'required', message: FIELDS_MESSAGES.field.required })).",
420
+ [MESSAGE_IDS.yupMethodOrderViolation]: `When any of .label(), .required(), .matches(), .min(), .max() appear on a yup chain, use this order: ${YUP_ORDERED_METHODS}. Other calls (e.g. .test()) may appear between them without breaking this relative order.`,
421
+ };
422
+
423
+ const ORDERED_YUP_METHOD_NAMES = [
424
+ 'label',
425
+ 'required',
426
+ 'matches',
427
+ 'min',
428
+ 'max',
429
+ ];
430
+ const METHOD_ORDER_RANK = new Map(ORDERED_YUP_METHOD_NAMES.map((name, index) => [name, index]));
431
+ const isYupRoot = (node) => node.type === AST_NODE_TYPES.Identifier && node.name === 'yup';
432
+ const getOutermostChainedCallExpression = (node) => {
433
+ let current = node;
434
+ while (true) {
435
+ const parent = current.parent;
436
+ if (parent?.type !== AST_NODE_TYPES.MemberExpression ||
437
+ parent.object !== current) {
438
+ break;
439
+ }
440
+ const outer = parent.parent;
441
+ if (outer?.type !== AST_NODE_TYPES.CallExpression ||
442
+ outer.callee !== parent) {
443
+ break;
444
+ }
445
+ current = outer;
446
+ }
447
+ return current;
448
+ };
449
+ const collectChainedMethodNames = (outerCall) => {
450
+ const methodNames = [];
451
+ let current = outerCall;
452
+ while (current.type === AST_NODE_TYPES.CallExpression) {
453
+ const callExpr = current;
454
+ const callee = callExpr.callee;
455
+ if (callee.type !== AST_NODE_TYPES.MemberExpression || callee.computed) {
456
+ return null;
457
+ }
458
+ if (callee.property.type !== AST_NODE_TYPES.Identifier) {
459
+ return null;
460
+ }
461
+ methodNames.unshift(callee.property.name);
462
+ current = callee.object;
463
+ }
464
+ const root = current;
465
+ return { methodNames, root };
466
+ };
467
+ const isYupSchemaRequiredCall = (node) => {
468
+ const callee = node.callee;
469
+ if (callee.type !== AST_NODE_TYPES.MemberExpression || callee.computed) {
470
+ return false;
471
+ }
472
+ if (callee.property.type !== AST_NODE_TYPES.Identifier ||
473
+ callee.property.name !== 'required') {
474
+ return false;
475
+ }
476
+ let cur = callee.object;
477
+ while (cur.type === AST_NODE_TYPES.CallExpression) {
478
+ const callExpr = cur;
479
+ const cal = callExpr.callee;
480
+ if (cal.type !== AST_NODE_TYPES.MemberExpression || cal.computed) {
481
+ return false;
482
+ }
483
+ if (isYupRoot(cal.object)) {
484
+ return true;
485
+ }
486
+ cur = cal.object;
487
+ }
488
+ return false;
489
+ };
490
+ const requiredCallUsesKeyMessageObject = (node) => {
491
+ const arg0 = node.arguments[0];
492
+ if (node.arguments.length !== 1 ||
493
+ !arg0 ||
494
+ arg0.type !== AST_NODE_TYPES.ObjectExpression) {
495
+ return false;
496
+ }
497
+ let hasKey = false;
498
+ let hasMessage = false;
499
+ for (const prop of arg0.properties) {
500
+ if (prop.type !== AST_NODE_TYPES.Property || prop.computed) {
501
+ continue;
502
+ }
503
+ let key = null;
504
+ if (prop.key.type === AST_NODE_TYPES.Identifier) {
505
+ key = prop.key.name;
506
+ }
507
+ else if (prop.key.type === AST_NODE_TYPES.Literal &&
508
+ typeof prop.key.value === 'string') {
509
+ key = prop.key.value;
510
+ }
511
+ if (key === 'key') {
512
+ hasKey = true;
513
+ }
514
+ if (key === 'message') {
515
+ hasMessage = true;
516
+ }
517
+ }
518
+ return hasKey && hasMessage;
519
+ };
520
+ const methodOrderRespected = (methodNames) => {
521
+ let previousRank = -1;
522
+ for (const name of methodNames) {
523
+ const rank = METHOD_ORDER_RANK.get(name);
524
+ if (rank === undefined) {
525
+ continue;
526
+ }
527
+ if (rank < previousRank) {
528
+ return false;
529
+ }
530
+ previousRank = rank;
531
+ }
532
+ return true;
533
+ };
534
+ const ruleVisitors = (context) => {
535
+ return {
536
+ CallExpression(node) {
537
+ if (isYupSchemaRequiredCall(node) &&
538
+ !requiredCallUsesKeyMessageObject(node)) {
539
+ context.report({
540
+ messageId: MESSAGE_IDS.requiredMustUseKeyMessageObject,
541
+ node: node,
542
+ });
543
+ }
544
+ const outer = getOutermostChainedCallExpression(node);
545
+ if (outer !== node) {
546
+ return;
547
+ }
548
+ const parsed = collectChainedMethodNames(outer);
549
+ if (!parsed || !isYupRoot(parsed.root)) {
550
+ return;
551
+ }
552
+ if (!methodOrderRespected(parsed.methodNames)) {
553
+ context.report({
554
+ messageId: MESSAGE_IDS.yupMethodOrderViolation,
555
+ node: outer,
556
+ });
557
+ }
558
+ },
559
+ };
560
+ };
561
+
393
562
  const ruleMeta = {
394
563
  type: 'suggestion',
395
564
  messages: MESSAGES,
396
565
  docs: {
397
- description: 'Require parameters.design.url to be non-empty and contain a figma.com link.',
566
+ description: 'Enforce yup .required({ key, message }) and method order label → required → matches → min → max when those calls appear.',
398
567
  },
399
568
  schema: [],
400
569
  };
@@ -407,11 +576,12 @@ const rule = createRule({
407
576
 
408
577
  const itcaseLintPlugin = {
409
578
  meta: {
410
- name: pluginName$1,
579
+ name: pluginName$2,
411
580
  version: '1.0.0',
412
581
  },
413
582
  processors: {},
414
583
  rules: {
584
+ [ruleName$2]: rule$2,
415
585
  [ruleName$1]: rule$1,
416
586
  [ruleName]: rule,
417
587
  },
@@ -422,13 +592,13 @@ var storybookConfig = [
422
592
  {
423
593
  files: ['**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)'],
424
594
  plugins: {
425
- [pluginName]: itcaseLintPlugin,
595
+ [pluginName$1]: itcaseLintPlugin,
426
596
  storybook: eslintStorybook,
427
597
  },
428
598
  rules: {
429
- [`${pluginName}/${ruleName}`]: 'warn',
599
+ [`${pluginName$1}/${ruleName$1}`]: 'warn',
430
600
  },
431
601
  },
432
602
  ];
433
603
 
434
- export { itcaseLintPlugin as i, pluginName$1 as p, ruleName$1 as r, storybookConfig as s };
604
+ export { pluginName as a, ruleName as b, itcaseLintPlugin as i, pluginName$2 as p, ruleName$2 as r, storybookConfig as s };
package/dist/stylelint.js CHANGED
@@ -221,7 +221,12 @@ var index = {
221
221
  'not and_uc >= 0',
222
222
  'not and_qq >= 0',
223
223
  ],
224
- ignore: ['css-variables', 'css-nesting', 'prefers-color-scheme'],
224
+ ignore: [
225
+ 'css-variables',
226
+ 'css-nesting',
227
+ 'prefers-color-scheme',
228
+ 'css-autofill',
229
+ ],
225
230
  },
226
231
  ],
227
232
  'prettier/prettier': true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/lint",
3
- "version": "1.1.109",
3
+ "version": "1.1.111",
4
4
  "author": "ITCase",
5
5
  "description": "Code style linter configuration presets",
6
6
  "engines": {
@@ -47,15 +47,15 @@
47
47
  "dependencies": {
48
48
  "@babel/eslint-parser": "^7.28.6",
49
49
  "@babel/eslint-plugin": "^7.27.1",
50
- "@eslint/compat": "^2.0.5",
50
+ "@eslint/compat": "^2.1.0",
51
51
  "@figma/eslint-plugin-figma-plugins": "^1.0.0",
52
52
  "@eslint/js": "^10.0.1",
53
53
  "@eslint/markdown": "^8.0.1",
54
- "@html-eslint/eslint-plugin": "^0.59.0",
55
- "@html-eslint/parser": "^0.59.0",
54
+ "@html-eslint/eslint-plugin": "^0.60.0",
55
+ "@html-eslint/parser": "^0.60.0",
56
56
  "@ianvs/prettier-plugin-sort-imports": "^4.7.1",
57
- "@typescript-eslint/eslint-plugin": "^8.58.2",
58
- "@typescript-eslint/parser": "^8.58.2",
57
+ "@typescript-eslint/eslint-plugin": "^8.59.3",
58
+ "@typescript-eslint/parser": "^8.59.3",
59
59
  "eslint": "9.39.2",
60
60
  "eslint-config-prettier": "^10.1.8",
61
61
  "eslint-import-resolver-alias": "^1.1.2",
@@ -63,30 +63,30 @@
63
63
  "eslint-plugin-import": "^2.32.0",
64
64
  "eslint-plugin-json": "^4.0.1",
65
65
  "eslint-plugin-mobx": "^0.0.14",
66
- "eslint-plugin-n": "^17.24.0",
66
+ "eslint-plugin-n": "^18.0.1",
67
67
  "eslint-plugin-node": "^11.1.0",
68
- "eslint-plugin-perfectionist": "^5.8.0",
68
+ "eslint-plugin-perfectionist": "^5.9.0",
69
69
  "eslint-plugin-prettier": "^5.5.5",
70
- "eslint-plugin-promise": "^7.2.1",
70
+ "eslint-plugin-promise": "^7.3.0",
71
71
  "eslint-plugin-react": "^7.37.5",
72
- "eslint-plugin-react-hooks": "^7.0.1",
72
+ "eslint-plugin-react-hooks": "^7.1.1",
73
73
  "eslint-plugin-react-native": "^5.0.0",
74
74
  "eslint-plugin-react-refresh": "^0.5.2",
75
- "eslint-plugin-storybook": "^10.3.5",
76
- "expo-modules-autolinking": "^55.0.17",
77
- "globals": "^17.5.0",
78
- "prettier": "^3.8.2",
79
- "stylelint": "^17.7.0",
75
+ "eslint-plugin-storybook": "^10.3.6",
76
+ "expo-modules-autolinking": "^55.0.21",
77
+ "globals": "^17.6.0",
78
+ "prettier": "^3.8.3",
79
+ "stylelint": "^17.11.0",
80
80
  "stylelint-config-standard": "^40.0.0",
81
81
  "stylelint-no-unsupported-browser-features": "^8.1.1",
82
82
  "stylelint-order": "^8.1.1",
83
83
  "stylelint-prettier": "^5.0.3",
84
- "typescript-eslint": "^8.58.2"
84
+ "typescript-eslint": "^8.59.3"
85
85
  },
86
86
  "devDependencies": {
87
- "@commitlint/cli": "^20.5.0",
88
- "@commitlint/config-conventional": "^20.5.0",
89
- "@itcase/config": "^1.6.54",
87
+ "@commitlint/cli": "^21.0.1",
88
+ "@commitlint/config-conventional": "^21.0.1",
89
+ "@itcase/config": "^1.6.56",
90
90
  "@rollup/plugin-alias": "^6.0.0",
91
91
  "@rollup/plugin-babel": "^7.0.0",
92
92
  "@rollup/plugin-image": "^3.0.3",
@@ -94,22 +94,22 @@
94
94
  "@rollup/plugin-node-resolve": "^16.0.3",
95
95
  "@rollup/plugin-terser": "^1.0.0",
96
96
  "@rollup/plugin-typescript": "^12.3.0",
97
- "@types/node": "^25.6.0",
97
+ "@types/node": "^25.7.0",
98
98
  "@types/react": "^19.2.14",
99
- "@typescript-eslint/rule-tester": "^8.58.2",
99
+ "@typescript-eslint/rule-tester": "^8.59.3",
100
100
  "conventional-changelog-conventionalcommits": "^9.3.1",
101
101
  "del-cli": "^7.0.0",
102
102
  "husky": "^9.1.7",
103
- "lint-staged": "^16.4.0",
104
- "rollup": "4.60.1",
103
+ "lint-staged": "^17.0.4",
104
+ "rollup": "4.60.3",
105
105
  "rollup-plugin-copy": "^3.5.0",
106
106
  "rollup-plugin-dts": "^6.4.1",
107
107
  "rollup-plugin-peer-deps-external": "^2.2.4",
108
108
  "react": "^19.2.4",
109
109
  "rollup-preserve-directives": "^1.1.3",
110
110
  "semantic-release": "^25.0.3",
111
- "storybook": "^10.3.5",
111
+ "storybook": "^10.3.6",
112
112
  "tsx": "^4.21.0",
113
- "typescript": "^5.9.3"
113
+ "typescript": "^6.0.3"
114
114
  }
115
115
  }