eslint-plugin-react-dom 2.0.0-next.50 → 2.0.0-next.52

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
@@ -2,6 +2,10 @@ import { CamelCase } from 'string-ts';
2
2
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
3
3
  import { RulePreset } from '@eslint-react/kit';
4
4
 
5
+ declare const RULE_NAME$1 = "no-missing-iframe-sandbox";
6
+ type MessageID$1 = CamelCase<typeof RULE_NAME$1> | RuleSuggestMessageID$1;
7
+ type RuleSuggestMessageID$1 = "addIframeSandbox";
8
+
5
9
  declare const RULE_NAME = "no-missing-button-type";
6
10
  type MessageID = CamelCase<typeof RULE_NAME> | RuleSuggestMessageID;
7
11
  type RuleSuggestMessageID = "addButtonType";
@@ -22,7 +26,7 @@ declare const _default: {
22
26
  readonly "no-flush-sync": _typescript_eslint_utils_ts_eslint.RuleModule<"noFlushSync", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
23
27
  readonly "no-hydrate": _typescript_eslint_utils_ts_eslint.RuleModule<"noHydrate", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
24
28
  readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint.RuleModule<MessageID, [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
25
- readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
29
+ readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<MessageID$1, [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
26
30
  readonly "no-namespace": _typescript_eslint_utils_ts_eslint.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
27
31
  readonly "no-render": _typescript_eslint_utils_ts_eslint.RuleModule<"noRender", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
28
32
  readonly "no-render-return-value": _typescript_eslint_utils_ts_eslint.RuleModule<"noRenderReturnValue", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
@@ -54,7 +58,7 @@ declare const _default: {
54
58
  readonly "no-flush-sync": _typescript_eslint_utils_ts_eslint.RuleModule<"noFlushSync", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
55
59
  readonly "no-hydrate": _typescript_eslint_utils_ts_eslint.RuleModule<"noHydrate", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
56
60
  readonly "no-missing-button-type": _typescript_eslint_utils_ts_eslint.RuleModule<MessageID, [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
57
- readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<"noMissingIframeSandbox", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
61
+ readonly "no-missing-iframe-sandbox": _typescript_eslint_utils_ts_eslint.RuleModule<MessageID$1, [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
58
62
  readonly "no-namespace": _typescript_eslint_utils_ts_eslint.RuleModule<"noNamespace", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
59
63
  readonly "no-render": _typescript_eslint_utils_ts_eslint.RuleModule<"noRender", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
60
64
  readonly "no-render-return-value": _typescript_eslint_utils_ts_eslint.RuleModule<"noRenderReturnValue", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener>;
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ var settings = {
44
44
 
45
45
  // package.json
46
46
  var name2 = "eslint-plugin-react-dom";
47
- var version = "2.0.0-next.50";
47
+ var version = "2.0.0-next.52";
48
48
  function createJsxElementResolver(context) {
49
49
  const { components, polymorphicPropName } = getSettingsFromContext(context);
50
50
  return {
@@ -381,7 +381,7 @@ function create6(context) {
381
381
  messageId: "noMissingButtonType",
382
382
  node,
383
383
  suggest: getSuggest((type) => (fixer) => {
384
- return fixer.insertTextAfter(node.openingElement.name, ` type="${type}"`);
384
+ return fixer.insertTextAfter(node.openingElement.name, ` ${propNameOnJsx}="${type}"`);
385
385
  })
386
386
  });
387
387
  }
@@ -396,28 +396,9 @@ function getSuggest(getFix4) {
396
396
  }));
397
397
  }
398
398
  var RULE_NAME7 = "no-missing-iframe-sandbox";
399
- var RULE_FEATURES7 = [];
400
- var validTypes = [
401
- "",
402
- "allow-downloads",
403
- "allow-downloads-without-user-activation",
404
- "allow-forms",
405
- "allow-modals",
406
- "allow-orientation-lock",
407
- "allow-pointer-lock",
408
- "allow-popups",
409
- "allow-popups-to-escape-sandbox",
410
- "allow-presentation",
411
- "allow-same-origin",
412
- "allow-scripts",
413
- "allow-storage-access-by-user-activation",
414
- "allow-top-navigation",
415
- "allow-top-navigation-by-user-activation",
416
- "allow-top-navigation-to-custom-protocols"
399
+ var RULE_FEATURES7 = [
400
+ "FIX"
417
401
  ];
418
- function hasValidSandBox(value) {
419
- return typeof value === "string" && value.split(" ").every((value2) => validTypes.some((valid) => valid === value2));
420
- }
421
402
  var no_missing_iframe_sandbox_default = createRule({
422
403
  meta: {
423
404
  type: "problem",
@@ -425,7 +406,10 @@ var no_missing_iframe_sandbox_default = createRule({
425
406
  description: "Enforces explicit `sandbox` attribute for `iframe` elements.",
426
407
  [Symbol.for("rule_features")]: RULE_FEATURES7
427
408
  },
409
+ fixable: "code",
410
+ hasSuggestions: true,
428
411
  messages: {
412
+ addIframeSandbox: "Add 'sandbox' attribute with value '{{value}}'.",
429
413
  noMissingIframeSandbox: "Add missing 'sandbox' attribute on 'iframe' component."
430
414
  },
431
415
  schema: []
@@ -454,17 +438,36 @@ function create7(context) {
454
438
  attributeNode,
455
439
  propNameOnJsx
456
440
  );
457
- if (attributeValue.kind === "some" && hasValidSandBox(attributeValue.value)) return;
458
- context.report({
459
- messageId: "noMissingIframeSandbox",
460
- node: attributeNode
461
- });
441
+ if (attributeValue.kind !== "some" || typeof attributeValue.value !== "string") {
442
+ context.report({
443
+ messageId: "noMissingIframeSandbox",
444
+ node: attributeNode,
445
+ suggest: [
446
+ {
447
+ messageId: "addIframeSandbox",
448
+ data: { value: "" },
449
+ fix(fixer) {
450
+ return fixer.replaceText(attributeNode, `${propNameOnJsx}=""`);
451
+ }
452
+ }
453
+ ]
454
+ });
455
+ }
462
456
  return;
463
457
  }
464
- if (!hasValidSandBox(customComponentProp?.defaultValue)) {
458
+ if (typeof customComponentProp?.defaultValue !== "string") {
465
459
  context.report({
466
460
  messageId: "noMissingIframeSandbox",
467
- node
461
+ node,
462
+ suggest: [
463
+ {
464
+ messageId: "addIframeSandbox",
465
+ data: { value: "" },
466
+ fix(fixer) {
467
+ return fixer.insertTextAfter(node.openingElement.name, ` ${propNameOnJsx}=""`);
468
+ }
469
+ }
470
+ ]
468
471
  });
469
472
  }
470
473
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-dom",
3
- "version": "2.0.0-next.50",
3
+ "version": "2.0.0-next.52",
4
4
  "description": "ESLint React's ESLint plugin for React DOM related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -41,12 +41,12 @@
41
41
  "compare-versions": "^6.1.1",
42
42
  "string-ts": "^2.2.1",
43
43
  "ts-pattern": "^5.7.1",
44
- "@eslint-react/ast": "2.0.0-next.50",
45
- "@eslint-react/eff": "2.0.0-next.50",
46
- "@eslint-react/kit": "2.0.0-next.50",
47
- "@eslint-react/core": "2.0.0-next.50",
48
- "@eslint-react/shared": "2.0.0-next.50",
49
- "@eslint-react/var": "2.0.0-next.50"
44
+ "@eslint-react/ast": "2.0.0-next.52",
45
+ "@eslint-react/core": "2.0.0-next.52",
46
+ "@eslint-react/eff": "2.0.0-next.52",
47
+ "@eslint-react/kit": "2.0.0-next.52",
48
+ "@eslint-react/var": "2.0.0-next.52",
49
+ "@eslint-react/shared": "2.0.0-next.52"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/react": "^19.1.8",