eslint-plugin-react-features 1.7.5 → 1.7.7

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/README.md CHANGED
@@ -174,6 +174,7 @@ Part of the **Interlace ESLint ecosystem** — AI-native rules with LLM-optimize
174
174
  | [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-secure-coding.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-secure-coding) | Injection prevention. |
175
175
  | [`eslint-plugin-sequelize-security`](https://www.npmjs.com/package/eslint-plugin-sequelize-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-sequelize-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-sequelize-security) | Sequelize ORM security. |
176
176
  | [`eslint-plugin-sqlite-security`](https://www.npmjs.com/package/eslint-plugin-sqlite-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-sqlite-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-sqlite-security) | SQLite security. |
177
+ | [`eslint-plugin-supabase-security`](https://www.npmjs.com/package/eslint-plugin-supabase-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-supabase-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-supabase-security) | Supabase security. |
177
178
  | [`eslint-plugin-typeorm-security`](https://www.npmjs.com/package/eslint-plugin-typeorm-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-typeorm-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-typeorm-security) | TypeORM security. |
178
179
  | [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | [![downloads](https://img.shields.io/npm/dt/eslint-plugin-vercel-ai-security.svg?style=flat-square)](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | AI SDK security. |
179
180
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-features",
3
- "version": "1.7.5",
3
+ "version": "1.7.7",
4
4
  "description": "ESLint plugin for React — hooks, prop-types, JSX correctness, render performance, and class-to-hooks migration rules for modern React codebases.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -69,7 +69,7 @@
69
69
  }
70
70
  },
71
71
  "dependencies": {
72
- "@interlace/eslint-devkit": "^1.19.2"
72
+ "@interlace/eslint-devkit": "^1.19.5"
73
73
  },
74
74
  "repository": {
75
75
  "type": "git",
package/src/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.rules={get"required-attributes"(){return require("./rules/react/required-attributes").requiredAttributes},get"jsx-key"(){return require("./rules/react/jsx-key").jsxKey},get"no-direct-mutation-state"(){return require("./rules/react/no-direct-mutation-state").noDirectMutationState},get"require-optimization"(){return require("./rules/react/require-optimization").requireOptimization},get"no-set-state"(){return require("./rules/react/no-set-state").noSetState},get"no-this-in-sfc"(){return require("./rules/react/no-this-in-sfc").noThisInSfc},get"no-access-state-in-setstate"(){return require("./rules/react/no-access-state-in-setstate").noAccessStateInSetState},get"no-children-prop"(){return require("./rules/react/no-children-prop").noChildrenProp},get"no-danger"(){return require("./rules/react/no-danger").noDanger},get"no-string-refs"(){return require("./rules/react/no-string-refs").noStringRefs},get"no-unknown-property"(){return require("./rules/react/no-unknown-property").noUnknownProperty},get"checked-requires-onchange-or-readonly"(){return require("./rules/react/checked-requires-onchange-or-readonly").checkedRequiresOnchangeOrReadonly},get"default-props-match-prop-types"(){return require("./rules/react/default-props-match-prop-types").defaultPropsMatchPropTypes},get"display-name"(){return require("./rules/react/display-name").displayName},get"jsx-handler-names"(){return require("./rules/react/jsx-handler-names").jsxHandlerNames},get"jsx-max-depth"(){return require("./rules/react/jsx-max-depth").jsxMaxDepth},get"jsx-no-bind"(){return require("./rules/react/jsx-no-bind").jsxNoBind},get"jsx-no-literals"(){return require("./rules/react/jsx-no-literals").jsxNoLiterals},get"no-adjacent-inline-elements"(){return require("./rules/react/no-adjacent-inline-elements").noAdjacentInlineElements},get"no-arrow-function-lifecycle"(){return require("./rules/react/no-arrow-function-lifecycle").noArrowFunctionLifecycle},get"no-did-mount-set-state"(){return require("./rules/react/no-did-mount-set-state").noDidMountSetState},get"no-did-update-set-state"(){return require("./rules/react/no-did-update-set-state").noDidUpdateSetState},get"no-invalid-html-attribute"(){return require("./rules/react/no-invalid-html-attribute").noInvalidHtmlAttribute},get"no-is-mounted"(){return require("./rules/react/no-is-mounted").noIsMounted},get"no-multi-comp"(){return require("./rules/react/no-multi-comp").noMultiComp},get"no-namespace"(){return require("./rules/react/no-namespace").noNamespace},get"no-object-type-as-default-prop"(){return require("./rules/react/no-object-type-as-default-prop").noObjectTypeAsDefaultProp},get"no-redundant-should-component-update"(){return require("./rules/react/no-redundant-should-component-update").noRedundantShouldComponentUpdate},get"no-render-return-value"(){return require("./rules/react/no-render-return-value").noRenderReturnValue},get"no-typos"(){return require("./rules/react/no-typos").noTypos},get"no-unescaped-entities"(){return require("./rules/react/no-unescaped-entities").noUnescapedEntities},get"prefer-es6-class"(){return require("./rules/react/prefer-es6-class").preferEs6Class},get"prefer-stateless-function"(){return require("./rules/react/prefer-stateless-function").preferStatelessFunction},get"prop-types"(){return require("./rules/react/prop-types").propTypes},get"react-in-jsx-scope"(){return require("./rules/react/react-in-jsx-scope").reactInJsxScope},get"require-default-props"(){return require("./rules/react/require-default-props").requireDefaultProps},get"require-render-return"(){return require("./rules/react/require-render-return").requireRenderReturn},get"sort-comp"(){return require("./rules/react/sort-comp").sortComp},get"state-in-constructor"(){return require("./rules/react/state-in-constructor").stateInConstructor},get"static-property-placement"(){return require("./rules/react/static-property-placement").staticPropertyPlacement},get"hooks-exhaustive-deps"(){return require("./rules/react/hooks-exhaustive-deps").hooksExhaustiveDeps},get"jsx-no-target-blank"(){return require("./rules/react/jsx-no-target-blank").jsxNoTargetBlank},get"jsx-no-script-url"(){return require("./rules/react/jsx-no-script-url").jsxNoScriptUrl},get"jsx-no-duplicate-props"(){return require("./rules/react/jsx-no-duplicate-props").jsxNoDuplicateProps},get"no-danger-with-children"(){return require("./rules/react/no-danger-with-children").noDangerWithChildren},get"no-deprecated"(){return require("./rules/react/no-deprecated").noDeprecated},get"no-find-dom-node"(){return require("./rules/react/no-find-dom-node").noFindDomNode},get"no-unsafe"(){return require("./rules/react/no-unsafe").noUnsafe},get"void-dom-elements-no-children"(){return require("./rules/react/void-dom-elements-no-children").voidDomElementsNoChildren},get"react-class-to-hooks"(){return require("./rules/migration/react-class-to-hooks").reactClassToHooks},get"no-unnecessary-rerenders"(){return require("./rules/performance/no-unnecessary-rerenders").noUnnecessaryRerenders},get"react-render-optimization"(){return require("./rules/performance/react-render-optimization").reactRenderOptimization},get"react-no-inline-functions"(){return require("./rules/performance/react-no-inline-functions").reactNoInlineFunctions},get"no-default-test-id"(){return require("./rules/component-api/no-default-test-id").noDefaultTestId},get"require-data-slot"(){return require("./rules/component-api/require-data-slot").requireDataSlot},get"no-is-prefix-prop"(){return require("./rules/component-api/no-is-prefix-prop").noIsPrefixProp},get"no-inline-style"(){return require("./rules/component-api/no-inline-style").noInlineStyle},get"no-raw-color-literal"(){return require("./rules/component-api/no-raw-color-literal").noRawColorLiteral},get"no-arbitrary-token-class"(){return require("./rules/component-api/no-arbitrary-token-class").noArbitraryTokenClass},get"no-kind-prop-discriminator"(){return require("./rules/component-api/no-kind-prop-discriminator").noKindPropDiscriminator},get"no-wrapper-sub-component"(){return require("./rules/component-api/no-wrapper-sub-component").noWrapperSubComponent},get"react/required-attributes"(){return require("./rules/react/required-attributes").requiredAttributes},get"react/jsx-key"(){return require("./rules/react/jsx-key").jsxKey},get"react/no-direct-mutation-state"(){return require("./rules/react/no-direct-mutation-state").noDirectMutationState},get"react/require-optimization"(){return require("./rules/react/require-optimization").requireOptimization},get"react/no-set-state"(){return require("./rules/react/no-set-state").noSetState},get"react/no-this-in-sfc"(){return require("./rules/react/no-this-in-sfc").noThisInSfc},get"react/no-access-state-in-setstate"(){return require("./rules/react/no-access-state-in-setstate").noAccessStateInSetState},get"react/no-children-prop"(){return require("./rules/react/no-children-prop").noChildrenProp},get"react/no-danger"(){return require("./rules/react/no-danger").noDanger},get"react/no-string-refs"(){return require("./rules/react/no-string-refs").noStringRefs},get"react/no-unknown-property"(){return require("./rules/react/no-unknown-property").noUnknownProperty},get"react/checked-requires-onchange-or-readonly"(){return require("./rules/react/checked-requires-onchange-or-readonly").checkedRequiresOnchangeOrReadonly},get"react/default-props-match-prop-types"(){return require("./rules/react/default-props-match-prop-types").defaultPropsMatchPropTypes},get"react/display-name"(){return require("./rules/react/display-name").displayName},get"react/jsx-handler-names"(){return require("./rules/react/jsx-handler-names").jsxHandlerNames},get"react/jsx-max-depth"(){return require("./rules/react/jsx-max-depth").jsxMaxDepth},get"react/jsx-no-bind"(){return require("./rules/react/jsx-no-bind").jsxNoBind},get"react/jsx-no-literals"(){return require("./rules/react/jsx-no-literals").jsxNoLiterals},get"react/no-adjacent-inline-elements"(){return require("./rules/react/no-adjacent-inline-elements").noAdjacentInlineElements},get"react/no-arrow-function-lifecycle"(){return require("./rules/react/no-arrow-function-lifecycle").noArrowFunctionLifecycle},get"react/no-did-mount-set-state"(){return require("./rules/react/no-did-mount-set-state").noDidMountSetState},get"react/no-did-update-set-state"(){return require("./rules/react/no-did-update-set-state").noDidUpdateSetState},get"react/no-invalid-html-attribute"(){return require("./rules/react/no-invalid-html-attribute").noInvalidHtmlAttribute},get"react/no-is-mounted"(){return require("./rules/react/no-is-mounted").noIsMounted},get"react/no-multi-comp"(){return require("./rules/react/no-multi-comp").noMultiComp},get"react/no-namespace"(){return require("./rules/react/no-namespace").noNamespace},get"react/no-object-type-as-default-prop"(){return require("./rules/react/no-object-type-as-default-prop").noObjectTypeAsDefaultProp},get"react/no-redundant-should-component-update"(){return require("./rules/react/no-redundant-should-component-update").noRedundantShouldComponentUpdate},get"react/no-render-return-value"(){return require("./rules/react/no-render-return-value").noRenderReturnValue},get"react/no-typos"(){return require("./rules/react/no-typos").noTypos},get"react/no-unescaped-entities"(){return require("./rules/react/no-unescaped-entities").noUnescapedEntities},get"react/prefer-es6-class"(){return require("./rules/react/prefer-es6-class").preferEs6Class},get"react/prefer-stateless-function"(){return require("./rules/react/prefer-stateless-function").preferStatelessFunction},get"react/prop-types"(){return require("./rules/react/prop-types").propTypes},get"react/react-in-jsx-scope"(){return require("./rules/react/react-in-jsx-scope").reactInJsxScope},get"react/require-default-props"(){return require("./rules/react/require-default-props").requireDefaultProps},get"react/require-render-return"(){return require("./rules/react/require-render-return").requireRenderReturn},get"react/sort-comp"(){return require("./rules/react/sort-comp").sortComp},get"react/state-in-constructor"(){return require("./rules/react/state-in-constructor").stateInConstructor},get"react/static-property-placement"(){return require("./rules/react/static-property-placement").staticPropertyPlacement},get"react/hooks-exhaustive-deps"(){return require("./rules/react/hooks-exhaustive-deps").hooksExhaustiveDeps},get"react/jsx-no-target-blank"(){return require("./rules/react/jsx-no-target-blank").jsxNoTargetBlank},get"react/jsx-no-script-url"(){return require("./rules/react/jsx-no-script-url").jsxNoScriptUrl},get"react/jsx-no-duplicate-props"(){return require("./rules/react/jsx-no-duplicate-props").jsxNoDuplicateProps},get"react/no-danger-with-children"(){return require("./rules/react/no-danger-with-children").noDangerWithChildren},get"react/no-deprecated"(){return require("./rules/react/no-deprecated").noDeprecated},get"react/no-find-dom-node"(){return require("./rules/react/no-find-dom-node").noFindDomNode},get"react/no-unsafe"(){return require("./rules/react/no-unsafe").noUnsafe},get"react/void-dom-elements-no-children"(){return require("./rules/react/void-dom-elements-no-children").voidDomElementsNoChildren},get"migration/react-class-to-hooks"(){return require("./rules/migration/react-class-to-hooks").reactClassToHooks},get"performance/no-unnecessary-rerenders"(){return require("./rules/performance/no-unnecessary-rerenders").noUnnecessaryRerenders},get"performance/react-render-optimization"(){return require("./rules/performance/react-render-optimization").reactRenderOptimization},get"performance/react-no-inline-functions"(){return require("./rules/performance/react-no-inline-functions").reactNoInlineFunctions},get"component-api/no-default-test-id"(){return require("./rules/component-api/no-default-test-id").noDefaultTestId},get"component-api/require-data-slot"(){return require("./rules/component-api/require-data-slot").requireDataSlot},get"component-api/no-is-prefix-prop"(){return require("./rules/component-api/no-is-prefix-prop").noIsPrefixProp},get"component-api/no-inline-style"(){return require("./rules/component-api/no-inline-style").noInlineStyle},get"component-api/no-raw-color-literal"(){return require("./rules/component-api/no-raw-color-literal").noRawColorLiteral},get"component-api/no-arbitrary-token-class"(){return require("./rules/component-api/no-arbitrary-token-class").noArbitraryTokenClass},get"component-api/no-kind-prop-discriminator"(){return require("./rules/component-api/no-kind-prop-discriminator").noKindPropDiscriminator},get"component-api/no-wrapper-sub-component"(){return require("./rules/component-api/no-wrapper-sub-component").noWrapperSubComponent}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-react-features",exports.rules);exports.plugin={meta:{name:"eslint-plugin-react-features",version:"1.7.5"},rules:exports.rules};exports.configs={flagship:{plugins:{"react-features":exports.plugin},rules:{"react-features/hooks-exhaustive-deps":"error"}},recommended:{plugins:{"react-features":exports.plugin},rules:{"react-features/jsx-key":"error","react-features/no-children-prop":"warn","react-features/no-danger":"warn","react-features/no-string-refs":"error","react-features/no-unknown-property":"error","react-features/hooks-exhaustive-deps":"warn","react-features/jsx-no-target-blank":"error","react-features/jsx-no-script-url":"error","react-features/jsx-no-duplicate-props":"error","react-features/no-danger-with-children":"error","react-features/no-deprecated":"warn"}},componentApi:{plugins:{"react-features":exports.plugin},rules:{"react-features/component-api/no-default-test-id":"error","react-features/component-api/require-data-slot":"warn","react-features/component-api/no-is-prefix-prop":"warn","react-features/component-api/no-inline-style":"warn","react-features/component-api/no-raw-color-literal":"warn","react-features/component-api/no-arbitrary-token-class":"warn","react-features/component-api/no-kind-prop-discriminator":"warn","react-features/component-api/no-wrapper-sub-component":"warn"}}};exports.default=exports.plugin;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.rules={get"required-attributes"(){return require("./rules/react/required-attributes").requiredAttributes},get"jsx-key"(){return require("./rules/react/jsx-key").jsxKey},get"no-direct-mutation-state"(){return require("./rules/react/no-direct-mutation-state").noDirectMutationState},get"require-optimization"(){return require("./rules/react/require-optimization").requireOptimization},get"no-set-state"(){return require("./rules/react/no-set-state").noSetState},get"no-this-in-sfc"(){return require("./rules/react/no-this-in-sfc").noThisInSfc},get"no-access-state-in-setstate"(){return require("./rules/react/no-access-state-in-setstate").noAccessStateInSetState},get"no-children-prop"(){return require("./rules/react/no-children-prop").noChildrenProp},get"no-danger"(){return require("./rules/react/no-danger").noDanger},get"no-string-refs"(){return require("./rules/react/no-string-refs").noStringRefs},get"no-unknown-property"(){return require("./rules/react/no-unknown-property").noUnknownProperty},get"checked-requires-onchange-or-readonly"(){return require("./rules/react/checked-requires-onchange-or-readonly").checkedRequiresOnchangeOrReadonly},get"default-props-match-prop-types"(){return require("./rules/react/default-props-match-prop-types").defaultPropsMatchPropTypes},get"display-name"(){return require("./rules/react/display-name").displayName},get"jsx-handler-names"(){return require("./rules/react/jsx-handler-names").jsxHandlerNames},get"jsx-max-depth"(){return require("./rules/react/jsx-max-depth").jsxMaxDepth},get"jsx-no-bind"(){return require("./rules/react/jsx-no-bind").jsxNoBind},get"jsx-no-literals"(){return require("./rules/react/jsx-no-literals").jsxNoLiterals},get"no-adjacent-inline-elements"(){return require("./rules/react/no-adjacent-inline-elements").noAdjacentInlineElements},get"no-arrow-function-lifecycle"(){return require("./rules/react/no-arrow-function-lifecycle").noArrowFunctionLifecycle},get"no-did-mount-set-state"(){return require("./rules/react/no-did-mount-set-state").noDidMountSetState},get"no-did-update-set-state"(){return require("./rules/react/no-did-update-set-state").noDidUpdateSetState},get"no-invalid-html-attribute"(){return require("./rules/react/no-invalid-html-attribute").noInvalidHtmlAttribute},get"no-is-mounted"(){return require("./rules/react/no-is-mounted").noIsMounted},get"no-multi-comp"(){return require("./rules/react/no-multi-comp").noMultiComp},get"no-namespace"(){return require("./rules/react/no-namespace").noNamespace},get"no-object-type-as-default-prop"(){return require("./rules/react/no-object-type-as-default-prop").noObjectTypeAsDefaultProp},get"no-redundant-should-component-update"(){return require("./rules/react/no-redundant-should-component-update").noRedundantShouldComponentUpdate},get"no-render-return-value"(){return require("./rules/react/no-render-return-value").noRenderReturnValue},get"no-typos"(){return require("./rules/react/no-typos").noTypos},get"no-unescaped-entities"(){return require("./rules/react/no-unescaped-entities").noUnescapedEntities},get"prefer-es6-class"(){return require("./rules/react/prefer-es6-class").preferEs6Class},get"prefer-stateless-function"(){return require("./rules/react/prefer-stateless-function").preferStatelessFunction},get"prop-types"(){return require("./rules/react/prop-types").propTypes},get"react-in-jsx-scope"(){return require("./rules/react/react-in-jsx-scope").reactInJsxScope},get"require-default-props"(){return require("./rules/react/require-default-props").requireDefaultProps},get"require-render-return"(){return require("./rules/react/require-render-return").requireRenderReturn},get"sort-comp"(){return require("./rules/react/sort-comp").sortComp},get"state-in-constructor"(){return require("./rules/react/state-in-constructor").stateInConstructor},get"static-property-placement"(){return require("./rules/react/static-property-placement").staticPropertyPlacement},get"hooks-exhaustive-deps"(){return require("./rules/react/hooks-exhaustive-deps").hooksExhaustiveDeps},get"jsx-no-target-blank"(){return require("./rules/react/jsx-no-target-blank").jsxNoTargetBlank},get"jsx-no-script-url"(){return require("./rules/react/jsx-no-script-url").jsxNoScriptUrl},get"jsx-no-duplicate-props"(){return require("./rules/react/jsx-no-duplicate-props").jsxNoDuplicateProps},get"no-danger-with-children"(){return require("./rules/react/no-danger-with-children").noDangerWithChildren},get"no-deprecated"(){return require("./rules/react/no-deprecated").noDeprecated},get"no-find-dom-node"(){return require("./rules/react/no-find-dom-node").noFindDomNode},get"no-unsafe"(){return require("./rules/react/no-unsafe").noUnsafe},get"void-dom-elements-no-children"(){return require("./rules/react/void-dom-elements-no-children").voidDomElementsNoChildren},get"react-class-to-hooks"(){return require("./rules/migration/react-class-to-hooks").reactClassToHooks},get"no-unnecessary-rerenders"(){return require("./rules/performance/no-unnecessary-rerenders").noUnnecessaryRerenders},get"react-render-optimization"(){return require("./rules/performance/react-render-optimization").reactRenderOptimization},get"react-no-inline-functions"(){return require("./rules/performance/react-no-inline-functions").reactNoInlineFunctions},get"no-default-test-id"(){return require("./rules/component-api/no-default-test-id").noDefaultTestId},get"require-data-slot"(){return require("./rules/component-api/require-data-slot").requireDataSlot},get"no-is-prefix-prop"(){return require("./rules/component-api/no-is-prefix-prop").noIsPrefixProp},get"no-inline-style"(){return require("./rules/component-api/no-inline-style").noInlineStyle},get"no-raw-color-literal"(){return require("./rules/component-api/no-raw-color-literal").noRawColorLiteral},get"no-arbitrary-token-class"(){return require("./rules/component-api/no-arbitrary-token-class").noArbitraryTokenClass},get"no-kind-prop-discriminator"(){return require("./rules/component-api/no-kind-prop-discriminator").noKindPropDiscriminator},get"no-wrapper-sub-component"(){return require("./rules/component-api/no-wrapper-sub-component").noWrapperSubComponent},get"react/required-attributes"(){return require("./rules/react/required-attributes").requiredAttributes},get"react/jsx-key"(){return require("./rules/react/jsx-key").jsxKey},get"react/no-direct-mutation-state"(){return require("./rules/react/no-direct-mutation-state").noDirectMutationState},get"react/require-optimization"(){return require("./rules/react/require-optimization").requireOptimization},get"react/no-set-state"(){return require("./rules/react/no-set-state").noSetState},get"react/no-this-in-sfc"(){return require("./rules/react/no-this-in-sfc").noThisInSfc},get"react/no-access-state-in-setstate"(){return require("./rules/react/no-access-state-in-setstate").noAccessStateInSetState},get"react/no-children-prop"(){return require("./rules/react/no-children-prop").noChildrenProp},get"react/no-danger"(){return require("./rules/react/no-danger").noDanger},get"react/no-string-refs"(){return require("./rules/react/no-string-refs").noStringRefs},get"react/no-unknown-property"(){return require("./rules/react/no-unknown-property").noUnknownProperty},get"react/checked-requires-onchange-or-readonly"(){return require("./rules/react/checked-requires-onchange-or-readonly").checkedRequiresOnchangeOrReadonly},get"react/default-props-match-prop-types"(){return require("./rules/react/default-props-match-prop-types").defaultPropsMatchPropTypes},get"react/display-name"(){return require("./rules/react/display-name").displayName},get"react/jsx-handler-names"(){return require("./rules/react/jsx-handler-names").jsxHandlerNames},get"react/jsx-max-depth"(){return require("./rules/react/jsx-max-depth").jsxMaxDepth},get"react/jsx-no-bind"(){return require("./rules/react/jsx-no-bind").jsxNoBind},get"react/jsx-no-literals"(){return require("./rules/react/jsx-no-literals").jsxNoLiterals},get"react/no-adjacent-inline-elements"(){return require("./rules/react/no-adjacent-inline-elements").noAdjacentInlineElements},get"react/no-arrow-function-lifecycle"(){return require("./rules/react/no-arrow-function-lifecycle").noArrowFunctionLifecycle},get"react/no-did-mount-set-state"(){return require("./rules/react/no-did-mount-set-state").noDidMountSetState},get"react/no-did-update-set-state"(){return require("./rules/react/no-did-update-set-state").noDidUpdateSetState},get"react/no-invalid-html-attribute"(){return require("./rules/react/no-invalid-html-attribute").noInvalidHtmlAttribute},get"react/no-is-mounted"(){return require("./rules/react/no-is-mounted").noIsMounted},get"react/no-multi-comp"(){return require("./rules/react/no-multi-comp").noMultiComp},get"react/no-namespace"(){return require("./rules/react/no-namespace").noNamespace},get"react/no-object-type-as-default-prop"(){return require("./rules/react/no-object-type-as-default-prop").noObjectTypeAsDefaultProp},get"react/no-redundant-should-component-update"(){return require("./rules/react/no-redundant-should-component-update").noRedundantShouldComponentUpdate},get"react/no-render-return-value"(){return require("./rules/react/no-render-return-value").noRenderReturnValue},get"react/no-typos"(){return require("./rules/react/no-typos").noTypos},get"react/no-unescaped-entities"(){return require("./rules/react/no-unescaped-entities").noUnescapedEntities},get"react/prefer-es6-class"(){return require("./rules/react/prefer-es6-class").preferEs6Class},get"react/prefer-stateless-function"(){return require("./rules/react/prefer-stateless-function").preferStatelessFunction},get"react/prop-types"(){return require("./rules/react/prop-types").propTypes},get"react/react-in-jsx-scope"(){return require("./rules/react/react-in-jsx-scope").reactInJsxScope},get"react/require-default-props"(){return require("./rules/react/require-default-props").requireDefaultProps},get"react/require-render-return"(){return require("./rules/react/require-render-return").requireRenderReturn},get"react/sort-comp"(){return require("./rules/react/sort-comp").sortComp},get"react/state-in-constructor"(){return require("./rules/react/state-in-constructor").stateInConstructor},get"react/static-property-placement"(){return require("./rules/react/static-property-placement").staticPropertyPlacement},get"react/hooks-exhaustive-deps"(){return require("./rules/react/hooks-exhaustive-deps").hooksExhaustiveDeps},get"react/jsx-no-target-blank"(){return require("./rules/react/jsx-no-target-blank").jsxNoTargetBlank},get"react/jsx-no-script-url"(){return require("./rules/react/jsx-no-script-url").jsxNoScriptUrl},get"react/jsx-no-duplicate-props"(){return require("./rules/react/jsx-no-duplicate-props").jsxNoDuplicateProps},get"react/no-danger-with-children"(){return require("./rules/react/no-danger-with-children").noDangerWithChildren},get"react/no-deprecated"(){return require("./rules/react/no-deprecated").noDeprecated},get"react/no-find-dom-node"(){return require("./rules/react/no-find-dom-node").noFindDomNode},get"react/no-unsafe"(){return require("./rules/react/no-unsafe").noUnsafe},get"react/void-dom-elements-no-children"(){return require("./rules/react/void-dom-elements-no-children").voidDomElementsNoChildren},get"migration/react-class-to-hooks"(){return require("./rules/migration/react-class-to-hooks").reactClassToHooks},get"performance/no-unnecessary-rerenders"(){return require("./rules/performance/no-unnecessary-rerenders").noUnnecessaryRerenders},get"performance/react-render-optimization"(){return require("./rules/performance/react-render-optimization").reactRenderOptimization},get"performance/react-no-inline-functions"(){return require("./rules/performance/react-no-inline-functions").reactNoInlineFunctions},get"component-api/no-default-test-id"(){return require("./rules/component-api/no-default-test-id").noDefaultTestId},get"component-api/require-data-slot"(){return require("./rules/component-api/require-data-slot").requireDataSlot},get"component-api/no-is-prefix-prop"(){return require("./rules/component-api/no-is-prefix-prop").noIsPrefixProp},get"component-api/no-inline-style"(){return require("./rules/component-api/no-inline-style").noInlineStyle},get"component-api/no-raw-color-literal"(){return require("./rules/component-api/no-raw-color-literal").noRawColorLiteral},get"component-api/no-arbitrary-token-class"(){return require("./rules/component-api/no-arbitrary-token-class").noArbitraryTokenClass},get"component-api/no-kind-prop-discriminator"(){return require("./rules/component-api/no-kind-prop-discriminator").noKindPropDiscriminator},get"component-api/no-wrapper-sub-component"(){return require("./rules/component-api/no-wrapper-sub-component").noWrapperSubComponent}};(0,eslint_devkit_1.withCanonicalDocsUrls)("plugin-react-features",exports.rules);exports.plugin={meta:{name:"eslint-plugin-react-features",version:"1.7.7"},rules:exports.rules};exports.configs={flagship:{plugins:{"react-features":exports.plugin},rules:{"react-features/hooks-exhaustive-deps":"error"}},recommended:{plugins:{"react-features":exports.plugin},rules:{"react-features/jsx-key":"error","react-features/no-children-prop":"warn","react-features/no-danger":"warn","react-features/no-string-refs":"error","react-features/no-unknown-property":"error","react-features/hooks-exhaustive-deps":"warn","react-features/jsx-no-target-blank":"error","react-features/jsx-no-script-url":"error","react-features/jsx-no-duplicate-props":"error","react-features/no-danger-with-children":"error","react-features/no-deprecated":"warn"}},componentApi:{plugins:{"react-features":exports.plugin},rules:{"react-features/component-api/no-default-test-id":"error","react-features/component-api/require-data-slot":"warn","react-features/component-api/no-is-prefix-prop":"warn","react-features/component-api/no-inline-style":"warn","react-features/component-api/no-raw-color-literal":"warn","react-features/component-api/no-arbitrary-token-class":"warn","react-features/component-api/no-kind-prop-discriminator":"warn","react-features/component-api/no-wrapper-sub-component":"warn"}}};exports.default=exports.plugin;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noUnnecessaryRerenders=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");function isInReactRenderContext(node){let current=node;let depth=0;const maxDepth=15;while(depth<maxDepth){const parent=current.parent;if(!parent)break;if(parent.type==="JSXElement"||parent.type==="JSXFragment"){return true}if(parent.type==="JSXAttribute"){return true}if(parent.type==="FunctionDeclaration"||parent.type==="FunctionExpression"||parent.type==="ArrowFunctionExpression"){if(parent.type==="FunctionDeclaration"&&parent.id){const name=parent.id.name;if(name&&/^[A-Z]/.test(name)){return true}}const body=parent.type==="FunctionDeclaration"?parent.body:parent.type==="FunctionExpression"?parent.body:parent.body;if(body&&body.type==="BlockStatement"){const hasJSX=body.body.some(stmt=>stmt.type==="ReturnStatement"&&stmt.argument&&(stmt.argument.type==="JSXElement"||stmt.argument.type==="JSXFragment"));if(hasJSX){return true}}}current=parent;depth++}return false}function shouldBeMemoized(node,minSize=5){if(node.type==="ObjectExpression"){const properties=node.properties.length;return properties>=minSize}if(node.type==="ArrayExpression"){const elements=node.elements.filter(el=>el!==null).length;return elements>=minSize}if(node.type==="ArrowFunctionExpression"||node.type==="FunctionExpression"){return true}return false}exports.noUnnecessaryRerenders=(0,eslint_devkit_2.createRule)({name:"no-unnecessary-rerenders",meta:{type:"suggestion",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-unnecessary-rerenders.md",description:"Detects prevented re-renders in React"},hasSuggestions:true,messages:{unnecessaryRerender:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.PERFORMANCE,issueName:"Unnecessary re-render",description:"{{expression}} causes unnecessary re-renders",severity:"MEDIUM",fix:"Use useMemo or useCallback to memoize {{expression}}",documentationLink:"https://react.dev/reference/react/useMemo"}),useMemo:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.INFO,issueName:"Use useMemo",description:"Memoize with useMemo",severity:"LOW",fix:"const memoized = useMemo(() => value, [deps])",documentationLink:"https://react.dev/reference/react/useMemo"}),useCallback:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.INFO,issueName:"Use useCallback",description:"Memoize callback with useCallback",severity:"LOW",fix:"const handler = useCallback(() => {}, [deps])",documentationLink:"https://react.dev/reference/react/useCallback"}),extractToVariable:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.INFO,issueName:"Extract Variable",description:"Extract to variable outside render",severity:"LOW",fix:"Define outside component or use useMemo",documentationLink:"https://react.dev/learn/render-and-commit"})},schema:[{type:"object",properties:{ignoreInTests:{type:"boolean",default:true},minSize:{type:"number",default:5,minimum:1}},additionalProperties:false}]},defaultOptions:[{ignoreInTests:true,minSize:5}],create(context,[options={}]){const{ignoreInTests=true,minSize=5}=options||{};const filename=context.filename;const isTestFile=ignoreInTests&&/\.(test|spec)\.(ts|tsx|js|jsx)$/.test(filename);if(isTestFile){return{}}const sourceCode=context.sourceCode;function checkJSXAttribute(node){try{if(!node.value){return}const value=node.value.type==="JSXExpressionContainer"?node.value.expression:null;if(!value){return}if(!isInReactRenderContext(value)){return}if(shouldBeMemoized(value,minSize)){let expressionText="";try{expressionText=sourceCode.getText(value).substring(0,50)}catch{expressionText="expression"}const isFunction=value.type==="ArrowFunctionExpression"||value.type==="FunctionExpression";const firstSuggestionMessageId=isFunction?"useCallback":"useMemo";context.report({node:value,messageId:"unnecessaryRerender",data:{expression:expressionText},suggest:[{messageId:firstSuggestionMessageId,fix:()=>null},{messageId:"extractToVariable",fix:()=>null}]})}}catch{return}}return{JSXAttribute:checkJSXAttribute}}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noUnnecessaryRerenders=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");function isInReactRenderContext(node){let current=node;let depth=0;const maxDepth=15;while(depth<maxDepth){const parent=current.parent;if(!parent)break;if(parent.type==="JSXElement"||parent.type==="JSXFragment"){return true}if(parent.type==="JSXAttribute"){return true}if(parent.type==="FunctionDeclaration"||parent.type==="FunctionExpression"||parent.type==="ArrowFunctionExpression"){if(parent.type==="FunctionDeclaration"&&parent.id){const name=parent.id.name;if(name&&/^[A-Z]/.test(name)){return true}}const body=parent.type==="FunctionDeclaration"?parent.body:parent.type==="FunctionExpression"?parent.body:parent.body;if(body&&body.type==="BlockStatement"){const hasJSX=body.body.some(stmt=>stmt.type==="ReturnStatement"&&stmt.argument&&(stmt.argument.type==="JSXElement"||stmt.argument.type==="JSXFragment"));if(hasJSX){return true}}}current=parent;depth++}return false}function shouldBeMemoized(node,minSize=5){if(node.type==="ObjectExpression"){const properties=node.properties.length;return properties>=minSize}if(node.type==="ArrayExpression"){const elements=node.elements.filter(el=>el!==null).length;return elements>=minSize}if(node.type==="ArrowFunctionExpression"||node.type==="FunctionExpression"){return true}return false}exports.noUnnecessaryRerenders=(0,eslint_devkit_2.createRule)({name:"no-unnecessary-rerenders",meta:{type:"suggestion",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-unnecessary-rerenders.md",description:"Detects prevented re-renders in React"},hasSuggestions:true,messages:{unnecessaryRerender:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.PERFORMANCE,issueName:"Unnecessary re-render",description:"{{expression}} causes unnecessary re-renders",severity:"MEDIUM",fix:"Use useMemo or useCallback to memoize {{expression}}",documentationLink:"https://react.dev/reference/react/useMemo"}),useMemo:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.INFO,issueName:"Use useMemo",description:"Memoize with useMemo",severity:"LOW",fix:"const memoized = useMemo(() => value, [deps])",documentationLink:"https://react.dev/reference/react/useMemo"}),useCallback:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.INFO,issueName:"Use useCallback",description:"Memoize callback with useCallback",severity:"LOW",fix:"const handler = useCallback(() => {}, [deps])",documentationLink:"https://react.dev/reference/react/useCallback"}),extractToVariable:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.INFO,issueName:"Extract Variable",description:"Extract to variable outside render",severity:"LOW",fix:"Define outside component or use useMemo",documentationLink:"https://react.dev/learn/render-and-commit"})},schema:[{type:"object",properties:{ignoreInTests:{type:"boolean",default:true},minSize:{type:"number",default:5,minimum:1}},additionalProperties:false}]},defaultOptions:[{ignoreInTests:true,minSize:5}],create(context,[options={}]){const{ignoreInTests=true,minSize=5}=options||{};const filename=context.filename;const isTestFile=ignoreInTests&&/\.(test|spec)\.(ts|tsx|js|jsx)$/.test(filename);if(isTestFile){return{}}const sourceCode=context.sourceCode;function checkJSXAttribute(node){try{if(!node.value){return}const value=node.value.type==="JSXExpressionContainer"?node.value.expression:null;if(!value){return}if(!isInReactRenderContext(value)){return}if(shouldBeMemoized(value,minSize)){let expressionText="";try{expressionText=sourceCode.getText(value).replace(/\s+/g," ").trim().substring(0,50)}catch{expressionText="expression"}const isFunction=value.type==="ArrowFunctionExpression"||value.type==="FunctionExpression";const firstSuggestionMessageId=isFunction?"useCallback":"useMemo";context.report({node:value,messageId:"unnecessaryRerender",data:{expression:expressionText},suggest:[{messageId:firstSuggestionMessageId,fix:()=>null},{messageId:"extractToVariable",fix:()=>null}]})}}catch{return}}return{JSXAttribute:checkJSXAttribute}}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.jsxNoTargetBlank=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.jsxNoTargetBlank=(0,eslint_devkit_2.createRule)({name:"jsx-no-target-blank",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/jsx-no-target-blank.md",description:'Forbid target="_blank" without rel="noopener noreferrer"',cwe:"CWE-1022",cvss:7.5},fixable:"code",messages:{noTargetBlank:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.SECURITY,issueName:'Unsafe target="_blank"',cwe:"CWE-1022",description:'Using target="_blank" without rel="noopener noreferrer" is a security risk',severity:"HIGH",fix:'Add rel="noopener noreferrer" to prevent reverse tabnabbing',documentationLink:"https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md"}),noRelWithoutNoopener:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.SECURITY,issueName:"Missing noopener",cwe:"CWE-1022",description:'rel attribute is missing "noopener" value',severity:"MEDIUM",fix:'Add "noopener" to the rel attribute',documentationLink:"https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md"})},schema:[{type:"object",properties:{allowReferrer:{type:"boolean",default:false},enforceDynamicLinks:{type:"string",enum:["always","never"],default:"always"},warnOnSpreadAttributes:{type:"boolean",default:false},links:{type:"boolean",default:true},forms:{type:"boolean",default:false}},additionalProperties:false}]},defaultOptions:[{}],create(context,[options={}]){const{allowReferrer=false,enforceDynamicLinks="always",warnOnSpreadAttributes=false,links=true,forms=false}=options??{};const elementsToCheck=[];if(links)elementsToCheck.push("a");if(forms)elementsToCheck.push("form");function hasTargetBlank(node){const targetAttr=node.attributes.find(attr=>attr.type==="JSXAttribute"&&attr.name.type==="JSXIdentifier"&&attr.name.name==="target");if(!targetAttr||!targetAttr.value)return false;if(targetAttr.value.type==="Literal"){return targetAttr.value.value==="_blank"}if(enforceDynamicLinks==="always"){return true}return false}function hasExternalHref(node){const hrefAttr=node.attributes.find(attr=>attr.type==="JSXAttribute"&&attr.name.type==="JSXIdentifier"&&attr.name.name==="href");if(!hrefAttr||!hrefAttr.value)return false;const staticText1=(0,eslint_devkit_1.staticString)(hrefAttr.value);if(staticText1!==null){const href=staticText1;return/^(https?:)?\/\//.test(href)||href.startsWith("//")}return enforceDynamicLinks==="always"}function getRelAttribute(node){return node.attributes.find(attr=>attr.type==="JSXAttribute"&&attr.name.type==="JSXIdentifier"&&attr.name.name==="rel")}function hasNoopener(relAttr){if(!relAttr.value)return false;const staticText2=(0,eslint_devkit_1.staticString)(relAttr.value);if(staticText2!==null){const relValues=staticText2.toLowerCase().split(/\s+/);return relValues.includes("noopener")}return false}function hasNoreferrer(relAttr){if(!relAttr.value)return false;const staticText3=(0,eslint_devkit_1.staticString)(relAttr.value);if(staticText3!==null){const relValues=staticText3.toLowerCase().split(/\s+/);return relValues.includes("noreferrer")}return false}function hasSpreadAttribute(node){return node.attributes.some(attr=>attr.type==="JSXSpreadAttribute")}return{JSXOpeningElement(node){if(node.name.type!=="JSXIdentifier"||!elementsToCheck.includes(node.name.name)){return}if(hasSpreadAttribute(node)&&!warnOnSpreadAttributes){return}if(!hasTargetBlank(node)){return}if(node.name.name==="a"&&!hasExternalHref(node)){return}const relAttr=getRelAttribute(node);const hasNoopenerValue=relAttr?hasNoopener(relAttr):false;const hasNoreferrerValue=relAttr?hasNoreferrer(relAttr):false;if(hasNoopenerValue||hasNoreferrerValue){if(!allowReferrer&&!hasNoreferrerValue){return}return}context.report({node,messageId:relAttr?"noRelWithoutNoopener":"noTargetBlank",fix:fixer=>{if(relAttr&&relAttr.value&&relAttr.value.type==="Literal"){const currentRel=String((0,eslint_devkit_1.staticString)(relAttr.value));const newRel=allowReferrer?`${currentRel} noopener`.trim():`${currentRel} noopener noreferrer`.trim();return fixer.replaceText(relAttr.value,`"${newRel}"`)}else if(!relAttr){const lastAttr=node.attributes[node.attributes.length-1];const relValue=allowReferrer?"noopener":"noopener noreferrer";if(lastAttr){return fixer.insertTextAfter(lastAttr,` rel="${relValue}"`)}return fixer.insertTextAfter(node.name,` rel="${relValue}"`)}return null}})}}}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.jsxNoTargetBlank=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.jsxNoTargetBlank=(0,eslint_devkit_2.createRule)({name:"jsx-no-target-blank",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/jsx-no-target-blank.md",description:'Forbid target="_blank" without rel="noopener noreferrer"',cwe:"CWE-1022",cvss:7.5},fixable:"code",messages:{noTargetBlank:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.SECURITY,issueName:'Unsafe target="_blank"',cwe:"CWE-1022",description:'Using target="_blank" without rel="noopener noreferrer" is a security risk',severity:"HIGH",fix:'Add rel="noopener noreferrer" to prevent reverse tabnabbing',documentationLink:"https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md"}),noRelWithoutNoopener:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.SECURITY,issueName:"Missing noopener",cwe:"CWE-1022",description:'rel attribute is missing "noopener" value',severity:"MEDIUM",fix:'Add "noopener" to the rel attribute',documentationLink:"https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md"})},schema:[{type:"object",properties:{allowReferrer:{type:"boolean",default:false},enforceDynamicLinks:{type:"string",enum:["always","never"],default:"always"},warnOnSpreadAttributes:{type:"boolean",default:false},links:{type:"boolean",default:true},forms:{type:"boolean",default:false}},additionalProperties:false}]},defaultOptions:[{}],create(context,[options={}]){const{allowReferrer=false,enforceDynamicLinks="always",warnOnSpreadAttributes=false,links=true,forms=false}=options??{};const elementsToCheck=[];if(links)elementsToCheck.push("a");if(forms)elementsToCheck.push("form");function hasTargetBlank(node){const targetAttr=node.attributes.find(attr=>attr.type==="JSXAttribute"&&attr.name.type==="JSXIdentifier"&&attr.name.name==="target");if(!targetAttr||!targetAttr.value)return false;const targetValue=targetAttr.value.type==="JSXExpressionContainer"?targetAttr.value.expression:targetAttr.value;const staticTarget=(0,eslint_devkit_1.staticString)(targetValue);if(staticTarget!==null){return staticTarget==="_blank"}if(enforceDynamicLinks==="always"){return true}return false}function hasExternalHref(node){const hrefAttr=node.attributes.find(attr=>attr.type==="JSXAttribute"&&attr.name.type==="JSXIdentifier"&&attr.name.name==="href");if(!hrefAttr||!hrefAttr.value)return false;const staticText1=(0,eslint_devkit_1.staticString)(hrefAttr.value);if(staticText1!==null){const href=staticText1;return/^(https?:)?\/\//.test(href)||href.startsWith("//")}return enforceDynamicLinks==="always"}function getRelAttribute(node){return node.attributes.find(attr=>attr.type==="JSXAttribute"&&attr.name.type==="JSXIdentifier"&&attr.name.name==="rel")}function hasNoopener(relAttr){if(!relAttr.value)return false;const staticText2=(0,eslint_devkit_1.staticString)(relAttr.value);if(staticText2!==null){const relValues=staticText2.toLowerCase().split(/\s+/);return relValues.includes("noopener")}return false}function hasNoreferrer(relAttr){if(!relAttr.value)return false;const staticText3=(0,eslint_devkit_1.staticString)(relAttr.value);if(staticText3!==null){const relValues=staticText3.toLowerCase().split(/\s+/);return relValues.includes("noreferrer")}return false}function hasSpreadAttribute(node){return node.attributes.some(attr=>attr.type==="JSXSpreadAttribute")}return{JSXOpeningElement(node){if(node.name.type!=="JSXIdentifier"||!elementsToCheck.includes(node.name.name)){return}if(hasSpreadAttribute(node)&&!warnOnSpreadAttributes){return}if(!hasTargetBlank(node)){return}if(node.name.name==="a"&&!hasExternalHref(node)){return}const relAttr=getRelAttribute(node);const hasNoopenerValue=relAttr?hasNoopener(relAttr):false;const hasNoreferrerValue=relAttr?hasNoreferrer(relAttr):false;if(hasNoopenerValue||hasNoreferrerValue){if(!allowReferrer&&!hasNoreferrerValue){return}return}context.report({node,messageId:relAttr?"noRelWithoutNoopener":"noTargetBlank",fix:fixer=>{if(relAttr&&relAttr.value&&relAttr.value.type==="Literal"){const currentRel=String((0,eslint_devkit_1.staticString)(relAttr.value));const newRel=allowReferrer?`${currentRel} noopener`.trim():`${currentRel} noopener noreferrer`.trim();return fixer.replaceText(relAttr.value,`"${newRel}"`)}else if(!relAttr){const lastAttr=node.attributes[node.attributes.length-1];const relValue=allowReferrer?"noopener":"noopener noreferrer";if(lastAttr){return fixer.insertTextAfter(lastAttr,` rel="${relValue}"`)}return fixer.insertTextAfter(node.name,` rel="${relValue}"`)}return null}})}}}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.requireRenderReturn=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.requireRenderReturn=(0,eslint_devkit_1.createRule)({name:"require-render-return",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/require-render-return.md",description:"Require render methods to return"},schema:[],messages:{requireRenderReturn:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Missing Render Return",description:"Render method must return a value",severity:"CRITICAL",fix:"Add return statement or return JSX/null",documentationLink:"https://react.dev/reference/react/Component#render"})}},defaultOptions:[],create(context){return{MethodDefinition(node){if(node.key.type==="Identifier"&&node.key.name==="render"&&node.value.type==="FunctionExpression"){const body=node.value.body;if(!hasReturnStatement(body)){context.report({node:node.key,messageId:"requireRenderReturn"})}}}};function hasReturnStatement(node){if(node.type==="BlockStatement"){for(const statement of node.body){if(checkStatement(statement)){return true}}return false}return checkStatement(node)}function checkStatement(statement){if(statement.type==="ReturnStatement"){return true}if(statement.type==="IfStatement"){if(hasReturnStatement(statement.consequent)||statement.alternate&&hasReturnStatement(statement.alternate)){return true}}if(statement.type==="BlockStatement"){return hasReturnStatement(statement)}if(statement.type==="SwitchStatement"){for(const switchCase of statement.cases){for(const caseStatement of switchCase.consequent){if(caseStatement.type==="ReturnStatement"){return true}}}}return false}}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.requireRenderReturn=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.requireRenderReturn=(0,eslint_devkit_1.createRule)({name:"require-render-return",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/require-render-return.md",description:"Require render methods to return"},schema:[],messages:{requireRenderReturn:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Missing Render Return",description:"Render method must return a value",severity:"CRITICAL",fix:"Add return statement or return JSX/null",documentationLink:"https://react.dev/reference/react/Component#render"})}},defaultOptions:[],create(context){return{MethodDefinition(node){if(node.key.type==="Identifier"&&node.key.name==="render"&&node.value.type==="FunctionExpression"){const body=node.value.body;if(!hasReturnStatement(body)){context.report({node:node.key,messageId:"requireRenderReturn"})}}}};function hasReturnStatement(node){if(node.type==="BlockStatement"){for(const statement of node.body){if(checkStatement(statement)){return true}}return false}return checkStatement(node)}function checkStatement(statement){if(statement.type==="ReturnStatement"){return true}if(statement.type==="IfStatement"){return statement.alternate!=null&&hasReturnStatement(statement.consequent)&&hasReturnStatement(statement.alternate)}if(statement.type==="BlockStatement"){return hasReturnStatement(statement)}if(statement.type==="SwitchStatement"){if(!statement.cases.some(switchCase=>switchCase.test===null)){return false}let covered=false;for(let i=statement.cases.length-1;i>=0;i--){const{consequent}=statement.cases[i];if(consequent.some(caseStatement=>checkStatement(caseStatement))){covered=true}else if(consequent[consequent.length-1]?.type==="BreakStatement"){covered=false}if(!covered)return false}return true}return false}}});