eslint-plugin-react-x 1.40.5-beta.0 → 1.40.5-beta.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.js +16 -6
- package/dist/index.mjs +17 -7
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -141,7 +141,7 @@ var settings3 = {
|
|
|
141
141
|
|
|
142
142
|
// package.json
|
|
143
143
|
var name4 = "eslint-plugin-react-x";
|
|
144
|
-
var version = "1.40.5-beta.
|
|
144
|
+
var version = "1.40.5-beta.2";
|
|
145
145
|
var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("x"));
|
|
146
146
|
|
|
147
147
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -308,17 +308,19 @@ var jsx_uses_react_default = createRule({
|
|
|
308
308
|
defaultOptions: []
|
|
309
309
|
});
|
|
310
310
|
function create5(context) {
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
|
|
311
|
+
const jsxRuntimeConfig = {
|
|
312
|
+
...kit.JsxRuntimeConfig.getFromContext(context),
|
|
313
|
+
...kit.JsxRuntimeConfig.getFromAnnotation(context)
|
|
314
|
+
};
|
|
315
|
+
const { jsx, jsxFactory, jsxFragmentFactory } = jsxRuntimeConfig;
|
|
314
316
|
if (jsx === ts.JsxEmit.ReactJSX || jsx === ts.JsxEmit.ReactJSXDev) return {};
|
|
315
|
-
const jsxFactory = jsxAnnotation.jsx ?? jsxOptions.jsxFactory;
|
|
316
|
-
const jsxFragmentFactory = jsxAnnotation.jsxFrag ?? jsxOptions.jsxFragmentFactory;
|
|
317
317
|
function handleJsxElement(node) {
|
|
318
318
|
context.sourceCode.markVariableAsUsed(jsxFactory, node);
|
|
319
|
+
debugReport(context, node, jsxFactory);
|
|
319
320
|
}
|
|
320
321
|
function handleJsxFragment(node) {
|
|
321
322
|
context.sourceCode.markVariableAsUsed(jsxFragmentFactory, node);
|
|
323
|
+
debugReport(context, node, jsxFragmentFactory);
|
|
322
324
|
}
|
|
323
325
|
return {
|
|
324
326
|
JSXFragment: handleJsxFragment,
|
|
@@ -326,6 +328,14 @@ function create5(context) {
|
|
|
326
328
|
JSXOpeningFragment: handleJsxElement
|
|
327
329
|
};
|
|
328
330
|
}
|
|
331
|
+
function debugReport(context, node, name5) {
|
|
332
|
+
if (process.env["ESLINT_REACT_DEBUG"] !== "1") return;
|
|
333
|
+
context.report({
|
|
334
|
+
messageId: "jsxUsesReact",
|
|
335
|
+
node,
|
|
336
|
+
data: { name: name5 }
|
|
337
|
+
});
|
|
338
|
+
}
|
|
329
339
|
var RULE_NAME6 = "jsx-uses-vars";
|
|
330
340
|
var RULE_FEATURES6 = [];
|
|
331
341
|
var jsx_uses_vars_default = createRule({
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
|
5
5
|
import { _, flow, getOrUpdate, constTrue, constFalse } from '@eslint-react/eff';
|
|
6
6
|
import * as VAR2 from '@eslint-react/var';
|
|
7
7
|
import { match, isMatching, P } from 'ts-pattern';
|
|
8
|
-
import {
|
|
8
|
+
import { JsxRuntimeConfig, createReport } from '@eslint-react/kit';
|
|
9
9
|
import ts, { JsxEmit } from 'typescript';
|
|
10
10
|
import * as AST8 from '@eslint-react/ast';
|
|
11
11
|
import * as ER21 from '@eslint-react/core';
|
|
@@ -113,7 +113,7 @@ var settings3 = {
|
|
|
113
113
|
|
|
114
114
|
// package.json
|
|
115
115
|
var name4 = "eslint-plugin-react-x";
|
|
116
|
-
var version = "1.40.5-beta.
|
|
116
|
+
var version = "1.40.5-beta.2";
|
|
117
117
|
var createRule = ESLintUtils.RuleCreator(getDocsUrl("x"));
|
|
118
118
|
|
|
119
119
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -280,17 +280,19 @@ var jsx_uses_react_default = createRule({
|
|
|
280
280
|
defaultOptions: []
|
|
281
281
|
});
|
|
282
282
|
function create5(context) {
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
283
|
+
const jsxRuntimeConfig = {
|
|
284
|
+
...JsxRuntimeConfig.getFromContext(context),
|
|
285
|
+
...JsxRuntimeConfig.getFromAnnotation(context)
|
|
286
|
+
};
|
|
287
|
+
const { jsx, jsxFactory, jsxFragmentFactory } = jsxRuntimeConfig;
|
|
286
288
|
if (jsx === JsxEmit.ReactJSX || jsx === JsxEmit.ReactJSXDev) return {};
|
|
287
|
-
const jsxFactory = jsxAnnotation.jsx ?? jsxOptions.jsxFactory;
|
|
288
|
-
const jsxFragmentFactory = jsxAnnotation.jsxFrag ?? jsxOptions.jsxFragmentFactory;
|
|
289
289
|
function handleJsxElement(node) {
|
|
290
290
|
context.sourceCode.markVariableAsUsed(jsxFactory, node);
|
|
291
|
+
debugReport(context, node, jsxFactory);
|
|
291
292
|
}
|
|
292
293
|
function handleJsxFragment(node) {
|
|
293
294
|
context.sourceCode.markVariableAsUsed(jsxFragmentFactory, node);
|
|
295
|
+
debugReport(context, node, jsxFragmentFactory);
|
|
294
296
|
}
|
|
295
297
|
return {
|
|
296
298
|
JSXFragment: handleJsxFragment,
|
|
@@ -298,6 +300,14 @@ function create5(context) {
|
|
|
298
300
|
JSXOpeningFragment: handleJsxElement
|
|
299
301
|
};
|
|
300
302
|
}
|
|
303
|
+
function debugReport(context, node, name5) {
|
|
304
|
+
if (process.env["ESLINT_REACT_DEBUG"] !== "1") return;
|
|
305
|
+
context.report({
|
|
306
|
+
messageId: "jsxUsesReact",
|
|
307
|
+
node,
|
|
308
|
+
data: { name: name5 }
|
|
309
|
+
});
|
|
310
|
+
}
|
|
301
311
|
var RULE_NAME6 = "jsx-uses-vars";
|
|
302
312
|
var RULE_FEATURES6 = [];
|
|
303
313
|
var jsx_uses_vars_default = createRule({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.40.5-beta.
|
|
3
|
+
"version": "1.40.5-beta.2",
|
|
4
4
|
"description": "A set of composable linting rules for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
"is-immutable-type": "^5.0.1",
|
|
51
51
|
"string-ts": "^2.2.1",
|
|
52
52
|
"ts-pattern": "^5.7.0",
|
|
53
|
-
"@eslint-react/ast": "1.40.5-beta.
|
|
54
|
-
"@eslint-react/eff": "1.40.5-beta.
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
58
|
-
"@eslint-react/
|
|
59
|
-
"@eslint-react/
|
|
53
|
+
"@eslint-react/ast": "1.40.5-beta.2",
|
|
54
|
+
"@eslint-react/eff": "1.40.5-beta.2",
|
|
55
|
+
"@eslint-react/kit": "1.40.5-beta.2",
|
|
56
|
+
"@eslint-react/jsx": "1.40.5-beta.2",
|
|
57
|
+
"@eslint-react/var": "1.40.5-beta.2",
|
|
58
|
+
"@eslint-react/shared": "1.40.5-beta.2",
|
|
59
|
+
"@eslint-react/core": "1.40.5-beta.2"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/react": "^19.1.0",
|