eslint-plugin-react-debug 1.40.5-next.1 → 1.41.0-beta.1
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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +63 -6
- package/dist/index.mjs +63 -6
- package/package.json +8 -8
package/dist/index.d.mts
CHANGED
|
@@ -15,6 +15,7 @@ declare const _default: {
|
|
|
15
15
|
readonly "function-component": _typescript_eslint_utils_ts_eslint.RuleModule<"functionComponent", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
16
16
|
readonly hook: _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
17
17
|
readonly "is-from-react": _typescript_eslint_utils_ts_eslint.RuleModule<"isFromReact", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
18
|
+
readonly jsx: _typescript_eslint_utils_ts_eslint.RuleModule<"jsx", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
18
19
|
readonly "react-hooks": _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
19
20
|
};
|
|
20
21
|
};
|
|
@@ -36,6 +37,7 @@ declare const _default: {
|
|
|
36
37
|
readonly "function-component": _typescript_eslint_utils_ts_eslint.RuleModule<"functionComponent", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
37
38
|
readonly hook: _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
38
39
|
readonly "is-from-react": _typescript_eslint_utils_ts_eslint.RuleModule<"isFromReact", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
40
|
+
readonly jsx: _typescript_eslint_utils_ts_eslint.RuleModule<"jsx", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
39
41
|
readonly "react-hooks": _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
40
42
|
};
|
|
41
43
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ declare const _default: {
|
|
|
15
15
|
readonly "function-component": _typescript_eslint_utils_ts_eslint.RuleModule<"functionComponent", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
16
16
|
readonly hook: _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
17
17
|
readonly "is-from-react": _typescript_eslint_utils_ts_eslint.RuleModule<"isFromReact", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
18
|
+
readonly jsx: _typescript_eslint_utils_ts_eslint.RuleModule<"jsx", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
18
19
|
readonly "react-hooks": _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
19
20
|
};
|
|
20
21
|
};
|
|
@@ -36,6 +37,7 @@ declare const _default: {
|
|
|
36
37
|
readonly "function-component": _typescript_eslint_utils_ts_eslint.RuleModule<"functionComponent", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
37
38
|
readonly hook: _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
38
39
|
readonly "is-from-react": _typescript_eslint_utils_ts_eslint.RuleModule<"isFromReact", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
40
|
+
readonly jsx: _typescript_eslint_utils_ts_eslint.RuleModule<"jsx", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
39
41
|
readonly "react-hooks": _typescript_eslint_utils_ts_eslint.RuleModule<"hook", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
|
|
40
42
|
};
|
|
41
43
|
};
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
var shared = require('@eslint-react/shared');
|
|
4
4
|
var ER2 = require('@eslint-react/core');
|
|
5
5
|
var utils = require('@typescript-eslint/utils');
|
|
6
|
+
var kit = require('@eslint-react/kit');
|
|
7
|
+
var tsPattern = require('ts-pattern');
|
|
8
|
+
var typescript = require('typescript');
|
|
6
9
|
|
|
7
10
|
function _interopNamespace(e) {
|
|
8
11
|
if (e && e.__esModule) return e;
|
|
@@ -42,7 +45,8 @@ var rules = {
|
|
|
42
45
|
"react-debug/class-component": "warn",
|
|
43
46
|
"react-debug/function-component": "warn",
|
|
44
47
|
"react-debug/hook": "warn",
|
|
45
|
-
"react-debug/is-from-react": "
|
|
48
|
+
"react-debug/is-from-react": "warn",
|
|
49
|
+
"react-debug/jsx": "warn"
|
|
46
50
|
};
|
|
47
51
|
var settings = {
|
|
48
52
|
"react-x": shared.DEFAULT_ESLINT_REACT_SETTINGS
|
|
@@ -50,7 +54,7 @@ var settings = {
|
|
|
50
54
|
|
|
51
55
|
// package.json
|
|
52
56
|
var name2 = "eslint-plugin-react-debug";
|
|
53
|
-
var version = "1.
|
|
57
|
+
var version = "1.41.0-beta.1";
|
|
54
58
|
var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("debug"));
|
|
55
59
|
|
|
56
60
|
// src/rules/class-component.ts
|
|
@@ -234,6 +238,58 @@ function create4(context) {
|
|
|
234
238
|
JSXIdentifier: visitorFunction
|
|
235
239
|
};
|
|
236
240
|
}
|
|
241
|
+
var RULE_NAME5 = "jsx";
|
|
242
|
+
var RULE_FEATURES5 = [
|
|
243
|
+
"DBG"
|
|
244
|
+
];
|
|
245
|
+
var jsx_default = createRule({
|
|
246
|
+
meta: {
|
|
247
|
+
type: "problem",
|
|
248
|
+
docs: {
|
|
249
|
+
description: "Reports all React Hooks.",
|
|
250
|
+
[Symbol.for("rule_features")]: RULE_FEATURES5
|
|
251
|
+
},
|
|
252
|
+
messages: {
|
|
253
|
+
jsx: "[jsx] jsx: '{{jsx}}', jsxFactory: '{{jsxFactory}}', jsxFragmentFactory: '{{jsxFragmentFactory}}', jsxRuntime: '{{jsxRuntime}}' jsxImportSource: '{{jsxImportSource}}'"
|
|
254
|
+
},
|
|
255
|
+
schema: []
|
|
256
|
+
},
|
|
257
|
+
name: RULE_NAME5,
|
|
258
|
+
create: create5,
|
|
259
|
+
defaultOptions: []
|
|
260
|
+
});
|
|
261
|
+
function create5(context) {
|
|
262
|
+
const jsxConfigFromContext = kit.JsxConfig.getFromContext(context);
|
|
263
|
+
const jsxConfigFromAnnotation = kit.JsxConfig.getFromAnnotation(context);
|
|
264
|
+
const jsxConfig = {
|
|
265
|
+
...jsxConfigFromContext,
|
|
266
|
+
...jsxConfigFromAnnotation
|
|
267
|
+
};
|
|
268
|
+
const baseDescriptor = {
|
|
269
|
+
messageId: "jsx",
|
|
270
|
+
data: {
|
|
271
|
+
jsx: tsPattern.match(jsxConfig.jsx).with(typescript.JsxEmit.None, () => "none").with(typescript.JsxEmit.ReactJSX, () => "react-jsx").with(typescript.JsxEmit.ReactJSXDev, () => "react-jsx-dev").with(typescript.JsxEmit.React, () => "react").with(typescript.JsxEmit.ReactNative, () => "react-native").with(typescript.JsxEmit.Preserve, () => "preserve").otherwise(() => "unknown"),
|
|
272
|
+
jsxFactory: jsxConfig.jsxFactory,
|
|
273
|
+
jsxFragmentFactory: jsxConfig.jsxFragmentFactory,
|
|
274
|
+
jsxImportSource: jsxConfig.jsxImportSource,
|
|
275
|
+
jsxRuntime: tsPattern.match(jsxConfig.jsx).with(tsPattern.P.union(typescript.JsxEmit.None, typescript.JsxEmit.ReactJSX, typescript.JsxEmit.ReactJSXDev), () => "automatic").otherwise(() => "classic")
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
return {
|
|
279
|
+
JSXElement(node) {
|
|
280
|
+
context.report({
|
|
281
|
+
...baseDescriptor,
|
|
282
|
+
node
|
|
283
|
+
});
|
|
284
|
+
},
|
|
285
|
+
JSXFragment(node) {
|
|
286
|
+
context.report({
|
|
287
|
+
...baseDescriptor,
|
|
288
|
+
node
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
237
293
|
|
|
238
294
|
// src/plugin.ts
|
|
239
295
|
var plugin = {
|
|
@@ -242,10 +298,11 @@ var plugin = {
|
|
|
242
298
|
version
|
|
243
299
|
},
|
|
244
300
|
rules: {
|
|
245
|
-
"class-component": class_component_default,
|
|
246
|
-
"function-component": function_component_default,
|
|
247
|
-
hook: hook_default,
|
|
248
|
-
"is-from-react": is_from_react_default,
|
|
301
|
+
["class-component"]: class_component_default,
|
|
302
|
+
["function-component"]: function_component_default,
|
|
303
|
+
["hook"]: hook_default,
|
|
304
|
+
["is-from-react"]: is_from_react_default,
|
|
305
|
+
["jsx"]: jsx_default,
|
|
249
306
|
// Part: deprecated rules
|
|
250
307
|
/** @deprecated Use `hook` instead */
|
|
251
308
|
"react-hooks": hook_default
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { getDocsUrl, getSettingsFromContext, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
|
|
2
2
|
import * as ER2 from '@eslint-react/core';
|
|
3
3
|
import { ESLintUtils, AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
4
|
+
import { JsxConfig } from '@eslint-react/kit';
|
|
5
|
+
import { match, P } from 'ts-pattern';
|
|
6
|
+
import { JsxEmit } from 'typescript';
|
|
4
7
|
|
|
5
8
|
var __defProp = Object.defineProperty;
|
|
6
9
|
var __export = (target, all) => {
|
|
@@ -20,7 +23,8 @@ var rules = {
|
|
|
20
23
|
"react-debug/class-component": "warn",
|
|
21
24
|
"react-debug/function-component": "warn",
|
|
22
25
|
"react-debug/hook": "warn",
|
|
23
|
-
"react-debug/is-from-react": "
|
|
26
|
+
"react-debug/is-from-react": "warn",
|
|
27
|
+
"react-debug/jsx": "warn"
|
|
24
28
|
};
|
|
25
29
|
var settings = {
|
|
26
30
|
"react-x": DEFAULT_ESLINT_REACT_SETTINGS
|
|
@@ -28,7 +32,7 @@ var settings = {
|
|
|
28
32
|
|
|
29
33
|
// package.json
|
|
30
34
|
var name2 = "eslint-plugin-react-debug";
|
|
31
|
-
var version = "1.
|
|
35
|
+
var version = "1.41.0-beta.1";
|
|
32
36
|
var createRule = ESLintUtils.RuleCreator(getDocsUrl("debug"));
|
|
33
37
|
|
|
34
38
|
// src/rules/class-component.ts
|
|
@@ -212,6 +216,58 @@ function create4(context) {
|
|
|
212
216
|
JSXIdentifier: visitorFunction
|
|
213
217
|
};
|
|
214
218
|
}
|
|
219
|
+
var RULE_NAME5 = "jsx";
|
|
220
|
+
var RULE_FEATURES5 = [
|
|
221
|
+
"DBG"
|
|
222
|
+
];
|
|
223
|
+
var jsx_default = createRule({
|
|
224
|
+
meta: {
|
|
225
|
+
type: "problem",
|
|
226
|
+
docs: {
|
|
227
|
+
description: "Reports all React Hooks.",
|
|
228
|
+
[Symbol.for("rule_features")]: RULE_FEATURES5
|
|
229
|
+
},
|
|
230
|
+
messages: {
|
|
231
|
+
jsx: "[jsx] jsx: '{{jsx}}', jsxFactory: '{{jsxFactory}}', jsxFragmentFactory: '{{jsxFragmentFactory}}', jsxRuntime: '{{jsxRuntime}}' jsxImportSource: '{{jsxImportSource}}'"
|
|
232
|
+
},
|
|
233
|
+
schema: []
|
|
234
|
+
},
|
|
235
|
+
name: RULE_NAME5,
|
|
236
|
+
create: create5,
|
|
237
|
+
defaultOptions: []
|
|
238
|
+
});
|
|
239
|
+
function create5(context) {
|
|
240
|
+
const jsxConfigFromContext = JsxConfig.getFromContext(context);
|
|
241
|
+
const jsxConfigFromAnnotation = JsxConfig.getFromAnnotation(context);
|
|
242
|
+
const jsxConfig = {
|
|
243
|
+
...jsxConfigFromContext,
|
|
244
|
+
...jsxConfigFromAnnotation
|
|
245
|
+
};
|
|
246
|
+
const baseDescriptor = {
|
|
247
|
+
messageId: "jsx",
|
|
248
|
+
data: {
|
|
249
|
+
jsx: match(jsxConfig.jsx).with(JsxEmit.None, () => "none").with(JsxEmit.ReactJSX, () => "react-jsx").with(JsxEmit.ReactJSXDev, () => "react-jsx-dev").with(JsxEmit.React, () => "react").with(JsxEmit.ReactNative, () => "react-native").with(JsxEmit.Preserve, () => "preserve").otherwise(() => "unknown"),
|
|
250
|
+
jsxFactory: jsxConfig.jsxFactory,
|
|
251
|
+
jsxFragmentFactory: jsxConfig.jsxFragmentFactory,
|
|
252
|
+
jsxImportSource: jsxConfig.jsxImportSource,
|
|
253
|
+
jsxRuntime: match(jsxConfig.jsx).with(P.union(JsxEmit.None, JsxEmit.ReactJSX, JsxEmit.ReactJSXDev), () => "automatic").otherwise(() => "classic")
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
return {
|
|
257
|
+
JSXElement(node) {
|
|
258
|
+
context.report({
|
|
259
|
+
...baseDescriptor,
|
|
260
|
+
node
|
|
261
|
+
});
|
|
262
|
+
},
|
|
263
|
+
JSXFragment(node) {
|
|
264
|
+
context.report({
|
|
265
|
+
...baseDescriptor,
|
|
266
|
+
node
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
}
|
|
215
271
|
|
|
216
272
|
// src/plugin.ts
|
|
217
273
|
var plugin = {
|
|
@@ -220,10 +276,11 @@ var plugin = {
|
|
|
220
276
|
version
|
|
221
277
|
},
|
|
222
278
|
rules: {
|
|
223
|
-
"class-component": class_component_default,
|
|
224
|
-
"function-component": function_component_default,
|
|
225
|
-
hook: hook_default,
|
|
226
|
-
"is-from-react": is_from_react_default,
|
|
279
|
+
["class-component"]: class_component_default,
|
|
280
|
+
["function-component"]: function_component_default,
|
|
281
|
+
["hook"]: hook_default,
|
|
282
|
+
["is-from-react"]: is_from_react_default,
|
|
283
|
+
["jsx"]: jsx_default,
|
|
227
284
|
// Part: deprecated rules
|
|
228
285
|
/** @deprecated Use `hook` instead */
|
|
229
286
|
"react-hooks": hook_default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-debug",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.41.0-beta.1",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for debugging related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"@typescript-eslint/utils": "^8.29.0",
|
|
50
50
|
"string-ts": "^2.2.1",
|
|
51
51
|
"ts-pattern": "^5.7.0",
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/kit": "1.
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
58
|
-
"@eslint-react/
|
|
52
|
+
"@eslint-react/core": "1.41.0-beta.1",
|
|
53
|
+
"@eslint-react/jsx": "1.41.0-beta.1",
|
|
54
|
+
"@eslint-react/kit": "1.41.0-beta.1",
|
|
55
|
+
"@eslint-react/var": "1.41.0-beta.1",
|
|
56
|
+
"@eslint-react/eff": "1.41.0-beta.1",
|
|
57
|
+
"@eslint-react/ast": "1.41.0-beta.1",
|
|
58
|
+
"@eslint-react/shared": "1.41.0-beta.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/react": "^19.1.0",
|