@eslint-react/kit 1.43.0 → 1.43.1-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +83 -15
- package/dist/index.d.ts +83 -15
- package/dist/index.js +74 -43
- package/dist/index.mjs +73 -28
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ import { ReportDescriptor } from '@typescript-eslint/utils/ts-eslint';
|
|
|
4
4
|
import { CompilerOptions, JsxEmit } from 'typescript';
|
|
5
5
|
import * as valibot from 'valibot';
|
|
6
6
|
import { InferOutput } from 'valibot';
|
|
7
|
+
import { TSESTree } from '@typescript-eslint/utils';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Rule severity.
|
|
@@ -31,6 +32,7 @@ type RuleContext<MessageIds extends string = string, Options extends readonly un
|
|
|
31
32
|
* @since 1.20.0
|
|
32
33
|
*/
|
|
33
34
|
type RuleFeature = "CFG" | "DBG" | "FIX" | "MOD" | "TSC" | "EXP";
|
|
35
|
+
|
|
34
36
|
/**
|
|
35
37
|
* Creates a report function that can conditionally report a descriptor.
|
|
36
38
|
* @param context - The context of the rule
|
|
@@ -118,56 +120,68 @@ declare namespace index {
|
|
|
118
120
|
/**
|
|
119
121
|
* Regular expression for matching a TypeScript file extension.
|
|
120
122
|
*/
|
|
121
|
-
declare const
|
|
123
|
+
declare const TS_EXT: RegExp;
|
|
122
124
|
/**
|
|
123
125
|
* Regular expression for matching a JavaScript file extension.
|
|
124
126
|
*/
|
|
125
|
-
declare const
|
|
127
|
+
declare const JS_EXT: RegExp;
|
|
126
128
|
/**
|
|
127
129
|
* Regular expression for matching a PascalCase string.
|
|
128
130
|
*/
|
|
129
|
-
declare const
|
|
131
|
+
declare const PASCAL_CASE: RegExp;
|
|
130
132
|
/**
|
|
131
133
|
* Regular expression for matching a camelCase string.
|
|
132
134
|
*/
|
|
133
|
-
declare const
|
|
135
|
+
declare const CAMEL_CASE: RegExp;
|
|
134
136
|
/**
|
|
135
137
|
* Regular expression for matching a kebab-case string.
|
|
136
138
|
*/
|
|
137
|
-
declare const
|
|
139
|
+
declare const KEBAB_CASE: RegExp;
|
|
138
140
|
/**
|
|
139
141
|
* Regular expression for matching a snake_case string.
|
|
140
142
|
*/
|
|
141
|
-
declare const
|
|
143
|
+
declare const SNAKE_CASE: RegExp;
|
|
142
144
|
/**
|
|
143
145
|
* Regular expression for matching a CONSTANT_CASE string.
|
|
144
146
|
*/
|
|
145
|
-
declare const
|
|
146
|
-
declare const
|
|
147
|
+
declare const CONSTANT_CASE: RegExp;
|
|
148
|
+
declare const JAVASCRIPT_PROTOCOL: RegExp;
|
|
147
149
|
/**
|
|
148
150
|
* Regular expression for matching a valid JavaScript identifier.
|
|
149
151
|
*/
|
|
150
|
-
declare const
|
|
152
|
+
declare const JS_IDENTIFIER: RegExp;
|
|
151
153
|
/**
|
|
152
154
|
* Regular expression for matching a RegExp string.
|
|
153
155
|
*/
|
|
154
|
-
declare const
|
|
156
|
+
declare const REGEXP_STR: RegExp;
|
|
155
157
|
/**
|
|
156
158
|
* Regular expression for matching a `@jsx` annotation comment.
|
|
157
159
|
*/
|
|
158
|
-
declare const
|
|
160
|
+
declare const ANNOTATION_JSX: RegExp;
|
|
159
161
|
/**
|
|
160
162
|
* Regular expression for matching a `@jsxFrag` annotation comment.
|
|
161
163
|
*/
|
|
162
|
-
declare const
|
|
164
|
+
declare const ANNOTATION_JSX_FRAG: RegExp;
|
|
163
165
|
/**
|
|
164
166
|
* Regular expression for matching a `@jsxRuntime` annotation comment.
|
|
165
167
|
*/
|
|
166
|
-
declare const
|
|
168
|
+
declare const ANNOTATION_JSX_RUNTIME: RegExp;
|
|
167
169
|
/**
|
|
168
170
|
* Regular expression for matching a `@jsxImportSource` annotation comment.
|
|
169
171
|
*/
|
|
170
|
-
declare const
|
|
172
|
+
declare const ANNOTATION_JSX_IMPORT_SOURCE: RegExp;
|
|
173
|
+
/**
|
|
174
|
+
* Regular expression for matching a React component name.
|
|
175
|
+
*/
|
|
176
|
+
declare const COMPONENT_NAME: RegExp;
|
|
177
|
+
/**
|
|
178
|
+
* Regular expression for matching a React component name (loose).
|
|
179
|
+
*/
|
|
180
|
+
declare const COMPONENT_NAME_LOOSE: RegExp;
|
|
181
|
+
/**
|
|
182
|
+
* Regular expression for matching a React Hook name.
|
|
183
|
+
*/
|
|
184
|
+
declare const HOOK_NAME: RegExp;
|
|
171
185
|
/**
|
|
172
186
|
* Convert a string to the `RegExp`.
|
|
173
187
|
* Normal strings (e.g. `"foo"`) is converted to `/^foo$/` of `RegExp`.
|
|
@@ -186,4 +200,58 @@ declare function toRegExp(string: string): {
|
|
|
186
200
|
*/
|
|
187
201
|
declare function isRegExp(string: string): boolean;
|
|
188
202
|
|
|
189
|
-
|
|
203
|
+
declare const RE_ANNOTATION_JSX: typeof ANNOTATION_JSX;
|
|
204
|
+
declare const RE_ANNOTATION_JSX_FRAG: typeof ANNOTATION_JSX_FRAG;
|
|
205
|
+
declare const RE_ANNOTATION_JSX_IMPORT_SOURCE: typeof ANNOTATION_JSX_IMPORT_SOURCE;
|
|
206
|
+
declare const RE_ANNOTATION_JSX_RUNTIME: typeof ANNOTATION_JSX_RUNTIME;
|
|
207
|
+
declare const RE_CAMEL_CASE: typeof CAMEL_CASE;
|
|
208
|
+
declare const RE_COMPONENT_NAME: typeof COMPONENT_NAME;
|
|
209
|
+
declare const RE_COMPONENT_NAME_LOOSE: typeof COMPONENT_NAME_LOOSE;
|
|
210
|
+
declare const RE_CONSTANT_CASE: typeof CONSTANT_CASE;
|
|
211
|
+
declare const RE_HOOK_NAME: typeof HOOK_NAME;
|
|
212
|
+
declare const RE_JAVASCRIPT_PROTOCOL: typeof JAVASCRIPT_PROTOCOL;
|
|
213
|
+
declare const RE_JS_EXT: typeof JS_EXT;
|
|
214
|
+
declare const RE_JS_IDENTIFIER: typeof JS_IDENTIFIER;
|
|
215
|
+
declare const RE_KEBAB_CASE: typeof KEBAB_CASE;
|
|
216
|
+
declare const RE_PASCAL_CASE: typeof PASCAL_CASE;
|
|
217
|
+
declare const RE_REGEXP_STR: typeof REGEXP_STR;
|
|
218
|
+
declare const RE_SNAKE_CASE: typeof SNAKE_CASE;
|
|
219
|
+
declare const RE_TS_EXT: typeof TS_EXT;
|
|
220
|
+
declare const RE_isRegExp: typeof isRegExp;
|
|
221
|
+
declare const RE_toRegExp: typeof toRegExp;
|
|
222
|
+
declare namespace RE {
|
|
223
|
+
export { RE_ANNOTATION_JSX as ANNOTATION_JSX, RE_ANNOTATION_JSX_FRAG as ANNOTATION_JSX_FRAG, RE_ANNOTATION_JSX_IMPORT_SOURCE as ANNOTATION_JSX_IMPORT_SOURCE, RE_ANNOTATION_JSX_RUNTIME as ANNOTATION_JSX_RUNTIME, RE_CAMEL_CASE as CAMEL_CASE, RE_COMPONENT_NAME as COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE as COMPONENT_NAME_LOOSE, RE_CONSTANT_CASE as CONSTANT_CASE, RE_HOOK_NAME as HOOK_NAME, RE_JAVASCRIPT_PROTOCOL as JAVASCRIPT_PROTOCOL, RE_JS_EXT as JS_EXT, RE_JS_IDENTIFIER as JS_IDENTIFIER, RE_KEBAB_CASE as KEBAB_CASE, RE_PASCAL_CASE as PASCAL_CASE, RE_REGEXP_STR as REGEXP_STR, RE_SNAKE_CASE as SNAKE_CASE, RE_TS_EXT as TS_EXT, RE_isRegExp as isRegExp, RE_toRegExp as toRegExp };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
type ImplicitReturnArrowFunctionExpression = TSESTree.ArrowFunctionExpression & {
|
|
227
|
+
body: TSESTree.Expression;
|
|
228
|
+
};
|
|
229
|
+
type ObjectDestructuringVariableDeclarator = TSESTree.VariableDeclarator & {
|
|
230
|
+
id: TSESTree.ObjectPattern;
|
|
231
|
+
init: TSESTree.Identifier;
|
|
232
|
+
};
|
|
233
|
+
type DisplayNameAssignmentExpression = TSESTree.AssignmentExpression & {
|
|
234
|
+
type: "AssignmentExpression";
|
|
235
|
+
left: TSESTree.MemberExpression & {
|
|
236
|
+
property: TSESTree.Identifier & {
|
|
237
|
+
name: "displayName";
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
operator: "=";
|
|
241
|
+
right: TSESTree.Literal;
|
|
242
|
+
};
|
|
243
|
+
declare const IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION = "ArrowFunctionExpression[body.type!='BlockStatement']";
|
|
244
|
+
declare const OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR: string;
|
|
245
|
+
declare const DISPLAY_NAME_ASSIGNMENT_EXPRESSION: string;
|
|
246
|
+
|
|
247
|
+
declare const SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION: typeof DISPLAY_NAME_ASSIGNMENT_EXPRESSION;
|
|
248
|
+
type SEL_DisplayNameAssignmentExpression = DisplayNameAssignmentExpression;
|
|
249
|
+
declare const SEL_IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION: typeof IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION;
|
|
250
|
+
type SEL_ImplicitReturnArrowFunctionExpression = ImplicitReturnArrowFunctionExpression;
|
|
251
|
+
declare const SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR: typeof OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR;
|
|
252
|
+
type SEL_ObjectDestructuringVariableDeclarator = ObjectDestructuringVariableDeclarator;
|
|
253
|
+
declare namespace SEL {
|
|
254
|
+
export { SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION as DISPLAY_NAME_ASSIGNMENT_EXPRESSION, type SEL_DisplayNameAssignmentExpression as DisplayNameAssignmentExpression, SEL_IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION as IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION, type SEL_ImplicitReturnArrowFunctionExpression as ImplicitReturnArrowFunctionExpression, SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR as OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR, type SEL_ObjectDestructuringVariableDeclarator as ObjectDestructuringVariableDeclarator };
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export { index$1 as JsxConfig, index as LanguagePreference, RE, type RuleContext, type RuleDeclaration, type RuleFeature, type RulePreset, type RuleSeverity, SEL, createReport };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { ReportDescriptor } from '@typescript-eslint/utils/ts-eslint';
|
|
|
4
4
|
import { CompilerOptions, JsxEmit } from 'typescript';
|
|
5
5
|
import * as valibot from 'valibot';
|
|
6
6
|
import { InferOutput } from 'valibot';
|
|
7
|
+
import { TSESTree } from '@typescript-eslint/utils';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Rule severity.
|
|
@@ -31,6 +32,7 @@ type RuleContext<MessageIds extends string = string, Options extends readonly un
|
|
|
31
32
|
* @since 1.20.0
|
|
32
33
|
*/
|
|
33
34
|
type RuleFeature = "CFG" | "DBG" | "FIX" | "MOD" | "TSC" | "EXP";
|
|
35
|
+
|
|
34
36
|
/**
|
|
35
37
|
* Creates a report function that can conditionally report a descriptor.
|
|
36
38
|
* @param context - The context of the rule
|
|
@@ -118,56 +120,68 @@ declare namespace index {
|
|
|
118
120
|
/**
|
|
119
121
|
* Regular expression for matching a TypeScript file extension.
|
|
120
122
|
*/
|
|
121
|
-
declare const
|
|
123
|
+
declare const TS_EXT: RegExp;
|
|
122
124
|
/**
|
|
123
125
|
* Regular expression for matching a JavaScript file extension.
|
|
124
126
|
*/
|
|
125
|
-
declare const
|
|
127
|
+
declare const JS_EXT: RegExp;
|
|
126
128
|
/**
|
|
127
129
|
* Regular expression for matching a PascalCase string.
|
|
128
130
|
*/
|
|
129
|
-
declare const
|
|
131
|
+
declare const PASCAL_CASE: RegExp;
|
|
130
132
|
/**
|
|
131
133
|
* Regular expression for matching a camelCase string.
|
|
132
134
|
*/
|
|
133
|
-
declare const
|
|
135
|
+
declare const CAMEL_CASE: RegExp;
|
|
134
136
|
/**
|
|
135
137
|
* Regular expression for matching a kebab-case string.
|
|
136
138
|
*/
|
|
137
|
-
declare const
|
|
139
|
+
declare const KEBAB_CASE: RegExp;
|
|
138
140
|
/**
|
|
139
141
|
* Regular expression for matching a snake_case string.
|
|
140
142
|
*/
|
|
141
|
-
declare const
|
|
143
|
+
declare const SNAKE_CASE: RegExp;
|
|
142
144
|
/**
|
|
143
145
|
* Regular expression for matching a CONSTANT_CASE string.
|
|
144
146
|
*/
|
|
145
|
-
declare const
|
|
146
|
-
declare const
|
|
147
|
+
declare const CONSTANT_CASE: RegExp;
|
|
148
|
+
declare const JAVASCRIPT_PROTOCOL: RegExp;
|
|
147
149
|
/**
|
|
148
150
|
* Regular expression for matching a valid JavaScript identifier.
|
|
149
151
|
*/
|
|
150
|
-
declare const
|
|
152
|
+
declare const JS_IDENTIFIER: RegExp;
|
|
151
153
|
/**
|
|
152
154
|
* Regular expression for matching a RegExp string.
|
|
153
155
|
*/
|
|
154
|
-
declare const
|
|
156
|
+
declare const REGEXP_STR: RegExp;
|
|
155
157
|
/**
|
|
156
158
|
* Regular expression for matching a `@jsx` annotation comment.
|
|
157
159
|
*/
|
|
158
|
-
declare const
|
|
160
|
+
declare const ANNOTATION_JSX: RegExp;
|
|
159
161
|
/**
|
|
160
162
|
* Regular expression for matching a `@jsxFrag` annotation comment.
|
|
161
163
|
*/
|
|
162
|
-
declare const
|
|
164
|
+
declare const ANNOTATION_JSX_FRAG: RegExp;
|
|
163
165
|
/**
|
|
164
166
|
* Regular expression for matching a `@jsxRuntime` annotation comment.
|
|
165
167
|
*/
|
|
166
|
-
declare const
|
|
168
|
+
declare const ANNOTATION_JSX_RUNTIME: RegExp;
|
|
167
169
|
/**
|
|
168
170
|
* Regular expression for matching a `@jsxImportSource` annotation comment.
|
|
169
171
|
*/
|
|
170
|
-
declare const
|
|
172
|
+
declare const ANNOTATION_JSX_IMPORT_SOURCE: RegExp;
|
|
173
|
+
/**
|
|
174
|
+
* Regular expression for matching a React component name.
|
|
175
|
+
*/
|
|
176
|
+
declare const COMPONENT_NAME: RegExp;
|
|
177
|
+
/**
|
|
178
|
+
* Regular expression for matching a React component name (loose).
|
|
179
|
+
*/
|
|
180
|
+
declare const COMPONENT_NAME_LOOSE: RegExp;
|
|
181
|
+
/**
|
|
182
|
+
* Regular expression for matching a React Hook name.
|
|
183
|
+
*/
|
|
184
|
+
declare const HOOK_NAME: RegExp;
|
|
171
185
|
/**
|
|
172
186
|
* Convert a string to the `RegExp`.
|
|
173
187
|
* Normal strings (e.g. `"foo"`) is converted to `/^foo$/` of `RegExp`.
|
|
@@ -186,4 +200,58 @@ declare function toRegExp(string: string): {
|
|
|
186
200
|
*/
|
|
187
201
|
declare function isRegExp(string: string): boolean;
|
|
188
202
|
|
|
189
|
-
|
|
203
|
+
declare const RE_ANNOTATION_JSX: typeof ANNOTATION_JSX;
|
|
204
|
+
declare const RE_ANNOTATION_JSX_FRAG: typeof ANNOTATION_JSX_FRAG;
|
|
205
|
+
declare const RE_ANNOTATION_JSX_IMPORT_SOURCE: typeof ANNOTATION_JSX_IMPORT_SOURCE;
|
|
206
|
+
declare const RE_ANNOTATION_JSX_RUNTIME: typeof ANNOTATION_JSX_RUNTIME;
|
|
207
|
+
declare const RE_CAMEL_CASE: typeof CAMEL_CASE;
|
|
208
|
+
declare const RE_COMPONENT_NAME: typeof COMPONENT_NAME;
|
|
209
|
+
declare const RE_COMPONENT_NAME_LOOSE: typeof COMPONENT_NAME_LOOSE;
|
|
210
|
+
declare const RE_CONSTANT_CASE: typeof CONSTANT_CASE;
|
|
211
|
+
declare const RE_HOOK_NAME: typeof HOOK_NAME;
|
|
212
|
+
declare const RE_JAVASCRIPT_PROTOCOL: typeof JAVASCRIPT_PROTOCOL;
|
|
213
|
+
declare const RE_JS_EXT: typeof JS_EXT;
|
|
214
|
+
declare const RE_JS_IDENTIFIER: typeof JS_IDENTIFIER;
|
|
215
|
+
declare const RE_KEBAB_CASE: typeof KEBAB_CASE;
|
|
216
|
+
declare const RE_PASCAL_CASE: typeof PASCAL_CASE;
|
|
217
|
+
declare const RE_REGEXP_STR: typeof REGEXP_STR;
|
|
218
|
+
declare const RE_SNAKE_CASE: typeof SNAKE_CASE;
|
|
219
|
+
declare const RE_TS_EXT: typeof TS_EXT;
|
|
220
|
+
declare const RE_isRegExp: typeof isRegExp;
|
|
221
|
+
declare const RE_toRegExp: typeof toRegExp;
|
|
222
|
+
declare namespace RE {
|
|
223
|
+
export { RE_ANNOTATION_JSX as ANNOTATION_JSX, RE_ANNOTATION_JSX_FRAG as ANNOTATION_JSX_FRAG, RE_ANNOTATION_JSX_IMPORT_SOURCE as ANNOTATION_JSX_IMPORT_SOURCE, RE_ANNOTATION_JSX_RUNTIME as ANNOTATION_JSX_RUNTIME, RE_CAMEL_CASE as CAMEL_CASE, RE_COMPONENT_NAME as COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE as COMPONENT_NAME_LOOSE, RE_CONSTANT_CASE as CONSTANT_CASE, RE_HOOK_NAME as HOOK_NAME, RE_JAVASCRIPT_PROTOCOL as JAVASCRIPT_PROTOCOL, RE_JS_EXT as JS_EXT, RE_JS_IDENTIFIER as JS_IDENTIFIER, RE_KEBAB_CASE as KEBAB_CASE, RE_PASCAL_CASE as PASCAL_CASE, RE_REGEXP_STR as REGEXP_STR, RE_SNAKE_CASE as SNAKE_CASE, RE_TS_EXT as TS_EXT, RE_isRegExp as isRegExp, RE_toRegExp as toRegExp };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
type ImplicitReturnArrowFunctionExpression = TSESTree.ArrowFunctionExpression & {
|
|
227
|
+
body: TSESTree.Expression;
|
|
228
|
+
};
|
|
229
|
+
type ObjectDestructuringVariableDeclarator = TSESTree.VariableDeclarator & {
|
|
230
|
+
id: TSESTree.ObjectPattern;
|
|
231
|
+
init: TSESTree.Identifier;
|
|
232
|
+
};
|
|
233
|
+
type DisplayNameAssignmentExpression = TSESTree.AssignmentExpression & {
|
|
234
|
+
type: "AssignmentExpression";
|
|
235
|
+
left: TSESTree.MemberExpression & {
|
|
236
|
+
property: TSESTree.Identifier & {
|
|
237
|
+
name: "displayName";
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
operator: "=";
|
|
241
|
+
right: TSESTree.Literal;
|
|
242
|
+
};
|
|
243
|
+
declare const IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION = "ArrowFunctionExpression[body.type!='BlockStatement']";
|
|
244
|
+
declare const OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR: string;
|
|
245
|
+
declare const DISPLAY_NAME_ASSIGNMENT_EXPRESSION: string;
|
|
246
|
+
|
|
247
|
+
declare const SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION: typeof DISPLAY_NAME_ASSIGNMENT_EXPRESSION;
|
|
248
|
+
type SEL_DisplayNameAssignmentExpression = DisplayNameAssignmentExpression;
|
|
249
|
+
declare const SEL_IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION: typeof IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION;
|
|
250
|
+
type SEL_ImplicitReturnArrowFunctionExpression = ImplicitReturnArrowFunctionExpression;
|
|
251
|
+
declare const SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR: typeof OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR;
|
|
252
|
+
type SEL_ObjectDestructuringVariableDeclarator = ObjectDestructuringVariableDeclarator;
|
|
253
|
+
declare namespace SEL {
|
|
254
|
+
export { SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION as DISPLAY_NAME_ASSIGNMENT_EXPRESSION, type SEL_DisplayNameAssignmentExpression as DisplayNameAssignmentExpression, SEL_IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION as IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION, type SEL_ImplicitReturnArrowFunctionExpression as ImplicitReturnArrowFunctionExpression, SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR as OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR, type SEL_ObjectDestructuringVariableDeclarator as ObjectDestructuringVariableDeclarator };
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export { index$1 as JsxConfig, index as LanguagePreference, RE, type RuleContext, type RuleDeclaration, type RuleFeature, type RulePreset, type RuleSeverity, SEL, createReport };
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,13 @@ var __export = (target, all) => {
|
|
|
9
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
// src/helpers.ts
|
|
13
|
+
function createReport(context) {
|
|
14
|
+
return (descriptor) => {
|
|
15
|
+
if (descriptor != null) context.report(descriptor);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
// src/JsxConfig/index.ts
|
|
13
20
|
var JsxConfig_exports = {};
|
|
14
21
|
__export(JsxConfig_exports, {
|
|
@@ -17,28 +24,53 @@ __export(JsxConfig_exports, {
|
|
|
17
24
|
make: () => make
|
|
18
25
|
});
|
|
19
26
|
|
|
20
|
-
// src/
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
// src/RE.ts
|
|
28
|
+
var RE_exports = {};
|
|
29
|
+
__export(RE_exports, {
|
|
30
|
+
ANNOTATION_JSX: () => ANNOTATION_JSX,
|
|
31
|
+
ANNOTATION_JSX_FRAG: () => ANNOTATION_JSX_FRAG,
|
|
32
|
+
ANNOTATION_JSX_IMPORT_SOURCE: () => ANNOTATION_JSX_IMPORT_SOURCE,
|
|
33
|
+
ANNOTATION_JSX_RUNTIME: () => ANNOTATION_JSX_RUNTIME,
|
|
34
|
+
CAMEL_CASE: () => CAMEL_CASE,
|
|
35
|
+
COMPONENT_NAME: () => COMPONENT_NAME,
|
|
36
|
+
COMPONENT_NAME_LOOSE: () => COMPONENT_NAME_LOOSE,
|
|
37
|
+
CONSTANT_CASE: () => CONSTANT_CASE,
|
|
38
|
+
HOOK_NAME: () => HOOK_NAME,
|
|
39
|
+
JAVASCRIPT_PROTOCOL: () => JAVASCRIPT_PROTOCOL,
|
|
40
|
+
JS_EXT: () => JS_EXT,
|
|
41
|
+
JS_IDENTIFIER: () => JS_IDENTIFIER,
|
|
42
|
+
KEBAB_CASE: () => KEBAB_CASE,
|
|
43
|
+
PASCAL_CASE: () => PASCAL_CASE,
|
|
44
|
+
REGEXP_STR: () => REGEXP_STR,
|
|
45
|
+
SNAKE_CASE: () => SNAKE_CASE,
|
|
46
|
+
TS_EXT: () => TS_EXT,
|
|
47
|
+
isRegExp: () => isRegExp,
|
|
48
|
+
toRegExp: () => toRegExp
|
|
49
|
+
});
|
|
50
|
+
var TS_EXT = /^[cm]?tsx?$/u;
|
|
51
|
+
var JS_EXT = /^[cm]?jsx?$/u;
|
|
52
|
+
var PASCAL_CASE = /^[A-Z][\dA-Za-z]*$/u;
|
|
53
|
+
var CAMEL_CASE = /^[a-z][\dA-Za-z]*$/u;
|
|
54
|
+
var KEBAB_CASE = /^[a-z][\d\-a-z]*$/u;
|
|
55
|
+
var SNAKE_CASE = /^[a-z][\d_a-z]*$/u;
|
|
56
|
+
var CONSTANT_CASE = /^[A-Z][\d_A-Z]*$/u;
|
|
57
|
+
var JAVASCRIPT_PROTOCOL = /^[\u0000-\u001F ]*j[\t\n\r]*a[\t\n\r]*v[\t\n\r]*a[\t\n\r]*s[\t\n\r]*c[\t\n\r]*r[\t\n\r]*i[\t\n\r]*p[\t\n\r]*t[\t\n\r]*:/iu;
|
|
58
|
+
var JS_IDENTIFIER = /^[_$a-z][\w$]*$/i;
|
|
59
|
+
var REGEXP_STR = /^\/(.+)\/([A-Za-z]*)$/u;
|
|
60
|
+
var ANNOTATION_JSX = /@jsx\s+(\S+)/u;
|
|
61
|
+
var ANNOTATION_JSX_FRAG = /@jsxFrag\s+(\S+)/u;
|
|
62
|
+
var ANNOTATION_JSX_RUNTIME = /@jsxRuntime\s+(\S+)/u;
|
|
63
|
+
var ANNOTATION_JSX_IMPORT_SOURCE = /@jsxImportSource\s+(\S+)/u;
|
|
64
|
+
var COMPONENT_NAME = /^[A-Z]/u;
|
|
65
|
+
var COMPONENT_NAME_LOOSE = /^_?[A-Z]/u;
|
|
66
|
+
var HOOK_NAME = /^use/u;
|
|
35
67
|
function toRegExp(string) {
|
|
36
|
-
const [, pattern, flags = "u"] =
|
|
68
|
+
const [, pattern, flags = "u"] = REGEXP_STR.exec(string) ?? [];
|
|
37
69
|
if (pattern != null) return new RegExp(pattern, flags);
|
|
38
70
|
return { test: (s) => s === string };
|
|
39
71
|
}
|
|
40
72
|
function isRegExp(string) {
|
|
41
|
-
return Boolean(
|
|
73
|
+
return Boolean(REGEXP_STR.test(string));
|
|
42
74
|
}
|
|
43
75
|
|
|
44
76
|
// src/JsxConfig/JsxConfig.ts
|
|
@@ -60,10 +92,10 @@ function getFromAnnotation(context) {
|
|
|
60
92
|
let jsx, jsxFrag, jsxRuntime, jsxImportSource;
|
|
61
93
|
for (const comment of context.sourceCode.getAllComments().reverse()) {
|
|
62
94
|
const value = comment.value;
|
|
63
|
-
jsx ??= value.match(
|
|
64
|
-
jsxFrag ??= value.match(
|
|
65
|
-
jsxRuntime ??= value.match(
|
|
66
|
-
jsxImportSource ??= value.match(
|
|
95
|
+
jsx ??= value.match(ANNOTATION_JSX)?.[1];
|
|
96
|
+
jsxFrag ??= value.match(ANNOTATION_JSX_FRAG)?.[1];
|
|
97
|
+
jsxRuntime ??= value.match(ANNOTATION_JSX_RUNTIME)?.[1];
|
|
98
|
+
jsxImportSource ??= value.match(ANNOTATION_JSX_IMPORT_SOURCE)?.[1];
|
|
67
99
|
}
|
|
68
100
|
const options = make();
|
|
69
101
|
if (jsx != null) options.jsxFactory = jsx;
|
|
@@ -138,29 +170,28 @@ var LanguagePreferenceSchema = valibot.object({
|
|
|
138
170
|
)
|
|
139
171
|
});
|
|
140
172
|
|
|
141
|
-
// src/
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
173
|
+
// src/SEL.ts
|
|
174
|
+
var SEL_exports = {};
|
|
175
|
+
__export(SEL_exports, {
|
|
176
|
+
DISPLAY_NAME_ASSIGNMENT_EXPRESSION: () => DISPLAY_NAME_ASSIGNMENT_EXPRESSION,
|
|
177
|
+
IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION: () => IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION,
|
|
178
|
+
OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR: () => OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR
|
|
179
|
+
});
|
|
180
|
+
var IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION = "ArrowFunctionExpression[body.type!='BlockStatement']";
|
|
181
|
+
var OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR = [
|
|
182
|
+
"VariableDeclarator",
|
|
183
|
+
"[id.type='ObjectPattern']",
|
|
184
|
+
"[init.type='Identifier']"
|
|
185
|
+
].join("");
|
|
186
|
+
var DISPLAY_NAME_ASSIGNMENT_EXPRESSION = [
|
|
187
|
+
"AssignmentExpression",
|
|
188
|
+
"[operator='=']",
|
|
189
|
+
"[left.type='MemberExpression']",
|
|
190
|
+
"[left.property.name='displayName']"
|
|
191
|
+
].join("");
|
|
147
192
|
|
|
148
193
|
exports.JsxConfig = JsxConfig_exports;
|
|
149
194
|
exports.LanguagePreference = LanguagePreference_exports;
|
|
150
|
-
exports.
|
|
151
|
-
exports.
|
|
152
|
-
exports.RE_ANNOTATION_JSX_IMPORT_SOURCE = RE_ANNOTATION_JSX_IMPORT_SOURCE;
|
|
153
|
-
exports.RE_ANNOTATION_JSX_RUNTIME = RE_ANNOTATION_JSX_RUNTIME;
|
|
154
|
-
exports.RE_CAMEL_CASE = RE_CAMEL_CASE;
|
|
155
|
-
exports.RE_CONSTANT_CASE = RE_CONSTANT_CASE;
|
|
156
|
-
exports.RE_JAVASCRIPT_PROTOCOL = RE_JAVASCRIPT_PROTOCOL;
|
|
157
|
-
exports.RE_JS_EXT = RE_JS_EXT;
|
|
158
|
-
exports.RE_JS_IDENTIFIER = RE_JS_IDENTIFIER;
|
|
159
|
-
exports.RE_KEBAB_CASE = RE_KEBAB_CASE;
|
|
160
|
-
exports.RE_PASCAL_CASE = RE_PASCAL_CASE;
|
|
161
|
-
exports.RE_REGEXP_STR = RE_REGEXP_STR;
|
|
162
|
-
exports.RE_SNAKE_CASE = RE_SNAKE_CASE;
|
|
163
|
-
exports.RE_TS_EXT = RE_TS_EXT;
|
|
195
|
+
exports.RE = RE_exports;
|
|
196
|
+
exports.SEL = SEL_exports;
|
|
164
197
|
exports.createReport = createReport;
|
|
165
|
-
exports.isRegExp = isRegExp;
|
|
166
|
-
exports.toRegExp = toRegExp;
|
package/dist/index.mjs
CHANGED
|
@@ -7,6 +7,13 @@ var __export = (target, all) => {
|
|
|
7
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
// src/helpers.ts
|
|
11
|
+
function createReport(context) {
|
|
12
|
+
return (descriptor) => {
|
|
13
|
+
if (descriptor != null) context.report(descriptor);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
10
17
|
// src/JsxConfig/index.ts
|
|
11
18
|
var JsxConfig_exports = {};
|
|
12
19
|
__export(JsxConfig_exports, {
|
|
@@ -15,28 +22,53 @@ __export(JsxConfig_exports, {
|
|
|
15
22
|
make: () => make
|
|
16
23
|
});
|
|
17
24
|
|
|
18
|
-
// src/
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
// src/RE.ts
|
|
26
|
+
var RE_exports = {};
|
|
27
|
+
__export(RE_exports, {
|
|
28
|
+
ANNOTATION_JSX: () => ANNOTATION_JSX,
|
|
29
|
+
ANNOTATION_JSX_FRAG: () => ANNOTATION_JSX_FRAG,
|
|
30
|
+
ANNOTATION_JSX_IMPORT_SOURCE: () => ANNOTATION_JSX_IMPORT_SOURCE,
|
|
31
|
+
ANNOTATION_JSX_RUNTIME: () => ANNOTATION_JSX_RUNTIME,
|
|
32
|
+
CAMEL_CASE: () => CAMEL_CASE,
|
|
33
|
+
COMPONENT_NAME: () => COMPONENT_NAME,
|
|
34
|
+
COMPONENT_NAME_LOOSE: () => COMPONENT_NAME_LOOSE,
|
|
35
|
+
CONSTANT_CASE: () => CONSTANT_CASE,
|
|
36
|
+
HOOK_NAME: () => HOOK_NAME,
|
|
37
|
+
JAVASCRIPT_PROTOCOL: () => JAVASCRIPT_PROTOCOL,
|
|
38
|
+
JS_EXT: () => JS_EXT,
|
|
39
|
+
JS_IDENTIFIER: () => JS_IDENTIFIER,
|
|
40
|
+
KEBAB_CASE: () => KEBAB_CASE,
|
|
41
|
+
PASCAL_CASE: () => PASCAL_CASE,
|
|
42
|
+
REGEXP_STR: () => REGEXP_STR,
|
|
43
|
+
SNAKE_CASE: () => SNAKE_CASE,
|
|
44
|
+
TS_EXT: () => TS_EXT,
|
|
45
|
+
isRegExp: () => isRegExp,
|
|
46
|
+
toRegExp: () => toRegExp
|
|
47
|
+
});
|
|
48
|
+
var TS_EXT = /^[cm]?tsx?$/u;
|
|
49
|
+
var JS_EXT = /^[cm]?jsx?$/u;
|
|
50
|
+
var PASCAL_CASE = /^[A-Z][\dA-Za-z]*$/u;
|
|
51
|
+
var CAMEL_CASE = /^[a-z][\dA-Za-z]*$/u;
|
|
52
|
+
var KEBAB_CASE = /^[a-z][\d\-a-z]*$/u;
|
|
53
|
+
var SNAKE_CASE = /^[a-z][\d_a-z]*$/u;
|
|
54
|
+
var CONSTANT_CASE = /^[A-Z][\d_A-Z]*$/u;
|
|
55
|
+
var JAVASCRIPT_PROTOCOL = /^[\u0000-\u001F ]*j[\t\n\r]*a[\t\n\r]*v[\t\n\r]*a[\t\n\r]*s[\t\n\r]*c[\t\n\r]*r[\t\n\r]*i[\t\n\r]*p[\t\n\r]*t[\t\n\r]*:/iu;
|
|
56
|
+
var JS_IDENTIFIER = /^[_$a-z][\w$]*$/i;
|
|
57
|
+
var REGEXP_STR = /^\/(.+)\/([A-Za-z]*)$/u;
|
|
58
|
+
var ANNOTATION_JSX = /@jsx\s+(\S+)/u;
|
|
59
|
+
var ANNOTATION_JSX_FRAG = /@jsxFrag\s+(\S+)/u;
|
|
60
|
+
var ANNOTATION_JSX_RUNTIME = /@jsxRuntime\s+(\S+)/u;
|
|
61
|
+
var ANNOTATION_JSX_IMPORT_SOURCE = /@jsxImportSource\s+(\S+)/u;
|
|
62
|
+
var COMPONENT_NAME = /^[A-Z]/u;
|
|
63
|
+
var COMPONENT_NAME_LOOSE = /^_?[A-Z]/u;
|
|
64
|
+
var HOOK_NAME = /^use/u;
|
|
33
65
|
function toRegExp(string) {
|
|
34
|
-
const [, pattern, flags = "u"] =
|
|
66
|
+
const [, pattern, flags = "u"] = REGEXP_STR.exec(string) ?? [];
|
|
35
67
|
if (pattern != null) return new RegExp(pattern, flags);
|
|
36
68
|
return { test: (s) => s === string };
|
|
37
69
|
}
|
|
38
70
|
function isRegExp(string) {
|
|
39
|
-
return Boolean(
|
|
71
|
+
return Boolean(REGEXP_STR.test(string));
|
|
40
72
|
}
|
|
41
73
|
|
|
42
74
|
// src/JsxConfig/JsxConfig.ts
|
|
@@ -58,10 +90,10 @@ function getFromAnnotation(context) {
|
|
|
58
90
|
let jsx, jsxFrag, jsxRuntime, jsxImportSource;
|
|
59
91
|
for (const comment of context.sourceCode.getAllComments().reverse()) {
|
|
60
92
|
const value = comment.value;
|
|
61
|
-
jsx ??= value.match(
|
|
62
|
-
jsxFrag ??= value.match(
|
|
63
|
-
jsxRuntime ??= value.match(
|
|
64
|
-
jsxImportSource ??= value.match(
|
|
93
|
+
jsx ??= value.match(ANNOTATION_JSX)?.[1];
|
|
94
|
+
jsxFrag ??= value.match(ANNOTATION_JSX_FRAG)?.[1];
|
|
95
|
+
jsxRuntime ??= value.match(ANNOTATION_JSX_RUNTIME)?.[1];
|
|
96
|
+
jsxImportSource ??= value.match(ANNOTATION_JSX_IMPORT_SOURCE)?.[1];
|
|
65
97
|
}
|
|
66
98
|
const options = make();
|
|
67
99
|
if (jsx != null) options.jsxFactory = jsx;
|
|
@@ -136,11 +168,24 @@ var LanguagePreferenceSchema = object({
|
|
|
136
168
|
)
|
|
137
169
|
});
|
|
138
170
|
|
|
139
|
-
// src/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
171
|
+
// src/SEL.ts
|
|
172
|
+
var SEL_exports = {};
|
|
173
|
+
__export(SEL_exports, {
|
|
174
|
+
DISPLAY_NAME_ASSIGNMENT_EXPRESSION: () => DISPLAY_NAME_ASSIGNMENT_EXPRESSION,
|
|
175
|
+
IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION: () => IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION,
|
|
176
|
+
OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR: () => OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR
|
|
177
|
+
});
|
|
178
|
+
var IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION = "ArrowFunctionExpression[body.type!='BlockStatement']";
|
|
179
|
+
var OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR = [
|
|
180
|
+
"VariableDeclarator",
|
|
181
|
+
"[id.type='ObjectPattern']",
|
|
182
|
+
"[init.type='Identifier']"
|
|
183
|
+
].join("");
|
|
184
|
+
var DISPLAY_NAME_ASSIGNMENT_EXPRESSION = [
|
|
185
|
+
"AssignmentExpression",
|
|
186
|
+
"[operator='=']",
|
|
187
|
+
"[left.type='MemberExpression']",
|
|
188
|
+
"[left.property.name='displayName']"
|
|
189
|
+
].join("");
|
|
145
190
|
|
|
146
|
-
export { JsxConfig_exports as JsxConfig, LanguagePreference_exports as LanguagePreference,
|
|
191
|
+
export { JsxConfig_exports as JsxConfig, LanguagePreference_exports as LanguagePreference, RE_exports as RE, SEL_exports as SEL, createReport };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/kit",
|
|
3
|
-
"version": "1.43.0",
|
|
3
|
+
"version": "1.43.1-next.0",
|
|
4
4
|
"description": "ESLint React's plugin kit for building plugins and rules.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@typescript-eslint/utils": "^8.29.1",
|
|
39
39
|
"ts-pattern": "^5.7.0",
|
|
40
40
|
"valibot": "^1.0.0",
|
|
41
|
-
"@eslint-react/eff": "1.43.0"
|
|
41
|
+
"@eslint-react/eff": "1.43.1-next.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@tsconfig/node22": "^22.0.1",
|