eslint-plugin-react-jsx 5.28.7 → 5.30.0-beta.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.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import { ESLint, Linter } from "eslint";
2
- //#region src/index.d.ts
3
2
  type ConfigName = "recommended" | "strict";
4
3
  declare const finalPlugin: ESLint.Plugin & {
5
4
  configs: Record<ConfigName, Linter.Config>;
6
5
  };
7
- //#endregion
8
6
  export { finalPlugin as default };
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { DEFAULT_ESLINT_REACT_SETTINGS } from "@eslint-react/shared";
2
2
  import * as ESLintUtils from "@typescript-eslint/utils/eslint-utils";
3
3
  import * as core from "@eslint-react/core";
4
- import "@eslint-react/eslint";
4
+ import { getText } from "@eslint-react/eslint";
5
5
  import { collapseMultilineText, findAttribute, getChildren, getElementFullType, hasAnyAttribute, hasChildren, isAttribute, isEmptyStringExpression, isFragmentElement, isHostElement, isWhitespaceText } from "@eslint-react/jsx";
6
6
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
7
7
  import { Check } from "@eslint-react/ast";
8
8
  import ts from "typescript";
9
- //#region \0rolldown/runtime.js
9
+ // \0rolldown/runtime.js
10
10
  var __defProp = Object.defineProperty;
11
11
  var __exportAll = (all, no_symbols) => {
12
12
  let target = {};
@@ -17,18 +17,15 @@ var __exportAll = (all, no_symbols) => {
17
17
  if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
18
18
  return target;
19
19
  };
20
- //#endregion
21
- //#region package.json
20
+ // package.json
22
21
  var name$2 = "eslint-plugin-react-jsx";
23
- var version = "5.28.7";
24
- //#endregion
25
- //#region src/utils/create-rule.ts
22
+ var version = "5.30.0-beta.0";
23
+ // src/utils/create-rule.ts
26
24
  function getDocsUrl(ruleName) {
27
25
  return `https://eslint-react.xyz/docs/rules/jsx-${ruleName}`;
28
26
  }
29
27
  const createRule = ESLintUtils.RuleCreator(getDocsUrl);
30
- //#endregion
31
- //#region src/utils/remove-jsx-attribute.ts
28
+ // src/utils/remove-jsx-attribute.ts
32
29
  function removeJSXAttribute(context, fixer, attribute) {
33
30
  let start = attribute.range[0];
34
31
  while (start > 0 && /\s/.test(context.sourceCode.text[start - 1] ?? "")) start--;
@@ -152,7 +149,7 @@ function getChildrenText(context, attribute) {
152
149
  const { value } = attribute;
153
150
  if (value?.type === AST_NODE_TYPES.Literal) return escapeJSXText(String(value.value));
154
151
  if (value?.type === AST_NODE_TYPES.JSXExpressionContainer && value.expression.type !== AST_NODE_TYPES.JSXEmptyExpression) {
155
- const exprText = context.sourceCode.getText(value.expression);
152
+ const exprText = getText(context, value.expression);
156
153
  return Check.isJSXElementOrFragment(value.expression) ? exprText : `{${exprText}}`;
157
154
  }
158
155
  return null;
@@ -162,14 +159,13 @@ function escapeJSXText(text) {
162
159
  }
163
160
  function buildFix$1(context, node, prop, childrenText) {
164
161
  return (fixer) => {
165
- const sourceCode = context.sourceCode;
166
162
  const { openingElement } = node;
167
163
  const removePropFix = removeJSXAttribute(context, fixer, prop);
168
164
  if (openingElement.selfClosing) {
169
- const tagName = sourceCode.getText(openingElement.name);
170
- const selfCloseOffset = sourceCode.getText(openingElement).lastIndexOf("/>");
165
+ const tagName = getText(context, openingElement.name);
166
+ const selfCloseOffset = getText(context, openingElement).lastIndexOf("/>");
171
167
  let wsStart = openingElement.range[0] + selfCloseOffset;
172
- while (wsStart > prop.range[1] && /\s/.test(sourceCode.text[wsStart - 1])) wsStart--;
168
+ while (wsStart > prop.range[1] && /\s/.test(context.sourceCode.text[wsStart - 1])) wsStart--;
173
169
  return [removePropFix, fixer.replaceTextRange([wsStart, openingElement.range[1]], `>${childrenText}</${tagName}>`)];
174
170
  }
175
171
  if (node.closingElement == null) return [removePropFix];
@@ -189,15 +185,14 @@ var no_comment_textnodes_default = createRule({
189
185
  function create$5(context) {
190
186
  return { JSXText(node) {
191
187
  if (!Check.isJSXElementOrFragment(node.parent)) return;
192
- if (!/^\s*\/(?:\/|\*)/mu.test(context.sourceCode.getText(node))) return;
188
+ if (!/^\s*\/(?:\/|\*)/mu.test(getText(context, node))) return;
193
189
  context.report({
194
190
  messageId: "default",
195
191
  node
196
192
  });
197
193
  } };
198
194
  }
199
- //#endregion
200
- //#region ../../.pkgs/eff/dist/index.js
195
+ // ../../.pkgs/eff/dist/index.js
201
196
  const pipeArguments = (self, args) => {
202
197
  switch (args.length) {
203
198
  case 0: return self;
@@ -334,7 +329,7 @@ function create$3(context) {
334
329
  if (child.type !== AST_NODE_TYPES.JSXText || !child.value.endsWith("$")) continue;
335
330
  if (node.children[index + 1]?.type !== AST_NODE_TYPES.JSXExpressionContainer) continue;
336
331
  if (child.value.trim() === "$" && node.children.every((sibling, siblingIndex) => siblingIndex === index || siblingIndex === index + 1 || isNonSubstantiveChild(sibling))) continue;
337
- if (!context.sourceCode.getText(child).endsWith("$")) continue;
332
+ if (!getText(context, child).endsWith("$")) continue;
338
333
  const dollarStart = child.range[1] - 1;
339
334
  const dollarEnd = child.range[1];
340
335
  context.report({
@@ -381,7 +376,7 @@ var no_leaked_semicolon_default = createRule({
381
376
  function create$2(context) {
382
377
  return { JSXText(node) {
383
378
  if (!Check.isJSXElementOrFragment(node.parent)) return;
384
- if (!/^;+[ \t]*(?:\r\n|\r|\n)/u.test(context.sourceCode.getText(node))) return;
379
+ if (!/^;+[ \t]*(?:\r\n|\r|\n)/u.test(getText(context, node))) return;
385
380
  context.report({
386
381
  messageId: "default",
387
382
  node,
@@ -415,8 +410,7 @@ function create$1(context) {
415
410
  });
416
411
  } };
417
412
  }
418
- //#endregion
419
- //#region src/rules/no-useless-fragment/no-useless-fragment.ts
413
+ // src/rules/no-useless-fragment/no-useless-fragment.ts
420
414
  const RULE_NAME = "no-useless-fragment";
421
415
  const defaultOptions = [{
422
416
  allowEmptyFragment: false,
@@ -506,7 +500,7 @@ function buildFix(context, node) {
506
500
  for (const child of node.children) if (child.type === AST_NODE_TYPES.JSXText) {
507
501
  const cleaned = collapseMultilineText(child.value);
508
502
  if (cleaned != null) text += cleaned;
509
- } else text += sourceCode.getText(child);
503
+ } else text += getText(context, child);
510
504
  let start = node.range[0];
511
505
  if (text === "" && node.children.length > 0) {
512
506
  const lineStart = Math.max(sourceCode.text.lastIndexOf("\n", start - 1), sourceCode.text.lastIndexOf("\r", start - 1)) + 1;
@@ -515,8 +509,7 @@ function buildFix(context, node) {
515
509
  return fixer.replaceTextRange([start, node.range[1]], text);
516
510
  };
517
511
  }
518
- //#endregion
519
- //#region src/plugin.ts
512
+ // src/plugin.ts
520
513
  const plugin = {
521
514
  meta: {
522
515
  name: name$2,
@@ -533,8 +526,7 @@ const plugin = {
533
526
  "no-useless-fragment": no_useless_fragment_default
534
527
  }
535
528
  };
536
- //#endregion
537
- //#region src/configs/recommended.ts
529
+ // src/configs/recommended.ts
538
530
  var recommended_exports = /* @__PURE__ */ __exportAll({
539
531
  name: () => name$1,
540
532
  plugins: () => plugins$1,
@@ -553,8 +545,7 @@ const rules$1 = {
553
545
  };
554
546
  const plugins$1 = { "react-jsx": plugin };
555
547
  const settings$1 = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
556
- //#endregion
557
- //#region src/configs/strict.ts
548
+ // src/configs/strict.ts
558
549
  var strict_exports = /* @__PURE__ */ __exportAll({
559
550
  name: () => name,
560
551
  plugins: () => plugins,
@@ -569,8 +560,7 @@ const rules = {
569
560
  };
570
561
  const plugins = { ...plugins$1 };
571
562
  const settings = { ...settings$1 };
572
- //#endregion
573
- //#region src/index.ts
563
+ // src/index.ts
574
564
  function createConfig(base) {
575
565
  return {
576
566
  ...base,
@@ -589,5 +579,4 @@ const finalPlugin = {
589
579
  ["strict"]: createConfig(strict_exports)
590
580
  }
591
581
  };
592
- //#endregion
593
582
  export { finalPlugin as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-jsx",
3
- "version": "5.28.7",
3
+ "version": "5.30.0-beta.0",
4
4
  "description": "ESLint React's ESLint plugin for React Flavored JSX rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -37,11 +37,11 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
40
- "@eslint-react/ast": "5.28.7",
41
- "@eslint-react/core": "5.28.7",
42
- "@eslint-react/eslint": "5.28.7",
43
- "@eslint-react/jsx": "5.28.7",
44
- "@eslint-react/shared": "5.28.7",
40
+ "@eslint-react/ast": "5.30.0-beta.0",
41
+ "@eslint-react/core": "5.30.0-beta.0",
42
+ "@eslint-react/eslint": "5.30.0-beta.0",
43
+ "@eslint-react/jsx": "5.30.0-beta.0",
44
+ "@eslint-react/shared": "5.30.0-beta.0",
45
45
  "@typescript-eslint/types": "^8.72.0",
46
46
  "@typescript-eslint/utils": "^8.72.0"
47
47
  },
@@ -55,7 +55,7 @@
55
55
  "@types/react-dom": "^19.3.0",
56
56
  "dedent": "^1.7.2",
57
57
  "eslint": "^10.13.0",
58
- "tsdown": "^0.23.1",
58
+ "tsdown": "^0.23.2",
59
59
  "typescript": "6.0.3"
60
60
  },
61
61
  "peerDependencies": {