eslint-plugin-react-features 1.7.8 → 1.7.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-features",
3
- "version": "1.7.8",
3
+ "version": "1.7.9",
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",
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.8"},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.9"},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.noIsPrefixProp=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const stripIsPrefix=name=>name.slice(2,3).toLowerCase()+name.slice(3);exports.noIsPrefixProp=(0,eslint_devkit_1.createRule)({name:"no-is-prefix-prop",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-is-prefix-prop.md",description:"Boolean props must not be prefixed with `is` (R8)"},hasSuggestions:true,schema:[],messages:{isPrefix:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.WARNING,issueName:"`is` prefix on boolean prop",description:"Boolean prop `{{name}}` should be renamed to `{{suggested}}` (R8)",severity:"MEDIUM",fix:"Rename to `{{suggested}}` \u2014 booleans describe the true state directly.",documentationLink:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-is-prefix-prop.md"}),renameSuggestion:"Rename to `{{suggested}}` (also rename consumer call sites manually)"}},defaultOptions:[],create(context){return{TSPropertySignature(node){if(node.key.type!=="Identifier")return;const{name}=node.key;if(!/^is[A-Z]/.test(name))return;const ann=node.typeAnnotation?.typeAnnotation;if(!ann||ann.type!=="TSBooleanKeyword")return;const suggested=stripIsPrefix(name);const keyNode=node.key;context.report({node:keyNode,messageId:"isPrefix",data:{name,suggested},suggest:[{messageId:"renameSuggestion",data:{suggested},fix(fixer){return fixer.replaceText(keyNode,suggested)}}]})}}}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noIsPrefixProp=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const stripIsPrefix=name=>{const rest=name.slice(2);const run=rest.length-rest.replace(/^[A-Z]+/,"").length;const lower=run>1&&/[a-z]/.test(rest[run]??"")?run-1:run;return rest.slice(0,lower).toLowerCase()+rest.slice(lower)};exports.noIsPrefixProp=(0,eslint_devkit_1.createRule)({name:"no-is-prefix-prop",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-is-prefix-prop.md",description:"Boolean props must not be prefixed with `is` (R8)"},hasSuggestions:true,schema:[],messages:{isPrefix:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.WARNING,issueName:"`is` prefix on boolean prop",description:"Boolean prop `{{name}}` should be renamed to `{{suggested}}` (R8)",severity:"MEDIUM",fix:"Rename to `{{suggested}}` \u2014 booleans describe the true state directly.",documentationLink:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-is-prefix-prop.md"}),renameSuggestion:"Rename to `{{suggested}}` (also rename consumer call sites manually)"}},defaultOptions:[],create(context){return{TSPropertySignature(node){if(node.key.type!=="Identifier")return;const{name}=node.key;if(!/^is[A-Z]/.test(name))return;const ann=node.typeAnnotation?.typeAnnotation;if(!ann||ann.type!=="TSBooleanKeyword")return;const suggested=stripIsPrefix(name);const keyNode=node.key;context.report({node:keyNode,messageId:"isPrefix",data:{name,suggested},suggest:[{messageId:"renameSuggestion",data:{suggested},fix(fixer){return fixer.replaceText(keyNode,suggested)}}]})}}}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.jsxKey=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.jsxKey=(0,eslint_devkit_1.createRule)({name:"jsx-key",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/jsx-key.md",description:"Detect missing or problematic React keys that could break reconciliation"},hasSuggestions:true,messages:{missingKey:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Missing React Key",description:"Missing key prop for element in iterator",severity:"HIGH",fix:"Add unique, stable key prop based on item data",documentationLink:"https://react.dev/learn/render-and-commit#lists-and-keys"}),invalidKey:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Invalid React Key",description:"Key prop should be unique and stable",severity:"MEDIUM",fix:"Use item.id, item.key, or index as last resort",documentationLink:"https://react.dev/learn/render-and-commit#lists-and-keys"}),duplicateKey:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Duplicate React Key",description:"Duplicate key values can break reconciliation",severity:"HIGH",fix:"Ensure all keys in the array are unique",documentationLink:"https://react.dev/learn/render-and-commit#lists-and-keys"}),unstableKey:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Unstable React Key",description:"Using index as key can cause reconciliation issues",severity:"MEDIUM",fix:"Use stable identifier from data instead of array index",documentationLink:"https://react.dev/learn/render-and-commit#lists-and-keys"}),suggestKey:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.INFO,issueName:"Add Key Prop",description:"Add unique key prop to element",severity:"LOW",fix:"key={item.id}",documentationLink:"https://react.dev/learn/render-and-commit#lists-and-keys"})},schema:[{type:"object",properties:{warnUnstableKeys:{type:"boolean",default:true}},additionalProperties:false}]},defaultOptions:[{warnUnstableKeys:true}],create(context){const[options]=context.options;const{warnUnstableKeys=true}=options||{};const keyTracker=new Map;function resetKeyTracker(){keyTracker.clear()}const ITERATOR_METHODS=new Set(["map","forEach","flatMap"]);function isIteratorCall(node){if(node.type!=="CallExpression"){return false}const{callee}=node;if(callee.type==="MemberExpression"&&(0,eslint_devkit_1.namesOneOf)((0,eslint_devkit_1.propertyName)(callee),ITERATOR_METHODS)){return true}if(callee.type==="MemberExpression"&&callee.object.type==="Identifier"&&callee.object.name==="Array"&&(0,eslint_devkit_1.propertyName)(callee)==="from"&&node.arguments.length>=2){const mapFn=node.arguments[1];if(mapFn.type==="ArrowFunctionExpression"||mapFn.type==="FunctionExpression"){return true}}return false}function isInsideArrayFromMapFn(node){let current=node;while(current?.parent){const parent=current.parent;if(parent.type==="ArrowFunctionExpression"||parent.type==="FunctionExpression"){const grandParent=parent.parent;if(grandParent?.type==="CallExpression"&&grandParent.callee.type==="MemberExpression"&&grandParent.callee.object.type==="Identifier"&&grandParent.callee.object.name==="Array"&&(0,eslint_devkit_1.propertyName)(grandParent.callee)==="from"&&grandParent.arguments[1]===parent){return true}}current=parent}return false}function isInsideChildrenMap(node){let current=node;while(current?.parent){const parent=current.parent;if(parent.type==="ArrowFunctionExpression"||parent.type==="FunctionExpression"){const grandParent=parent.parent;if(grandParent?.type==="CallExpression"){const callee=grandParent.callee;if(callee.type==="MemberExpression"&&(0,eslint_devkit_1.propertyName)(callee)==="map"){const obj=callee.object;if(obj.type==="Identifier"&&obj.name==="Children"){return true}if(obj.type==="MemberExpression"&&obj.object.type==="Identifier"&&obj.object.name==="React"&&(0,eslint_devkit_1.propertyName)(obj)==="Children"){return true}}}}current=parent}return false}function isDirectIteratorReturn(node){if(isInsideArrayFromMapFn(node)){return isDirectReturnFromFunction(node)}if(isInsideChildrenMap(node)){return isDirectReturnFromFunction(node)}let current=node;while(current.parent){const parent=current.parent;if(parent.type==="JSXElement"||parent.type==="JSXFragment"){return false}if(parent.type==="ArrowFunctionExpression"&&parent.body===current){if(parent.parent&&isIteratorCall(parent.parent)){return true}}if(parent.type==="ReturnStatement"&&parent.argument===current){let funcParent=parent.parent;while(funcParent){if(funcParent.type==="ArrowFunctionExpression"||funcParent.type==="FunctionExpression"){if(funcParent.parent&&isIteratorCall(funcParent.parent)){return true}break}if(funcParent.type==="BlockStatement"){funcParent=funcParent.parent;continue}break}}if(parent.type==="JSXExpressionContainer"){if(current.type==="JSXElement"&&parent.parent?.type==="JSXElement"){return false}}if(parent.type==="ConditionalExpression"||parent.type==="LogicalExpression"||parent.type==="SequenceExpression"){current=parent;continue}if(parent.type==="CallExpression"){break}current=parent}return false}function isDirectReturnFromFunction(node){let current=node;while(current.parent){const parent=current.parent;if(parent.type==="JSXElement"||parent.type==="JSXFragment"){return false}if(parent.type==="ArrowFunctionExpression"&&parent.body===current){return true}if(parent.type==="ReturnStatement"&&parent.argument===current){return true}if(parent.type==="ConditionalExpression"||parent.type==="LogicalExpression"){current=parent;continue}current=parent}return false}function getIteratorCallbackParamName(node){let current=node;while(current.parent){const parent=current.parent;const grandParent=parent.parent;if(parent.type==="ArrowFunctionExpression"&&parent.params.length>0&&parent.params[0].type==="Identifier"&&grandParent&&isIteratorCall(grandParent)){return parent.params[0].name}if(parent.type==="FunctionExpression"&&parent.params.length>0&&parent.params[0].type==="Identifier"&&grandParent&&isIteratorCall(grandParent)){return parent.params[0].name}if(parent.type==="ReturnStatement"){let funcParent=parent.parent;while(funcParent){if((funcParent.type==="ArrowFunctionExpression"||funcParent.type==="FunctionExpression")&&funcParent.params.length>0&&funcParent.params[0].type==="Identifier"){if(funcParent.parent&&isIteratorCall(funcParent.parent)){return funcParent.params[0].name}break}if(funcParent.type==="BlockStatement"){funcParent=funcParent.parent;continue}break}}current=parent}return"item"}function checkJSXElementInIteration(node){const isDirectReturn=isDirectIteratorReturn(node);if(!isDirectReturn){return}const keyProp=node.openingElement.attributes.find(attr=>attr.type==="JSXAttribute"&&attr.name.type==="JSXIdentifier"&&attr.name.name==="key");if(!keyProp){const paramName=getIteratorCallbackParamName(node);context.report({node:node.openingElement,messageId:"missingKey",suggest:[{messageId:"suggestKey",fix(fixer){return fixer.insertTextAfter(node.openingElement.name,` key={${paramName}.id}`)}}]});return}if(keyProp.type==="JSXAttribute"&&keyProp.value){const keyValue=keyProp.value;if(warnUnstableKeys&&keyValue.type==="JSXExpressionContainer"&&keyValue.expression.type==="Identifier"&&["i","index","idx","key"].includes(keyValue.expression.name)){context.report({node:keyProp,messageId:"unstableKey"})}}}return{JSXElement(node){checkJSXElementInIteration(node)},CallExpression(node){if(isIteratorCall(node)){resetKeyTracker()}}}}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.jsxKey=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");const keyExpressionForParam=param=>{if(param.type===eslint_devkit_1.AST_NODE_TYPES.AssignmentPattern){return keyExpressionForParam(param.left)}if(param.type===eslint_devkit_1.AST_NODE_TYPES.Identifier)return`${param.name}.id`;if(param.type===eslint_devkit_1.AST_NODE_TYPES.ObjectPattern){for(const prop of param.properties){if(prop.type!==eslint_devkit_1.AST_NODE_TYPES.Property)continue;if((0,eslint_devkit_1.objectKeyName)(prop)!=="id")continue;const bound=prop.value.type===eslint_devkit_1.AST_NODE_TYPES.AssignmentPattern?prop.value.left:prop.value;if(bound.type===eslint_devkit_1.AST_NODE_TYPES.Identifier)return bound.name}}return null};const keyExpressionForCallback=fn=>fn.params.length>0?keyExpressionForParam(fn.params[0]):null;exports.jsxKey=(0,eslint_devkit_1.createRule)({name:"jsx-key",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/jsx-key.md",description:"Detect missing or problematic React keys that could break reconciliation"},hasSuggestions:true,messages:{missingKey:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Missing React Key",description:"Missing key prop for element in iterator",severity:"HIGH",fix:"Add unique, stable key prop based on item data",documentationLink:"https://react.dev/learn/render-and-commit#lists-and-keys"}),invalidKey:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Invalid React Key",description:"Key prop should be unique and stable",severity:"MEDIUM",fix:"Use item.id, item.key, or index as last resort",documentationLink:"https://react.dev/learn/render-and-commit#lists-and-keys"}),duplicateKey:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Duplicate React Key",description:"Duplicate key values can break reconciliation",severity:"HIGH",fix:"Ensure all keys in the array are unique",documentationLink:"https://react.dev/learn/render-and-commit#lists-and-keys"}),unstableKey:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Unstable React Key",description:"Using index as key can cause reconciliation issues",severity:"MEDIUM",fix:"Use stable identifier from data instead of array index",documentationLink:"https://react.dev/learn/render-and-commit#lists-and-keys"}),suggestKey:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.INFO,issueName:"Add Key Prop",description:"Add unique key prop to element",severity:"LOW",fix:"key={item.id}",documentationLink:"https://react.dev/learn/render-and-commit#lists-and-keys"})},schema:[{type:"object",properties:{warnUnstableKeys:{type:"boolean",default:true}},additionalProperties:false}]},defaultOptions:[{warnUnstableKeys:true}],create(context){const[options]=context.options;const{warnUnstableKeys=true}=options||{};const keyTracker=new Map;function resetKeyTracker(){keyTracker.clear()}const ITERATOR_METHODS=new Set(["map","forEach","flatMap"]);function isIteratorCall(node){if(node.type!=="CallExpression"){return false}const{callee}=node;if(callee.type==="MemberExpression"&&(0,eslint_devkit_1.namesOneOf)((0,eslint_devkit_1.propertyName)(callee),ITERATOR_METHODS)){return true}if(callee.type==="MemberExpression"&&callee.object.type==="Identifier"&&callee.object.name==="Array"&&(0,eslint_devkit_1.propertyName)(callee)==="from"&&node.arguments.length>=2){const mapFn=node.arguments[1];if(mapFn.type==="ArrowFunctionExpression"||mapFn.type==="FunctionExpression"){return true}}return false}function isInsideArrayFromMapFn(node){let current=node;while(current?.parent){const parent=current.parent;if(parent.type==="ArrowFunctionExpression"||parent.type==="FunctionExpression"){const grandParent=parent.parent;if(grandParent?.type==="CallExpression"&&grandParent.callee.type==="MemberExpression"&&grandParent.callee.object.type==="Identifier"&&grandParent.callee.object.name==="Array"&&(0,eslint_devkit_1.propertyName)(grandParent.callee)==="from"&&grandParent.arguments[1]===parent){return true}}current=parent}return false}function isInsideChildrenMap(node){let current=node;while(current?.parent){const parent=current.parent;if(parent.type==="ArrowFunctionExpression"||parent.type==="FunctionExpression"){const grandParent=parent.parent;if(grandParent?.type==="CallExpression"){const callee=grandParent.callee;if(callee.type==="MemberExpression"&&(0,eslint_devkit_1.propertyName)(callee)==="map"){const obj=callee.object;if(obj.type==="Identifier"&&obj.name==="Children"){return true}if(obj.type==="MemberExpression"&&obj.object.type==="Identifier"&&obj.object.name==="React"&&(0,eslint_devkit_1.propertyName)(obj)==="Children"){return true}}}}current=parent}return false}function isDirectIteratorReturn(node){if(isInsideArrayFromMapFn(node)){return isDirectReturnFromFunction(node)}if(isInsideChildrenMap(node)){return isDirectReturnFromFunction(node)}let current=node;while(current.parent){const parent=current.parent;if(parent.type==="JSXElement"||parent.type==="JSXFragment"){return false}if(parent.type==="ArrowFunctionExpression"&&parent.body===current){if(parent.parent&&isIteratorCall(parent.parent)){return true}}if(parent.type==="ReturnStatement"&&parent.argument===current){let funcParent=parent.parent;while(funcParent){if(funcParent.type==="ArrowFunctionExpression"||funcParent.type==="FunctionExpression"){if(funcParent.parent&&isIteratorCall(funcParent.parent)){return true}break}if(funcParent.type==="BlockStatement"){funcParent=funcParent.parent;continue}break}}if(parent.type==="JSXExpressionContainer"){if(current.type==="JSXElement"&&parent.parent?.type==="JSXElement"){return false}}if(parent.type==="ConditionalExpression"||parent.type==="LogicalExpression"||parent.type==="SequenceExpression"){current=parent;continue}if(parent.type==="CallExpression"){break}current=parent}return false}function isDirectReturnFromFunction(node){let current=node;while(current.parent){const parent=current.parent;if(parent.type==="JSXElement"||parent.type==="JSXFragment"){return false}if(parent.type==="ArrowFunctionExpression"&&parent.body===current){return true}if(parent.type==="ReturnStatement"&&parent.argument===current){return true}if(parent.type==="ConditionalExpression"||parent.type==="LogicalExpression"){current=parent;continue}current=parent}return false}function getIteratorKeyExpression(node){let current=node.parent;while(!((current.type===eslint_devkit_1.AST_NODE_TYPES.ArrowFunctionExpression||current.type===eslint_devkit_1.AST_NODE_TYPES.FunctionExpression)&&isIteratorCall(current.parent))){current=current.parent}return keyExpressionForCallback(current)}function checkJSXElementInIteration(node){const isDirectReturn=isDirectIteratorReturn(node);if(!isDirectReturn){return}const keyProp=node.openingElement.attributes.find(attr=>attr.type==="JSXAttribute"&&attr.name.type==="JSXIdentifier"&&attr.name.name==="key");if(!keyProp){const keyExpression=getIteratorKeyExpression(node);context.report({node:node.openingElement,messageId:"missingKey",...keyExpression===null?{}:{suggest:[{messageId:"suggestKey",fix(fixer){return fixer.insertTextAfter(node.openingElement.name,` key={${keyExpression}}`)}}]}});return}if(keyProp.type==="JSXAttribute"&&keyProp.value){const keyValue=keyProp.value;if(warnUnstableKeys&&keyValue.type==="JSXExpressionContainer"&&keyValue.expression.type==="Identifier"&&["i","index","idx","key"].includes(keyValue.expression.name)){context.report({node:keyProp,messageId:"unstableKey"})}}}return{JSXElement(node){checkJSXElementInIteration(node)},CallExpression(node){if(isIteratorCall(node)){resetKeyTracker()}}}}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noObjectTypeAsDefaultProp=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.noObjectTypeAsDefaultProp=(0,eslint_devkit_1.createRule)({name:"no-object-type-as-default-prop",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-object-type-as-default-prop.md",description:"Prevent object types as default props"},messages:{noObjectTypeAsDefaultProp:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Object as Default Prop",description:"Object used as default prop value",severity:"MEDIUM",fix:"Create object outside component or use factory function",documentationLink:"https://react.dev/learn/passing-props-to-a-component#default-props"})},schema:[]},defaultOptions:[],create(context){return{'PropertyDefinition[key.name="defaultProps"]'(node){if(node.value&&node.value.type==="ObjectExpression"){for(const prop of node.value.properties){if(prop.type==="Property"&&prop.value.type==="ObjectExpression"){context.report({node:prop.key,messageId:"noObjectTypeAsDefaultProp"})}}}},AssignmentPattern(node){if(node.right.type==="ObjectExpression"){if(node.parent.type==="Property"||node.parent.type==="RestElement"){context.report({node:node.left,messageId:"noObjectTypeAsDefaultProp"})}}}}}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noObjectTypeAsDefaultProp=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");const isInParameterPosition=node=>{let current=node;let parent=current.parent;while(parent.type===eslint_devkit_1.AST_NODE_TYPES.Property||parent.type===eslint_devkit_1.AST_NODE_TYPES.ObjectPattern||parent.type===eslint_devkit_1.AST_NODE_TYPES.ArrayPattern||parent.type===eslint_devkit_1.AST_NODE_TYPES.RestElement||parent.type===eslint_devkit_1.AST_NODE_TYPES.AssignmentPattern){current=parent;parent=current.parent}return"params"in parent&&Array.isArray(parent.params)&&parent.params.includes(current)};exports.noObjectTypeAsDefaultProp=(0,eslint_devkit_1.createRule)({name:"no-object-type-as-default-prop",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-object-type-as-default-prop.md",description:"Prevent object types as default props"},messages:{noObjectTypeAsDefaultProp:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Object as Default Prop",description:"Object used as default prop value",severity:"MEDIUM",fix:"Create object outside component or use factory function",documentationLink:"https://react.dev/learn/passing-props-to-a-component#default-props"})},schema:[]},defaultOptions:[],create(context){return{'PropertyDefinition[key.name="defaultProps"]'(node){if(node.value&&node.value.type==="ObjectExpression"){for(const prop of node.value.properties){if(prop.type==="Property"&&prop.value.type==="ObjectExpression"){context.report({node:prop.key,messageId:"noObjectTypeAsDefaultProp"})}}}},AssignmentPattern(node){const inDestructuring=node.parent.type===eslint_devkit_1.AST_NODE_TYPES.Property||node.parent.type===eslint_devkit_1.AST_NODE_TYPES.RestElement;if(node.right.type==="ObjectExpression"&&inDestructuring&&isInParameterPosition(node)){context.report({node:node.left,messageId:"noObjectTypeAsDefaultProp"})}}}}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noThisInSfc=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.noThisInSfc=(0,eslint_devkit_1.createRule)({name:"no-this-in-sfc",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-this-in-sfc.md",description:"Disallow this from being used in stateless functional components"},schema:[],messages:{noThisInSfc:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Invalid this usage",description:"this cannot be used in stateless functional components",severity:"HIGH",fix:"Convert to class component or use hooks for state",documentationLink:"https://react.dev/learn/your-first-component"})}},defaultOptions:[],create(context){let inClassContext=false;return{ClassDeclaration(){inClassContext=true},"ClassDeclaration:exit"(){inClassContext=false},ClassExpression(){inClassContext=true},"ClassExpression:exit"(){inClassContext=false},MethodDefinition(){},ThisExpression(node){if(inClassContext){return}context.report({node,messageId:"noThisInSfc"})}}}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noThisInSfc=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const eslint_devkit_2=require("@interlace/eslint-devkit");exports.noThisInSfc=(0,eslint_devkit_1.createRule)({name:"no-this-in-sfc",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/no-this-in-sfc.md",description:"Disallow this from being used in stateless functional components"},schema:[],messages:{noThisInSfc:(0,eslint_devkit_2.formatLLMMessage)({icon:eslint_devkit_2.MessageIcons.WARNING,issueName:"Invalid this usage",description:"this cannot be used in stateless functional components",severity:"HIGH",fix:"Convert to class component or use hooks for state",documentationLink:"https://react.dev/learn/your-first-component"})}},defaultOptions:[],create(context){let classDepth=0;const declaredThis=[];const enterFunction=node=>{const[first]=node.params;declaredThis.push(first?.type===eslint_devkit_1.AST_NODE_TYPES.Identifier&&first.name==="this")};const exitFunction=()=>{declaredThis.pop()};return{FunctionDeclaration:enterFunction,"FunctionDeclaration:exit":exitFunction,FunctionExpression:enterFunction,"FunctionExpression:exit":exitFunction,ClassDeclaration(){classDepth+=1},"ClassDeclaration:exit"(){classDepth-=1},ClassExpression(){classDepth+=1},"ClassExpression:exit"(){classDepth-=1},ThisExpression(node){if(classDepth>0){return}if(declaredThis.at(-1)===true){return}context.report({node,messageId:"noThisInSfc"})}}}});