@eslint-react/kit 1.40.0-next.1 → 1.40.0-next.2
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 +9 -18
- package/dist/index.d.ts +9 -18
- package/dist/index.js +7 -18
- package/dist/index.mjs +7 -18
- package/package.json +2 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ } from '@eslint-react/eff';
|
|
2
2
|
import * as tseslint from '@typescript-eslint/utils/ts-eslint';
|
|
3
3
|
import { ReportDescriptor } from '@typescript-eslint/utils/ts-eslint';
|
|
4
|
-
import {
|
|
4
|
+
import { CompilerOptions, JsxEmit } from 'typescript';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Rule severity.
|
|
@@ -36,22 +36,14 @@ type RuleFeature = "CFG" | "DBG" | "FIX" | "MOD" | "TSC" | "EXP";
|
|
|
36
36
|
*/
|
|
37
37
|
declare function createReport<MessageID extends string>(context: RuleContext): (descriptor: _ | null | ReportDescriptor<MessageID>) => void;
|
|
38
38
|
|
|
39
|
-
type JsxRuntimeOptions = Pick<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
readonly reactNamespace: "React";
|
|
46
|
-
};
|
|
39
|
+
type JsxRuntimeOptions = Pick<CompilerOptions, "reactNamespace" | "jsx" | "jsxFactory" | "jsxFragmentFactory" | "jsxImportSource">;
|
|
40
|
+
/**
|
|
41
|
+
* Get JsxRuntimeOptions from RuleContext
|
|
42
|
+
* @param context The RuleContext
|
|
43
|
+
* @returns JsxRuntimeOptions
|
|
44
|
+
*/
|
|
47
45
|
declare function getJsxRuntimeOptionsFromContext(context: RuleContext): {
|
|
48
|
-
|
|
49
|
-
readonly jsxFactory: "React.createElement";
|
|
50
|
-
readonly jsxFragmentFactory: "React.Fragment";
|
|
51
|
-
readonly jsxImportSource: "react";
|
|
52
|
-
readonly reactNamespace: "React";
|
|
53
|
-
} | {
|
|
54
|
-
jsx: TsConfigJson.CompilerOptions.JSX;
|
|
46
|
+
jsx: JsxEmit;
|
|
55
47
|
jsxFactory: string;
|
|
56
48
|
jsxFragmentFactory: string;
|
|
57
49
|
jsxImportSource: string;
|
|
@@ -59,10 +51,9 @@ declare function getJsxRuntimeOptionsFromContext(context: RuleContext): {
|
|
|
59
51
|
};
|
|
60
52
|
|
|
61
53
|
type index_JsxRuntimeOptions = JsxRuntimeOptions;
|
|
62
|
-
declare const index_defaultJsxRuntimeOptions: typeof defaultJsxRuntimeOptions;
|
|
63
54
|
declare const index_getJsxRuntimeOptionsFromContext: typeof getJsxRuntimeOptionsFromContext;
|
|
64
55
|
declare namespace index {
|
|
65
|
-
export { type index_JsxRuntimeOptions as JsxRuntimeOptions,
|
|
56
|
+
export { type index_JsxRuntimeOptions as JsxRuntimeOptions, index_getJsxRuntimeOptionsFromContext as getJsxRuntimeOptionsFromContext };
|
|
66
57
|
}
|
|
67
58
|
|
|
68
59
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ } from '@eslint-react/eff';
|
|
2
2
|
import * as tseslint from '@typescript-eslint/utils/ts-eslint';
|
|
3
3
|
import { ReportDescriptor } from '@typescript-eslint/utils/ts-eslint';
|
|
4
|
-
import {
|
|
4
|
+
import { CompilerOptions, JsxEmit } from 'typescript';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Rule severity.
|
|
@@ -36,22 +36,14 @@ type RuleFeature = "CFG" | "DBG" | "FIX" | "MOD" | "TSC" | "EXP";
|
|
|
36
36
|
*/
|
|
37
37
|
declare function createReport<MessageID extends string>(context: RuleContext): (descriptor: _ | null | ReportDescriptor<MessageID>) => void;
|
|
38
38
|
|
|
39
|
-
type JsxRuntimeOptions = Pick<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
readonly reactNamespace: "React";
|
|
46
|
-
};
|
|
39
|
+
type JsxRuntimeOptions = Pick<CompilerOptions, "reactNamespace" | "jsx" | "jsxFactory" | "jsxFragmentFactory" | "jsxImportSource">;
|
|
40
|
+
/**
|
|
41
|
+
* Get JsxRuntimeOptions from RuleContext
|
|
42
|
+
* @param context The RuleContext
|
|
43
|
+
* @returns JsxRuntimeOptions
|
|
44
|
+
*/
|
|
47
45
|
declare function getJsxRuntimeOptionsFromContext(context: RuleContext): {
|
|
48
|
-
|
|
49
|
-
readonly jsxFactory: "React.createElement";
|
|
50
|
-
readonly jsxFragmentFactory: "React.Fragment";
|
|
51
|
-
readonly jsxImportSource: "react";
|
|
52
|
-
readonly reactNamespace: "React";
|
|
53
|
-
} | {
|
|
54
|
-
jsx: TsConfigJson.CompilerOptions.JSX;
|
|
46
|
+
jsx: JsxEmit;
|
|
55
47
|
jsxFactory: string;
|
|
56
48
|
jsxFragmentFactory: string;
|
|
57
49
|
jsxImportSource: string;
|
|
@@ -59,10 +51,9 @@ declare function getJsxRuntimeOptionsFromContext(context: RuleContext): {
|
|
|
59
51
|
};
|
|
60
52
|
|
|
61
53
|
type index_JsxRuntimeOptions = JsxRuntimeOptions;
|
|
62
|
-
declare const index_defaultJsxRuntimeOptions: typeof defaultJsxRuntimeOptions;
|
|
63
54
|
declare const index_getJsxRuntimeOptionsFromContext: typeof getJsxRuntimeOptionsFromContext;
|
|
64
55
|
declare namespace index {
|
|
65
|
-
export { type index_JsxRuntimeOptions as JsxRuntimeOptions,
|
|
56
|
+
export { type index_JsxRuntimeOptions as JsxRuntimeOptions, index_getJsxRuntimeOptionsFromContext as getJsxRuntimeOptionsFromContext };
|
|
66
57
|
}
|
|
67
58
|
|
|
68
59
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var typescript = require('typescript');
|
|
4
4
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __export = (target, all) => {
|
|
@@ -11,27 +11,16 @@ var __export = (target, all) => {
|
|
|
11
11
|
// src/JsxRuntime/index.ts
|
|
12
12
|
var JsxRuntime_exports = {};
|
|
13
13
|
__export(JsxRuntime_exports, {
|
|
14
|
-
defaultJsxRuntimeOptions: () => defaultJsxRuntimeOptions,
|
|
15
14
|
getJsxRuntimeOptionsFromContext: () => getJsxRuntimeOptionsFromContext
|
|
16
15
|
});
|
|
17
|
-
var defaultJsxRuntimeOptions = {
|
|
18
|
-
jsx: "react-jsx",
|
|
19
|
-
jsxFactory: "React.createElement",
|
|
20
|
-
jsxFragmentFactory: "React.Fragment",
|
|
21
|
-
jsxImportSource: "react",
|
|
22
|
-
reactNamespace: "React"
|
|
23
|
-
};
|
|
24
|
-
var tsconfigCache = /* @__PURE__ */ new Map();
|
|
25
16
|
function getJsxRuntimeOptionsFromContext(context) {
|
|
26
|
-
const
|
|
27
|
-
const compilerOptions = tsconfigResult?.config.compilerOptions;
|
|
28
|
-
if (compilerOptions == null) return defaultJsxRuntimeOptions;
|
|
17
|
+
const options = context.sourceCode.parserServices?.program?.getCompilerOptions() ?? {};
|
|
29
18
|
return {
|
|
30
|
-
jsx:
|
|
31
|
-
jsxFactory:
|
|
32
|
-
jsxFragmentFactory:
|
|
33
|
-
jsxImportSource:
|
|
34
|
-
reactNamespace:
|
|
19
|
+
jsx: options.jsx ?? typescript.JsxEmit.ReactJSX,
|
|
20
|
+
jsxFactory: options.jsxFactory ?? "React.createElement",
|
|
21
|
+
jsxFragmentFactory: options.jsxFragmentFactory ?? "React.Fragment",
|
|
22
|
+
jsxImportSource: options.jsxImportSource ?? "react",
|
|
23
|
+
reactNamespace: options.reactNamespace ?? "React"
|
|
35
24
|
};
|
|
36
25
|
}
|
|
37
26
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JsxEmit } from 'typescript';
|
|
2
2
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __export = (target, all) => {
|
|
@@ -9,27 +9,16 @@ var __export = (target, all) => {
|
|
|
9
9
|
// src/JsxRuntime/index.ts
|
|
10
10
|
var JsxRuntime_exports = {};
|
|
11
11
|
__export(JsxRuntime_exports, {
|
|
12
|
-
defaultJsxRuntimeOptions: () => defaultJsxRuntimeOptions,
|
|
13
12
|
getJsxRuntimeOptionsFromContext: () => getJsxRuntimeOptionsFromContext
|
|
14
13
|
});
|
|
15
|
-
var defaultJsxRuntimeOptions = {
|
|
16
|
-
jsx: "react-jsx",
|
|
17
|
-
jsxFactory: "React.createElement",
|
|
18
|
-
jsxFragmentFactory: "React.Fragment",
|
|
19
|
-
jsxImportSource: "react",
|
|
20
|
-
reactNamespace: "React"
|
|
21
|
-
};
|
|
22
|
-
var tsconfigCache = /* @__PURE__ */ new Map();
|
|
23
14
|
function getJsxRuntimeOptionsFromContext(context) {
|
|
24
|
-
const
|
|
25
|
-
const compilerOptions = tsconfigResult?.config.compilerOptions;
|
|
26
|
-
if (compilerOptions == null) return defaultJsxRuntimeOptions;
|
|
15
|
+
const options = context.sourceCode.parserServices?.program?.getCompilerOptions() ?? {};
|
|
27
16
|
return {
|
|
28
|
-
jsx:
|
|
29
|
-
jsxFactory:
|
|
30
|
-
jsxFragmentFactory:
|
|
31
|
-
jsxImportSource:
|
|
32
|
-
reactNamespace:
|
|
17
|
+
jsx: options.jsx ?? JsxEmit.ReactJSX,
|
|
18
|
+
jsxFactory: options.jsxFactory ?? "React.createElement",
|
|
19
|
+
jsxFragmentFactory: options.jsxFragmentFactory ?? "React.Fragment",
|
|
20
|
+
jsxImportSource: options.jsxImportSource ?? "react",
|
|
21
|
+
reactNamespace: options.reactNamespace ?? "React"
|
|
33
22
|
};
|
|
34
23
|
}
|
|
35
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/kit",
|
|
3
|
-
"version": "1.40.0-next.
|
|
3
|
+
"version": "1.40.0-next.2",
|
|
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": {
|
|
@@ -36,9 +36,8 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@typescript-eslint/utils": "^8.29.0",
|
|
39
|
-
"get-tsconfig": "^4.10.0",
|
|
40
39
|
"ts-pattern": "^5.7.0",
|
|
41
|
-
"@eslint-react/eff": "1.40.0-next.
|
|
40
|
+
"@eslint-react/eff": "1.40.0-next.2"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
43
|
"@tsconfig/node22": "^22.0.1",
|