@eslint-react/kit 1.40.4-next.6 → 1.40.4
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 +40 -12
- package/dist/index.d.ts +40 -12
- package/dist/index.js +39 -8
- package/dist/index.mjs +40 -7
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -38,13 +38,43 @@ type RuleFeature = "CFG" | "DBG" | "FIX" | "MOD" | "TSC" | "EXP";
|
|
|
38
38
|
*/
|
|
39
39
|
declare function createReport<MessageID extends string>(context: RuleContext): (descriptor: _ | null | ReportDescriptor<MessageID>) => void;
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Regular expression for matching a `@jsx` annotation comment.
|
|
43
|
+
*/
|
|
44
|
+
declare const RE_JSX_RT_ANNOTATION_JSX: RegExp;
|
|
45
|
+
/**
|
|
46
|
+
* Regular expression for matching a `@jsxFrag` annotation comment.
|
|
47
|
+
*/
|
|
48
|
+
declare const RE_JSX_RT_ANNOTATION_JSX_FRAG: RegExp;
|
|
49
|
+
/**
|
|
50
|
+
* Regular expression for matching a `@jsxRuntime` annotation comment.
|
|
51
|
+
*/
|
|
52
|
+
declare const RE_JSX_RT_ANNOTATION_JSX_RUNTIME: RegExp;
|
|
53
|
+
/**
|
|
54
|
+
* Regular expression for matching a `@jsxImportSource` annotation comment.
|
|
55
|
+
*/
|
|
56
|
+
declare const RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE: RegExp;
|
|
57
|
+
interface JsxRuntimeAnnotation {
|
|
58
|
+
jsx: _ | string;
|
|
59
|
+
jsxFrag: _ | string;
|
|
60
|
+
jsxImportSource: _ | string;
|
|
61
|
+
jsxRuntime: _ | string;
|
|
62
|
+
}
|
|
63
|
+
declare function make$1(): JsxRuntimeAnnotation;
|
|
64
|
+
/**
|
|
65
|
+
* Get the a JsxRuntimeAnnotation object representing the JSX annotations in the file.
|
|
66
|
+
* @param context The RuleContext
|
|
67
|
+
* @returns JsxRuntimeAnnotation
|
|
68
|
+
*/
|
|
69
|
+
declare function getJsxRuntimeAnnotation(context: RuleContext): JsxRuntimeAnnotation;
|
|
70
|
+
|
|
41
71
|
type JsxRuntimeOptions = Pick<CompilerOptions, "reactNamespace" | "jsx" | "jsxFactory" | "jsxFragmentFactory" | "jsxImportSource">;
|
|
42
72
|
/**
|
|
43
73
|
* Get JsxRuntimeOptions from RuleContext
|
|
44
74
|
* @param context The RuleContext
|
|
45
75
|
* @returns JsxRuntimeOptions
|
|
46
76
|
*/
|
|
47
|
-
declare function
|
|
77
|
+
declare function getJsxRuntimeOptions(context: RuleContext): {
|
|
48
78
|
jsx: JsxEmit;
|
|
49
79
|
jsxFactory: string;
|
|
50
80
|
jsxFragmentFactory: string;
|
|
@@ -52,10 +82,16 @@ declare function getJsxRuntimeOptionsFromContext(context: RuleContext): {
|
|
|
52
82
|
reactNamespace: string;
|
|
53
83
|
};
|
|
54
84
|
|
|
85
|
+
type index$1_JsxRuntimeAnnotation = JsxRuntimeAnnotation;
|
|
55
86
|
type index$1_JsxRuntimeOptions = JsxRuntimeOptions;
|
|
56
|
-
declare const index$
|
|
87
|
+
declare const index$1_RE_JSX_RT_ANNOTATION_JSX: typeof RE_JSX_RT_ANNOTATION_JSX;
|
|
88
|
+
declare const index$1_RE_JSX_RT_ANNOTATION_JSX_FRAG: typeof RE_JSX_RT_ANNOTATION_JSX_FRAG;
|
|
89
|
+
declare const index$1_RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE: typeof RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE;
|
|
90
|
+
declare const index$1_RE_JSX_RT_ANNOTATION_JSX_RUNTIME: typeof RE_JSX_RT_ANNOTATION_JSX_RUNTIME;
|
|
91
|
+
declare const index$1_getJsxRuntimeAnnotation: typeof getJsxRuntimeAnnotation;
|
|
92
|
+
declare const index$1_getJsxRuntimeOptions: typeof getJsxRuntimeOptions;
|
|
57
93
|
declare namespace index$1 {
|
|
58
|
-
export { type index$1_JsxRuntimeOptions as JsxRuntimeOptions, index$
|
|
94
|
+
export { type index$1_JsxRuntimeAnnotation as JsxRuntimeAnnotation, type index$1_JsxRuntimeOptions as JsxRuntimeOptions, index$1_RE_JSX_RT_ANNOTATION_JSX as RE_JSX_RT_ANNOTATION_JSX, index$1_RE_JSX_RT_ANNOTATION_JSX_FRAG as RE_JSX_RT_ANNOTATION_JSX_FRAG, index$1_RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE as RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE, index$1_RE_JSX_RT_ANNOTATION_JSX_RUNTIME as RE_JSX_RT_ANNOTATION_JSX_RUNTIME, index$1_getJsxRuntimeAnnotation as getJsxRuntimeAnnotation, index$1_getJsxRuntimeOptions as getJsxRuntimeOptions, make$1 as make };
|
|
59
95
|
}
|
|
60
96
|
|
|
61
97
|
/**
|
|
@@ -131,14 +167,6 @@ declare const RE_SNAKE_CASE: RegExp;
|
|
|
131
167
|
*/
|
|
132
168
|
declare const RE_CONSTANT_CASE: RegExp;
|
|
133
169
|
declare const RE_JAVASCRIPT_PROTOCOL: RegExp;
|
|
134
|
-
/**
|
|
135
|
-
* Regular expression for matching a `@jsx` annotation comment.
|
|
136
|
-
*/
|
|
137
|
-
declare const RE_JSX_ANNOTATION: RegExp;
|
|
138
|
-
/**
|
|
139
|
-
* Regular expression for matching a `@jsxFrag` annotation comment.
|
|
140
|
-
*/
|
|
141
|
-
declare const RE_JSX_FRAG_ANNOTATION: RegExp;
|
|
142
170
|
/**
|
|
143
171
|
* Regular expression for matching a valid JavaScript identifier.
|
|
144
172
|
*/
|
|
@@ -165,4 +193,4 @@ declare function toRegExp(string: string): {
|
|
|
165
193
|
*/
|
|
166
194
|
declare function isRegExp(string: string): boolean;
|
|
167
195
|
|
|
168
|
-
export { index$1 as JsxRuntime, index as LanguagePreference, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL,
|
|
196
|
+
export { index$1 as JsxRuntime, index as LanguagePreference, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_JS_EXT, RE_JS_IDENTIFIER, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_REGEXP_STR, RE_SNAKE_CASE, RE_TS_EXT, type RuleContext, type RuleDeclaration, type RuleFeature, type RulePreset, type RuleSeverity, createReport, isRegExp, toRegExp };
|
package/dist/index.d.ts
CHANGED
|
@@ -38,13 +38,43 @@ type RuleFeature = "CFG" | "DBG" | "FIX" | "MOD" | "TSC" | "EXP";
|
|
|
38
38
|
*/
|
|
39
39
|
declare function createReport<MessageID extends string>(context: RuleContext): (descriptor: _ | null | ReportDescriptor<MessageID>) => void;
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Regular expression for matching a `@jsx` annotation comment.
|
|
43
|
+
*/
|
|
44
|
+
declare const RE_JSX_RT_ANNOTATION_JSX: RegExp;
|
|
45
|
+
/**
|
|
46
|
+
* Regular expression for matching a `@jsxFrag` annotation comment.
|
|
47
|
+
*/
|
|
48
|
+
declare const RE_JSX_RT_ANNOTATION_JSX_FRAG: RegExp;
|
|
49
|
+
/**
|
|
50
|
+
* Regular expression for matching a `@jsxRuntime` annotation comment.
|
|
51
|
+
*/
|
|
52
|
+
declare const RE_JSX_RT_ANNOTATION_JSX_RUNTIME: RegExp;
|
|
53
|
+
/**
|
|
54
|
+
* Regular expression for matching a `@jsxImportSource` annotation comment.
|
|
55
|
+
*/
|
|
56
|
+
declare const RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE: RegExp;
|
|
57
|
+
interface JsxRuntimeAnnotation {
|
|
58
|
+
jsx: _ | string;
|
|
59
|
+
jsxFrag: _ | string;
|
|
60
|
+
jsxImportSource: _ | string;
|
|
61
|
+
jsxRuntime: _ | string;
|
|
62
|
+
}
|
|
63
|
+
declare function make$1(): JsxRuntimeAnnotation;
|
|
64
|
+
/**
|
|
65
|
+
* Get the a JsxRuntimeAnnotation object representing the JSX annotations in the file.
|
|
66
|
+
* @param context The RuleContext
|
|
67
|
+
* @returns JsxRuntimeAnnotation
|
|
68
|
+
*/
|
|
69
|
+
declare function getJsxRuntimeAnnotation(context: RuleContext): JsxRuntimeAnnotation;
|
|
70
|
+
|
|
41
71
|
type JsxRuntimeOptions = Pick<CompilerOptions, "reactNamespace" | "jsx" | "jsxFactory" | "jsxFragmentFactory" | "jsxImportSource">;
|
|
42
72
|
/**
|
|
43
73
|
* Get JsxRuntimeOptions from RuleContext
|
|
44
74
|
* @param context The RuleContext
|
|
45
75
|
* @returns JsxRuntimeOptions
|
|
46
76
|
*/
|
|
47
|
-
declare function
|
|
77
|
+
declare function getJsxRuntimeOptions(context: RuleContext): {
|
|
48
78
|
jsx: JsxEmit;
|
|
49
79
|
jsxFactory: string;
|
|
50
80
|
jsxFragmentFactory: string;
|
|
@@ -52,10 +82,16 @@ declare function getJsxRuntimeOptionsFromContext(context: RuleContext): {
|
|
|
52
82
|
reactNamespace: string;
|
|
53
83
|
};
|
|
54
84
|
|
|
85
|
+
type index$1_JsxRuntimeAnnotation = JsxRuntimeAnnotation;
|
|
55
86
|
type index$1_JsxRuntimeOptions = JsxRuntimeOptions;
|
|
56
|
-
declare const index$
|
|
87
|
+
declare const index$1_RE_JSX_RT_ANNOTATION_JSX: typeof RE_JSX_RT_ANNOTATION_JSX;
|
|
88
|
+
declare const index$1_RE_JSX_RT_ANNOTATION_JSX_FRAG: typeof RE_JSX_RT_ANNOTATION_JSX_FRAG;
|
|
89
|
+
declare const index$1_RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE: typeof RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE;
|
|
90
|
+
declare const index$1_RE_JSX_RT_ANNOTATION_JSX_RUNTIME: typeof RE_JSX_RT_ANNOTATION_JSX_RUNTIME;
|
|
91
|
+
declare const index$1_getJsxRuntimeAnnotation: typeof getJsxRuntimeAnnotation;
|
|
92
|
+
declare const index$1_getJsxRuntimeOptions: typeof getJsxRuntimeOptions;
|
|
57
93
|
declare namespace index$1 {
|
|
58
|
-
export { type index$1_JsxRuntimeOptions as JsxRuntimeOptions, index$
|
|
94
|
+
export { type index$1_JsxRuntimeAnnotation as JsxRuntimeAnnotation, type index$1_JsxRuntimeOptions as JsxRuntimeOptions, index$1_RE_JSX_RT_ANNOTATION_JSX as RE_JSX_RT_ANNOTATION_JSX, index$1_RE_JSX_RT_ANNOTATION_JSX_FRAG as RE_JSX_RT_ANNOTATION_JSX_FRAG, index$1_RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE as RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE, index$1_RE_JSX_RT_ANNOTATION_JSX_RUNTIME as RE_JSX_RT_ANNOTATION_JSX_RUNTIME, index$1_getJsxRuntimeAnnotation as getJsxRuntimeAnnotation, index$1_getJsxRuntimeOptions as getJsxRuntimeOptions, make$1 as make };
|
|
59
95
|
}
|
|
60
96
|
|
|
61
97
|
/**
|
|
@@ -131,14 +167,6 @@ declare const RE_SNAKE_CASE: RegExp;
|
|
|
131
167
|
*/
|
|
132
168
|
declare const RE_CONSTANT_CASE: RegExp;
|
|
133
169
|
declare const RE_JAVASCRIPT_PROTOCOL: RegExp;
|
|
134
|
-
/**
|
|
135
|
-
* Regular expression for matching a `@jsx` annotation comment.
|
|
136
|
-
*/
|
|
137
|
-
declare const RE_JSX_ANNOTATION: RegExp;
|
|
138
|
-
/**
|
|
139
|
-
* Regular expression for matching a `@jsxFrag` annotation comment.
|
|
140
|
-
*/
|
|
141
|
-
declare const RE_JSX_FRAG_ANNOTATION: RegExp;
|
|
142
170
|
/**
|
|
143
171
|
* Regular expression for matching a valid JavaScript identifier.
|
|
144
172
|
*/
|
|
@@ -165,4 +193,4 @@ declare function toRegExp(string: string): {
|
|
|
165
193
|
*/
|
|
166
194
|
declare function isRegExp(string: string): boolean;
|
|
167
195
|
|
|
168
|
-
export { index$1 as JsxRuntime, index as LanguagePreference, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL,
|
|
196
|
+
export { index$1 as JsxRuntime, index as LanguagePreference, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_JS_EXT, RE_JS_IDENTIFIER, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_REGEXP_STR, RE_SNAKE_CASE, RE_TS_EXT, type RuleContext, type RuleDeclaration, type RuleFeature, type RulePreset, type RuleSeverity, createReport, isRegExp, toRegExp };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var eff = require('@eslint-react/eff');
|
|
3
4
|
var typescript = require('typescript');
|
|
4
5
|
var valibot = require('valibot');
|
|
5
6
|
|
|
@@ -12,9 +13,43 @@ var __export = (target, all) => {
|
|
|
12
13
|
// src/JsxRuntime/index.ts
|
|
13
14
|
var JsxRuntime_exports = {};
|
|
14
15
|
__export(JsxRuntime_exports, {
|
|
15
|
-
|
|
16
|
+
RE_JSX_RT_ANNOTATION_JSX: () => RE_JSX_RT_ANNOTATION_JSX,
|
|
17
|
+
RE_JSX_RT_ANNOTATION_JSX_FRAG: () => RE_JSX_RT_ANNOTATION_JSX_FRAG,
|
|
18
|
+
RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE: () => RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE,
|
|
19
|
+
RE_JSX_RT_ANNOTATION_JSX_RUNTIME: () => RE_JSX_RT_ANNOTATION_JSX_RUNTIME,
|
|
20
|
+
getJsxRuntimeAnnotation: () => getJsxRuntimeAnnotation,
|
|
21
|
+
getJsxRuntimeOptions: () => getJsxRuntimeOptions,
|
|
22
|
+
make: () => make
|
|
16
23
|
});
|
|
17
|
-
|
|
24
|
+
var RE_JSX_RT_ANNOTATION_JSX = /@jsx\s+(\S+)/u;
|
|
25
|
+
var RE_JSX_RT_ANNOTATION_JSX_FRAG = /@jsxFrag\s+(\S+)/u;
|
|
26
|
+
var RE_JSX_RT_ANNOTATION_JSX_RUNTIME = /@jsxRuntime\s+(\S+)/u;
|
|
27
|
+
var RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE = /@jsxImportSource\s+(\S+)/u;
|
|
28
|
+
function make() {
|
|
29
|
+
return {
|
|
30
|
+
jsx: eff._,
|
|
31
|
+
jsxFrag: eff._,
|
|
32
|
+
jsxImportSource: eff._,
|
|
33
|
+
jsxRuntime: eff._
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function getJsxRuntimeAnnotation(context) {
|
|
37
|
+
const JsxRuntimeAnnotation = make();
|
|
38
|
+
if (!context.sourceCode.text.includes("@jsx")) return JsxRuntimeAnnotation;
|
|
39
|
+
const allComments = context.sourceCode.getAllComments();
|
|
40
|
+
for (const comment of allComments) {
|
|
41
|
+
const jsx = comment.value.match(RE_JSX_RT_ANNOTATION_JSX);
|
|
42
|
+
const jsxFrag = comment.value.match(RE_JSX_RT_ANNOTATION_JSX_FRAG);
|
|
43
|
+
const jsxRuntime = comment.value.match(RE_JSX_RT_ANNOTATION_JSX_RUNTIME);
|
|
44
|
+
const jsxImportSource = comment.value.match(RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE);
|
|
45
|
+
JsxRuntimeAnnotation.jsx = jsx?.[1];
|
|
46
|
+
JsxRuntimeAnnotation.jsxFrag = jsxFrag?.[1];
|
|
47
|
+
JsxRuntimeAnnotation.jsxRuntime = jsxRuntime?.[1];
|
|
48
|
+
JsxRuntimeAnnotation.jsxImportSource = jsxImportSource?.[1];
|
|
49
|
+
}
|
|
50
|
+
return JsxRuntimeAnnotation;
|
|
51
|
+
}
|
|
52
|
+
function getJsxRuntimeOptions(context) {
|
|
18
53
|
const options = context.sourceCode.parserServices?.program?.getCompilerOptions() ?? {};
|
|
19
54
|
return {
|
|
20
55
|
jsx: options.jsx ?? typescript.JsxEmit.ReactJSX,
|
|
@@ -30,7 +65,7 @@ var LanguagePreference_exports = {};
|
|
|
30
65
|
__export(LanguagePreference_exports, {
|
|
31
66
|
DEFAULT_LANGUAGE_PREFERENCE: () => DEFAULT_LANGUAGE_PREFERENCE,
|
|
32
67
|
LanguagePreferenceSchema: () => LanguagePreferenceSchema,
|
|
33
|
-
make: () =>
|
|
68
|
+
make: () => make2
|
|
34
69
|
});
|
|
35
70
|
var DEFAULT_LANGUAGE_PREFERENCE = {
|
|
36
71
|
indentStyle: "space",
|
|
@@ -40,7 +75,7 @@ var DEFAULT_LANGUAGE_PREFERENCE = {
|
|
|
40
75
|
semicolons: "always",
|
|
41
76
|
trailingCommas: "all"
|
|
42
77
|
};
|
|
43
|
-
function
|
|
78
|
+
function make2() {
|
|
44
79
|
return {
|
|
45
80
|
...DEFAULT_LANGUAGE_PREFERENCE
|
|
46
81
|
};
|
|
@@ -95,8 +130,6 @@ var RE_KEBAB_CASE = /^[a-z][\d\-a-z]*$/u;
|
|
|
95
130
|
var RE_SNAKE_CASE = /^[a-z][\d_a-z]*$/u;
|
|
96
131
|
var RE_CONSTANT_CASE = /^[A-Z][\d_A-Z]*$/u;
|
|
97
132
|
var RE_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;
|
|
98
|
-
var RE_JSX_ANNOTATION = /@jsx\s+(\S+)/u;
|
|
99
|
-
var RE_JSX_FRAG_ANNOTATION = /@jsxFrag\s+(\S+)/u;
|
|
100
133
|
var RE_JS_IDENTIFIER = /^[_$a-z][\w$]*$/i;
|
|
101
134
|
var RE_REGEXP_STR = /^\/(.+)\/([A-Za-z]*)$/u;
|
|
102
135
|
function toRegExp(string) {
|
|
@@ -120,8 +153,6 @@ exports.LanguagePreference = LanguagePreference_exports;
|
|
|
120
153
|
exports.RE_CAMEL_CASE = RE_CAMEL_CASE;
|
|
121
154
|
exports.RE_CONSTANT_CASE = RE_CONSTANT_CASE;
|
|
122
155
|
exports.RE_JAVASCRIPT_PROTOCOL = RE_JAVASCRIPT_PROTOCOL;
|
|
123
|
-
exports.RE_JSX_ANNOTATION = RE_JSX_ANNOTATION;
|
|
124
|
-
exports.RE_JSX_FRAG_ANNOTATION = RE_JSX_FRAG_ANNOTATION;
|
|
125
156
|
exports.RE_JS_EXT = RE_JS_EXT;
|
|
126
157
|
exports.RE_JS_IDENTIFIER = RE_JS_IDENTIFIER;
|
|
127
158
|
exports.RE_KEBAB_CASE = RE_KEBAB_CASE;
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _ } from '@eslint-react/eff';
|
|
1
2
|
import { JsxEmit } from 'typescript';
|
|
2
3
|
import { object, optional, union, literal, number } from 'valibot';
|
|
3
4
|
|
|
@@ -10,9 +11,43 @@ var __export = (target, all) => {
|
|
|
10
11
|
// src/JsxRuntime/index.ts
|
|
11
12
|
var JsxRuntime_exports = {};
|
|
12
13
|
__export(JsxRuntime_exports, {
|
|
13
|
-
|
|
14
|
+
RE_JSX_RT_ANNOTATION_JSX: () => RE_JSX_RT_ANNOTATION_JSX,
|
|
15
|
+
RE_JSX_RT_ANNOTATION_JSX_FRAG: () => RE_JSX_RT_ANNOTATION_JSX_FRAG,
|
|
16
|
+
RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE: () => RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE,
|
|
17
|
+
RE_JSX_RT_ANNOTATION_JSX_RUNTIME: () => RE_JSX_RT_ANNOTATION_JSX_RUNTIME,
|
|
18
|
+
getJsxRuntimeAnnotation: () => getJsxRuntimeAnnotation,
|
|
19
|
+
getJsxRuntimeOptions: () => getJsxRuntimeOptions,
|
|
20
|
+
make: () => make
|
|
14
21
|
});
|
|
15
|
-
|
|
22
|
+
var RE_JSX_RT_ANNOTATION_JSX = /@jsx\s+(\S+)/u;
|
|
23
|
+
var RE_JSX_RT_ANNOTATION_JSX_FRAG = /@jsxFrag\s+(\S+)/u;
|
|
24
|
+
var RE_JSX_RT_ANNOTATION_JSX_RUNTIME = /@jsxRuntime\s+(\S+)/u;
|
|
25
|
+
var RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE = /@jsxImportSource\s+(\S+)/u;
|
|
26
|
+
function make() {
|
|
27
|
+
return {
|
|
28
|
+
jsx: _,
|
|
29
|
+
jsxFrag: _,
|
|
30
|
+
jsxImportSource: _,
|
|
31
|
+
jsxRuntime: _
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function getJsxRuntimeAnnotation(context) {
|
|
35
|
+
const JsxRuntimeAnnotation = make();
|
|
36
|
+
if (!context.sourceCode.text.includes("@jsx")) return JsxRuntimeAnnotation;
|
|
37
|
+
const allComments = context.sourceCode.getAllComments();
|
|
38
|
+
for (const comment of allComments) {
|
|
39
|
+
const jsx = comment.value.match(RE_JSX_RT_ANNOTATION_JSX);
|
|
40
|
+
const jsxFrag = comment.value.match(RE_JSX_RT_ANNOTATION_JSX_FRAG);
|
|
41
|
+
const jsxRuntime = comment.value.match(RE_JSX_RT_ANNOTATION_JSX_RUNTIME);
|
|
42
|
+
const jsxImportSource = comment.value.match(RE_JSX_RT_ANNOTATION_JSX_IMPORT_SOURCE);
|
|
43
|
+
JsxRuntimeAnnotation.jsx = jsx?.[1];
|
|
44
|
+
JsxRuntimeAnnotation.jsxFrag = jsxFrag?.[1];
|
|
45
|
+
JsxRuntimeAnnotation.jsxRuntime = jsxRuntime?.[1];
|
|
46
|
+
JsxRuntimeAnnotation.jsxImportSource = jsxImportSource?.[1];
|
|
47
|
+
}
|
|
48
|
+
return JsxRuntimeAnnotation;
|
|
49
|
+
}
|
|
50
|
+
function getJsxRuntimeOptions(context) {
|
|
16
51
|
const options = context.sourceCode.parserServices?.program?.getCompilerOptions() ?? {};
|
|
17
52
|
return {
|
|
18
53
|
jsx: options.jsx ?? JsxEmit.ReactJSX,
|
|
@@ -28,7 +63,7 @@ var LanguagePreference_exports = {};
|
|
|
28
63
|
__export(LanguagePreference_exports, {
|
|
29
64
|
DEFAULT_LANGUAGE_PREFERENCE: () => DEFAULT_LANGUAGE_PREFERENCE,
|
|
30
65
|
LanguagePreferenceSchema: () => LanguagePreferenceSchema,
|
|
31
|
-
make: () =>
|
|
66
|
+
make: () => make2
|
|
32
67
|
});
|
|
33
68
|
var DEFAULT_LANGUAGE_PREFERENCE = {
|
|
34
69
|
indentStyle: "space",
|
|
@@ -38,7 +73,7 @@ var DEFAULT_LANGUAGE_PREFERENCE = {
|
|
|
38
73
|
semicolons: "always",
|
|
39
74
|
trailingCommas: "all"
|
|
40
75
|
};
|
|
41
|
-
function
|
|
76
|
+
function make2() {
|
|
42
77
|
return {
|
|
43
78
|
...DEFAULT_LANGUAGE_PREFERENCE
|
|
44
79
|
};
|
|
@@ -93,8 +128,6 @@ var RE_KEBAB_CASE = /^[a-z][\d\-a-z]*$/u;
|
|
|
93
128
|
var RE_SNAKE_CASE = /^[a-z][\d_a-z]*$/u;
|
|
94
129
|
var RE_CONSTANT_CASE = /^[A-Z][\d_A-Z]*$/u;
|
|
95
130
|
var RE_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;
|
|
96
|
-
var RE_JSX_ANNOTATION = /@jsx\s+(\S+)/u;
|
|
97
|
-
var RE_JSX_FRAG_ANNOTATION = /@jsxFrag\s+(\S+)/u;
|
|
98
131
|
var RE_JS_IDENTIFIER = /^[_$a-z][\w$]*$/i;
|
|
99
132
|
var RE_REGEXP_STR = /^\/(.+)\/([A-Za-z]*)$/u;
|
|
100
133
|
function toRegExp(string) {
|
|
@@ -113,4 +146,4 @@ function createReport(context) {
|
|
|
113
146
|
};
|
|
114
147
|
}
|
|
115
148
|
|
|
116
|
-
export { JsxRuntime_exports as JsxRuntime, LanguagePreference_exports as LanguagePreference, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL,
|
|
149
|
+
export { JsxRuntime_exports as JsxRuntime, LanguagePreference_exports as LanguagePreference, RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_JAVASCRIPT_PROTOCOL, RE_JS_EXT, RE_JS_IDENTIFIER, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_REGEXP_STR, RE_SNAKE_CASE, RE_TS_EXT, createReport, isRegExp, toRegExp };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/kit",
|
|
3
|
-
"version": "1.40.4
|
|
3
|
+
"version": "1.40.4",
|
|
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.0",
|
|
39
39
|
"ts-pattern": "^5.7.0",
|
|
40
40
|
"valibot": "^1.0.0",
|
|
41
|
-
"@eslint-react/eff": "1.40.4
|
|
41
|
+
"@eslint-react/eff": "1.40.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@tsconfig/node22": "^22.0.1",
|