@itcase/lint 1.1.98 → 1.1.99
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 +8 -0
- package/README.md +50 -4
- package/dist/eslint/plugin.d.ts +17 -0
- package/dist/eslint/react/dataTestIdPlugin/example.d.ts +13 -0
- package/dist/eslint/react/dataTestIdPlugin/extra.d.ts +8 -0
- package/dist/eslint/react/dataTestIdPlugin/interface.d.ts +12 -0
- package/dist/eslint/react/dataTestIdPlugin/plugin.d.ts +46 -0
- package/dist/eslint/restrictWords/config.d.ts +11 -0
- package/dist/eslint/restrictWords/index.d.ts +6 -0
- package/dist/eslint/restrictWords.js +79 -0
- package/dist/eslint/storybook/index.d.ts +19 -1
- package/dist/eslint/storybook/metaParametersDesign/constants.d.ts +12 -0
- package/dist/eslint/storybook/metaParametersDesign/extra.d.ts +8 -0
- package/dist/eslint/storybook/metaParametersDesign/interface.d.ts +6 -0
- package/dist/eslint/storybook/metaParametersDesign/plugin.d.ts +12 -0
- package/dist/eslint/storybook/metaParametersDesign/rule.d.ts +5 -0
- package/dist/eslint/storybook/metaParametersDesign/ruleVisitors.d.ts +3 -0
- package/dist/eslint/storybook/metaParametersDesign/utils.d.ts +6 -0
- package/dist/eslint/storybook.js +3 -10
- package/dist/eslint/utils/createPlugin.d.ts +14 -0
- package/dist/eslint/utils/createRuleCreator.d.ts +5 -0
- package/dist/eslint/utils/types.d.ts +4 -0
- package/dist/eslint.js +10 -278
- package/dist/index_CChA61aj.js +434 -0
- package/package.json +4 -3
- package/dist/eslint/customPlugins/dataTestIdPlugin/extra.d.ts +0 -18
- package/dist/eslint/customPlugins/dataTestIdPlugin/plugin.d.ts +0 -40
- /package/dist/eslint/{customPlugins → react}/dataTestIdPlugin/constants.d.ts +0 -0
- /package/dist/eslint/{customPlugins → react}/dataTestIdPlugin/rule.d.ts +0 -0
- /package/dist/eslint/{customPlugins → react}/dataTestIdPlugin/rule.test.d.ts +0 -0
- /package/dist/eslint/{customPlugins → react}/dataTestIdPlugin/ruleVisitors.d.ts +0 -0
- /package/dist/eslint/{customPlugins → react}/dataTestIdPlugin/utils.d.ts +0 -0
- /package/dist/eslint/{customPlugins/dataTestIdPlugin/example.d.ts → storybook/metaParametersDesign/rule.test.d.ts} +0 -0
- /package/dist/eslint/{utils.d.ts → utils/wrapArray.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [1.1.99](https://github.com/ITCase/itcase-lint/compare/v1.1.98...v1.1.99) (2026-03-06)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **eslint:** Add new rules / refactoring in exist rule / change rulees names ([206ee3c](https://github.com/ITCase/itcase-lint/commit/206ee3c9924d98ad7791d9c9bba294bf49440bb9))
|
|
6
|
+
* **eslint:** Add regexp ([a7b4756](https://github.com/ITCase/itcase-lint/commit/a7b47566b2bb2ec199c015abf46863fdaefd546a))
|
|
7
|
+
* **eslint:** Add restrict words ([3bfb815](https://github.com/ITCase/itcase-lint/commit/3bfb81569d16388ac3d4d1ea071b8a9a5d397c56))
|
|
8
|
+
|
|
1
9
|
## [1.1.98](https://github.com/ITCase/itcase-lint/compare/v1.1.97...v1.1.98) (2026-03-05)
|
|
2
10
|
|
|
3
11
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -87,9 +87,22 @@ import eslintReactNative from '@itcase/lint/eslint/react-native/index.js'
|
|
|
87
87
|
export default [...eslint, ...eslintMobx, ...eslintReactNative]
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
### ESLint
|
|
90
|
+
### Плагины ESLint
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
В пакет входят кастомные плагины, которые подключаются отдельно:
|
|
93
|
+
|
|
94
|
+
| Плагин | Описание | Подключение |
|
|
95
|
+
|--------|----------|-------------|
|
|
96
|
+
| **itcase-lint/react-data-test-id** | Требует атрибут `data-test-id` / `dataTestId` у указанных компонентов | Входит в базовый `@itcase/lint/eslint`, правило включается вручную для нужных путей |
|
|
97
|
+
| **itcase-lint/storybook-meta-parameters-design** | Требует в Storybook-сториз ссылку на Figma в `parameters.design` | `import eslintStorybook from '@itcase/lint/eslint/storybook'` и `...eslintStorybook` в конфиге |
|
|
98
|
+
|
|
99
|
+
Ниже — подробное описание и примеры для каждого плагина.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### ESLint with itcase-lint/react-data-test-id
|
|
104
|
+
|
|
105
|
+
`itcase-lint/react-data-test-id` принимает опции:
|
|
93
106
|
|
|
94
107
|
```ts
|
|
95
108
|
appendElementNamesToCheck?: string[] | null
|
|
@@ -121,7 +134,7 @@ export default [
|
|
|
121
134
|
ignores: ['./**/*.stories.*'],
|
|
122
135
|
files: ['./packages/*.{ts,tsx,js,jsx}'],
|
|
123
136
|
rules: {
|
|
124
|
-
'
|
|
137
|
+
'itcase-lint/react-data-test-id': 'warn',
|
|
125
138
|
},
|
|
126
139
|
},
|
|
127
140
|
]
|
|
@@ -138,7 +151,7 @@ export default [
|
|
|
138
151
|
ignores: ['./**/*.stories.*'],
|
|
139
152
|
files: ['./packages/*.{ts,tsx,js,jsx}'],
|
|
140
153
|
rules: {
|
|
141
|
-
'
|
|
154
|
+
'itcase-lint/react-data-test-id': [
|
|
142
155
|
'warn',
|
|
143
156
|
{
|
|
144
157
|
overrideElementNamesToIgnore: ['IgnoredElement', 'Html', 'SkipMe'],
|
|
@@ -151,6 +164,39 @@ export default [
|
|
|
151
164
|
]
|
|
152
165
|
```
|
|
153
166
|
|
|
167
|
+
### ESLint with Storybook (itcase-lint/storybook-meta-parameters-design)
|
|
168
|
+
|
|
169
|
+
The `itcase-lint/storybook-meta-parameters-design` rule checks that Storybook stories include a `parameters.design` block with `type: 'figma'` and a non-empty `url` containing `figma.com`.
|
|
170
|
+
|
|
171
|
+
**Setup**
|
|
172
|
+
|
|
173
|
+
Add the Storybook config to `eslint.config.mjs`:
|
|
174
|
+
|
|
175
|
+
```js
|
|
176
|
+
import eslint from '@itcase/lint/eslint'
|
|
177
|
+
import eslintStorybook from '@itcase/lint/eslint/storybook'
|
|
178
|
+
|
|
179
|
+
export default [...eslint, ...eslintStorybook]
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The rule `itcase-lint/storybook-meta-parameters-design` is enabled by default with level `warn` for files `**/*.stories.{ts,tsx,js,jsx,mjs,cjs}`.
|
|
183
|
+
|
|
184
|
+
**Meta requirements**
|
|
185
|
+
|
|
186
|
+
If the story’s default export has `parameters`, it must include a `parameters.design` object with `type: 'figma'` and a non-empty `url` containing `figma.com`. Example:
|
|
187
|
+
|
|
188
|
+
```js
|
|
189
|
+
export default {
|
|
190
|
+
component: MyComponent,
|
|
191
|
+
parameters: {
|
|
192
|
+
design: {
|
|
193
|
+
type: 'figma',
|
|
194
|
+
url: 'https://www.figma.com/design/...',
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
154
200
|
### Stylelint
|
|
155
201
|
|
|
156
202
|
Create a `eslint.config.mjs` configuration file in the root of your project with the following content:
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
declare const itcaseLintPlugin: {
|
|
3
|
+
meta: {
|
|
4
|
+
name: string;
|
|
5
|
+
version: string;
|
|
6
|
+
};
|
|
7
|
+
processors: {};
|
|
8
|
+
rules: {
|
|
9
|
+
"react-data-test-id": TSESLint.RuleModule<"missingAttribute" | "missingAttributeValue", import("./react/dataTestIdPlugin/interface").Options, unknown, TSESLint.RuleListener> & {
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
"storybook-meta-parameters-design": TSESLint.RuleModule<"missingOrEmptyUrl" | "typeMustBeFigma" | "urlMustContainFigma", [], unknown, TSESLint.RuleListener> & {
|
|
13
|
+
name: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export { itcaseLintPlugin };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const TestComponent4: () => React.JSX.Element;
|
|
3
|
+
type SomeType = {};
|
|
4
|
+
declare const TestComponent: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
|
5
|
+
declare function TestComponent2(_params: SomeType): React.JSX.Element;
|
|
6
|
+
declare function TestComponent3(_params: SomeType): React.JSX.Element;
|
|
7
|
+
declare function TestComponentWithMultipleGroups(): React.JSX.Element;
|
|
8
|
+
declare const TestComponentWithDifferentElements: () => React.JSX.Element;
|
|
9
|
+
declare const renderFunction: any;
|
|
10
|
+
declare const anonymousRenderFunction: any;
|
|
11
|
+
declare const anonymousRenderFunction2: any;
|
|
12
|
+
declare const TestComponentWithRender: () => React.JSX.Element;
|
|
13
|
+
export { anonymousRenderFunction, anonymousRenderFunction2, renderFunction, TestComponent, TestComponent2, TestComponent3, TestComponent4, TestComponentWithDifferentElements, TestComponentWithMultipleGroups, TestComponentWithRender, };
|
|
@@ -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 = "react-data-test-id";
|
|
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,12 @@
|
|
|
1
|
+
import type { RuleContext, RuleVisitors } from '../../utils/types';
|
|
2
|
+
import { type MessageIds } from './constants';
|
|
3
|
+
type Options = [
|
|
4
|
+
{
|
|
5
|
+
appendElementNamesToCheck?: string[] | null;
|
|
6
|
+
overrideElementNamesToCheck?: string[] | null;
|
|
7
|
+
overrideElementNamesToIgnore?: string[] | null;
|
|
8
|
+
}
|
|
9
|
+
];
|
|
10
|
+
type Context = RuleContext<keyof MessageIds, Options>;
|
|
11
|
+
type RuleVisitorsType = RuleVisitors<keyof MessageIds, Options>;
|
|
12
|
+
export type { Context, Options, RuleVisitorsType };
|
|
@@ -0,0 +1,46 @@
|
|
|
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("./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
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
rules: {
|
|
28
|
+
"itcase-lint/react-data-test-id": "off";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
meta: {
|
|
33
|
+
name: string;
|
|
34
|
+
version: string;
|
|
35
|
+
};
|
|
36
|
+
processors: {};
|
|
37
|
+
rules: {
|
|
38
|
+
"react-data-test-id": TSESLint.RuleModule<"missingAttribute" | "missingAttributeValue", import("./interface").Options, unknown, TSESLint.RuleListener> & {
|
|
39
|
+
name: string;
|
|
40
|
+
};
|
|
41
|
+
"storybook-meta-parameters-design": TSESLint.RuleModule<"missingOrEmptyUrl" | "typeMustBeFigma" | "urlMustContainFigma", [], unknown, TSESLint.RuleListener> & {
|
|
42
|
+
name: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export default pluginWithConfigs;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Запрещённые сокращения и допустимые замены.
|
|
3
|
+
* Все проверяются на вхождение в идентификатор (camelCase): например "btn" ловит btn, primaryBtn, submitBtn, но не button.
|
|
4
|
+
* - forbidden: сокращение для сообщения об ошибке.
|
|
5
|
+
* - use: что писать вместо (строка или массив вариантов).
|
|
6
|
+
*/
|
|
7
|
+
export declare const RESTRICTED_WORDS: ReadonlyArray<{
|
|
8
|
+
forbidden: string;
|
|
9
|
+
use: string | readonly [string, ...string[]];
|
|
10
|
+
}>;
|
|
11
|
+
export type RestrictedWordEntry = (typeof RESTRICTED_WORDS)[number];
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Запрещённые сокращения и допустимые замены.
|
|
3
|
+
* Все проверяются на вхождение в идентификатор (camelCase): например "btn" ловит btn, primaryBtn, submitBtn, но не button.
|
|
4
|
+
* - forbidden: сокращение для сообщения об ошибке.
|
|
5
|
+
* - use: что писать вместо (строка или массив вариантов).
|
|
6
|
+
*/
|
|
7
|
+
const RESTRICTED_WORDS = [
|
|
8
|
+
{ forbidden: 'btn', use: 'button' },
|
|
9
|
+
{ forbidden: 'lbl', use: 'label' },
|
|
10
|
+
{ forbidden: 'lnk', use: 'link' },
|
|
11
|
+
{ forbidden: 'tbl', use: 'table' },
|
|
12
|
+
{ forbidden: 'txt', use: ['text', 'input'] },
|
|
13
|
+
{ forbidden: 'pw', use: 'password' },
|
|
14
|
+
{ forbidden: 'pwd', use: 'password' },
|
|
15
|
+
{ forbidden: 'usr', use: 'user' },
|
|
16
|
+
{ forbidden: 'mod', use: ['modify', 'module'] },
|
|
17
|
+
{ forbidden: 'tmp', use: 'temporary' },
|
|
18
|
+
{ forbidden: 'dir', use: ['directory', 'direction'] },
|
|
19
|
+
{ forbidden: 'pos', use: 'position' },
|
|
20
|
+
{ forbidden: 'cnt', use: 'count' },
|
|
21
|
+
{ forbidden: 'curr', use: 'current' },
|
|
22
|
+
{ forbidden: 'def', use: 'default' },
|
|
23
|
+
{ forbidden: 'doc', use: 'document' },
|
|
24
|
+
{ forbidden: 'elem', use: 'element' },
|
|
25
|
+
{ forbidden: 'fn', use: ['function', 'callback'] },
|
|
26
|
+
{ forbidden: 'idx', use: 'index' },
|
|
27
|
+
{ forbidden: 'len', use: 'length' },
|
|
28
|
+
{ forbidden: 'msg', use: 'message' },
|
|
29
|
+
{ forbidden: 'num', use: 'number' },
|
|
30
|
+
{ forbidden: 'opt', use: 'option' },
|
|
31
|
+
{ forbidden: 'qty', use: 'quantity' },
|
|
32
|
+
{ forbidden: 'req', use: 'request' },
|
|
33
|
+
{ forbidden: 'str', use: 'string' },
|
|
34
|
+
{ forbidden: 'tst', use: 'test' },
|
|
35
|
+
{ forbidden: 'val', use: 'value' },
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
/** Escape special regex characters in the forbidden word. */
|
|
39
|
+
function escapeRegex(source) {
|
|
40
|
+
return source.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Regex to match abbreviation inside identifier (camelCase):
|
|
44
|
+
* - at start (^) or after lowercase ([a-z]);
|
|
45
|
+
* - then the abbreviation (first char may be upper in camelCase, e.g. Btn);
|
|
46
|
+
* - then end ($) or next uppercase ([A-Z]).
|
|
47
|
+
* Matches: "btn", "primaryBtn", "submitBtn". Does not match: "button".
|
|
48
|
+
*/
|
|
49
|
+
function abbreviationPattern(forbidden) {
|
|
50
|
+
if (forbidden.length === 0)
|
|
51
|
+
return '(?!.)';
|
|
52
|
+
const first = forbidden[0];
|
|
53
|
+
const restEscaped = escapeRegex(forbidden.slice(1));
|
|
54
|
+
const firstCharClass = first === first.toUpperCase()
|
|
55
|
+
? escapeRegex(first)
|
|
56
|
+
: `[${first}${first.toUpperCase()}]`;
|
|
57
|
+
return `(^|[a-z])${firstCharClass}${restEscaped}([A-Z]|$)`;
|
|
58
|
+
}
|
|
59
|
+
function buildNoRestrictedSyntaxOptions() {
|
|
60
|
+
if (RESTRICTED_WORDS.length === 0) {
|
|
61
|
+
return 'off';
|
|
62
|
+
}
|
|
63
|
+
const selectors = RESTRICTED_WORDS.map(({ forbidden, use }) => {
|
|
64
|
+
const useList = Array.isArray(use) ? use : [use];
|
|
65
|
+
const useText = useList.length === 1
|
|
66
|
+
? `Use "${useList[0]}" instead.`
|
|
67
|
+
: `Use "${useList.join('" or "')}" instead.`;
|
|
68
|
+
const pattern = abbreviationPattern(forbidden);
|
|
69
|
+
const patternEscaped = pattern.replace(/\//g, '\\/');
|
|
70
|
+
return {
|
|
71
|
+
message: `Using "${forbidden}" (or containing it) as an identifier is not allowed. ${useText}`,
|
|
72
|
+
selector: `Identifier[name=/${patternEscaped}/]`,
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
return ['error', ...selectors];
|
|
76
|
+
}
|
|
77
|
+
const noRestrictedSyntaxRestrictWords = buildNoRestrictedSyntaxOptions();
|
|
78
|
+
|
|
79
|
+
export { RESTRICTED_WORDS, noRestrictedSyntaxRestrictWords };
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
files: string[];
|
|
3
3
|
plugins: {
|
|
4
|
-
|
|
4
|
+
"itcase-lint": {
|
|
5
|
+
meta: {
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
};
|
|
9
|
+
processors: {};
|
|
10
|
+
rules: {
|
|
11
|
+
"react-data-test-id": import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingAttribute" | "missingAttributeValue", import("../react/dataTestIdPlugin/interface").Options, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
14
|
+
"storybook-meta-parameters-design": import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingOrEmptyUrl" | "typeMustBeFigma" | "urlMustContainFigma", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
storybook: {
|
|
5
20
|
configs: {
|
|
6
21
|
csf: {
|
|
7
22
|
plugins: string[];
|
|
@@ -404,5 +419,8 @@ declare const _default: {
|
|
|
404
419
|
};
|
|
405
420
|
};
|
|
406
421
|
};
|
|
422
|
+
rules: {
|
|
423
|
+
"itcase-lint/storybook-meta-parameters-design": string;
|
|
424
|
+
};
|
|
407
425
|
}[];
|
|
408
426
|
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const MESSAGE_IDS: {
|
|
2
|
+
readonly missingOrEmptyUrl: "missingOrEmptyUrl";
|
|
3
|
+
readonly typeMustBeFigma: "typeMustBeFigma";
|
|
4
|
+
readonly urlMustContainFigma: "urlMustContainFigma";
|
|
5
|
+
};
|
|
6
|
+
type MessageIds = keyof typeof MESSAGE_IDS;
|
|
7
|
+
declare const MESSAGES: {
|
|
8
|
+
missingOrEmptyUrl: string;
|
|
9
|
+
typeMustBeFigma: string;
|
|
10
|
+
urlMustContainFigma: string;
|
|
11
|
+
};
|
|
12
|
+
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 = "storybook-meta-parameters-design";
|
|
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,12 @@
|
|
|
1
|
+
import { pluginName, ruleName } from './extra';
|
|
2
|
+
declare const plugin: {
|
|
3
|
+
meta: {
|
|
4
|
+
name: string;
|
|
5
|
+
version: string;
|
|
6
|
+
};
|
|
7
|
+
processors: {};
|
|
8
|
+
rules: {
|
|
9
|
+
[ruleName]: import("@typescript-eslint/utils/ts-eslint").RuleModule<string, unknown[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export { plugin, pluginName, ruleName };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
declare function getPropertyName(key: TSESTree.Property['key']): string | undefined;
|
|
3
|
+
declare function findProperty(node: TSESTree.ObjectExpression, name: string): TSESTree.Property | undefined;
|
|
4
|
+
declare function getStringLiteralValue(node: TSESTree.Node): string | undefined;
|
|
5
|
+
declare function resolveMetaObject(declaration: TSESTree.ExportDefaultDeclaration['declaration'], sourceCode: Readonly<TSESTree.Program>): TSESTree.ObjectExpression | null;
|
|
6
|
+
export { findProperty, getPropertyName, getStringLiteralValue, resolveMetaObject, };
|
package/dist/eslint/storybook.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
{
|
|
5
|
-
files: ['**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)'],
|
|
6
|
-
plugins: { strorybook: eslintStorybook },
|
|
7
|
-
},
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
export { index as default };
|
|
1
|
+
import 'eslint-plugin-storybook';
|
|
2
|
+
export { s as default } from '../index_CChA61aj.js';
|
|
3
|
+
import '@typescript-eslint/utils';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
declare function createPlugin(pluginName: string, ruleName: string, rule: TSESLint.RuleModule<string, unknown[]>, options?: {
|
|
3
|
+
version?: string;
|
|
4
|
+
}): {
|
|
5
|
+
meta: {
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
};
|
|
9
|
+
processors: {};
|
|
10
|
+
rules: {
|
|
11
|
+
[ruleName]: TSESLint.RuleModule<string, unknown[], unknown, TSESLint.RuleListener>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export { createPlugin };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
declare function createRuleCreator(pluginPath: string): <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener> & {
|
|
3
|
+
name: string;
|
|
4
|
+
};
|
|
5
|
+
export { createRuleCreator };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
type RuleContext<MessageIds extends string, Options extends readonly unknown[]> = Readonly<TSESLint.RuleContext<MessageIds, Options>>;
|
|
3
|
+
type RuleVisitors<MessageIds extends string, Options extends readonly unknown[]> = (context: RuleContext<MessageIds, Options>, optionsWithDefault: Readonly<Options>) => TSESLint.RuleListener;
|
|
4
|
+
export type { RuleContext, RuleVisitors };
|