eslint-plugin-react-features 1.2.9 → 1.2.10
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 +2 -2
- package/src/index.js +1 -179
- package/src/oxlint.js +1 -3
- package/src/rules/component-api/no-arbitrary-token-class.js +1 -74
- package/src/rules/component-api/no-default-test-id.js +1 -46
- package/src/rules/component-api/no-inline-style.js +1 -57
- package/src/rules/component-api/no-is-prefix-prop.js +1 -59
- package/src/rules/component-api/no-kind-prop-discriminator.js +1 -57
- package/src/rules/component-api/no-raw-color-literal.js +1 -55
- package/src/rules/component-api/no-wrapper-sub-component.js +1 -95
- package/src/rules/component-api/require-data-slot.js +1 -40
- package/src/rules/migration/react-class-to-hooks.js +1 -159
- package/src/rules/performance/no-unnecessary-rerenders.js +1 -185
- package/src/rules/performance/react-no-inline-functions.js +1 -187
- package/src/rules/performance/react-render-optimization.js +1 -256
- package/src/rules/react/checked-requires-onchange-or-readonly.js +1 -68
- package/src/rules/react/default-props-match-prop-types.js +1 -99
- package/src/rules/react/display-name.js +1 -133
- package/src/rules/react/hooks-exhaustive-deps.js +1 -466
- package/src/rules/react/jsx-handler-names.js +1 -50
- package/src/rules/react/jsx-key.js +1 -323
- package/src/rules/react/jsx-max-depth.js +1 -71
- package/src/rules/react/jsx-no-bind.js +1 -55
- package/src/rules/react/jsx-no-duplicate-props.js +1 -66
- package/src/rules/react/jsx-no-literals.js +1 -79
- package/src/rules/react/jsx-no-script-url.js +1 -119
- package/src/rules/react/jsx-no-target-blank.js +1 -163
- package/src/rules/react/no-access-state-in-setstate.js +1 -80
- package/src/rules/react/no-adjacent-inline-elements.js +1 -72
- package/src/rules/react/no-arrow-function-lifecycle.js +1 -57
- package/src/rules/react/no-children-prop.js +1 -54
- package/src/rules/react/no-danger-with-children.js +1 -99
- package/src/rules/react/no-danger.js +1 -43
- package/src/rules/react/no-deprecated.js +1 -130
- package/src/rules/react/no-did-mount-set-state.js +1 -50
- package/src/rules/react/no-did-update-set-state.js +1 -71
- package/src/rules/react/no-direct-mutation-state.js +3 -211
- package/src/rules/react/no-find-dom-node.js +1 -50
- package/src/rules/react/no-invalid-html-attribute.js +1 -80
- package/src/rules/react/no-is-mounted.js +1 -46
- package/src/rules/react/no-multi-comp.js +1 -150
- package/src/rules/react/no-namespace.js +1 -37
- package/src/rules/react/no-object-type-as-default-prop.js +1 -53
- package/src/rules/react/no-redundant-should-component-update.js +1 -50
- package/src/rules/react/no-render-return-value.js +1 -67
- package/src/rules/react/no-set-state.js +1 -45
- package/src/rules/react/no-string-refs.js +1 -61
- package/src/rules/react/no-this-in-sfc.js +1 -55
- package/src/rules/react/no-typos.js +1 -90
- package/src/rules/react/no-unescaped-entities.js +1 -44
- package/src/rules/react/no-unknown-property.js +1 -124
- package/src/rules/react/no-unsafe.js +1 -106
- package/src/rules/react/prefer-es6-class.js +1 -50
- package/src/rules/react/prefer-stateless-function.js +1 -126
- package/src/rules/react/prop-types.js +1 -143
- package/src/rules/react/react-in-jsx-scope.js +1 -86
- package/src/rules/react/require-default-props.js +1 -134
- package/src/rules/react/require-optimization.js +1 -397
- package/src/rules/react/require-render-return.js +1 -79
- package/src/rules/react/required-attributes.js +1 -185
- package/src/rules/react/sort-comp.js +1 -146
- package/src/rules/react/state-in-constructor.js +1 -95
- package/src/rules/react/static-property-placement.js +1 -122
- package/src/rules/react/void-dom-elements-no-children.js +1 -89
- package/src/types/index.js +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-features",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
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",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@interlace/eslint-devkit": "^1.
|
|
68
|
+
"@interlace/eslint-devkit": "^1.10.0"
|
|
69
69
|
},
|
|
70
70
|
"repository": {
|
|
71
71
|
"type": "git",
|
package/src/index.js
CHANGED
|
@@ -1,179 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configs = exports.plugin = exports.rules = void 0;
|
|
4
|
-
exports.rules = {
|
|
5
|
-
get 'required-attributes'() { return require("./rules/react/required-attributes").requiredAttributes; },
|
|
6
|
-
get 'jsx-key'() { return require("./rules/react/jsx-key").jsxKey; },
|
|
7
|
-
get 'no-direct-mutation-state'() { return require("./rules/react/no-direct-mutation-state").noDirectMutationState; },
|
|
8
|
-
get 'require-optimization'() { return require("./rules/react/require-optimization").requireOptimization; },
|
|
9
|
-
get 'no-set-state'() { return require("./rules/react/no-set-state").noSetState; },
|
|
10
|
-
get 'no-this-in-sfc'() { return require("./rules/react/no-this-in-sfc").noThisInSfc; },
|
|
11
|
-
get 'no-access-state-in-setstate'() { return require("./rules/react/no-access-state-in-setstate").noAccessStateInSetState; },
|
|
12
|
-
get 'no-children-prop'() { return require("./rules/react/no-children-prop").noChildrenProp; },
|
|
13
|
-
get 'no-danger'() { return require("./rules/react/no-danger").noDanger; },
|
|
14
|
-
get 'no-string-refs'() { return require("./rules/react/no-string-refs").noStringRefs; },
|
|
15
|
-
get 'no-unknown-property'() { return require("./rules/react/no-unknown-property").noUnknownProperty; },
|
|
16
|
-
get 'checked-requires-onchange-or-readonly'() { return require("./rules/react/checked-requires-onchange-or-readonly").checkedRequiresOnchangeOrReadonly; },
|
|
17
|
-
get 'default-props-match-prop-types'() { return require("./rules/react/default-props-match-prop-types").defaultPropsMatchPropTypes; },
|
|
18
|
-
get 'display-name'() { return require("./rules/react/display-name").displayName; },
|
|
19
|
-
get 'jsx-handler-names'() { return require("./rules/react/jsx-handler-names").jsxHandlerNames; },
|
|
20
|
-
get 'jsx-max-depth'() { return require("./rules/react/jsx-max-depth").jsxMaxDepth; },
|
|
21
|
-
get 'jsx-no-bind'() { return require("./rules/react/jsx-no-bind").jsxNoBind; },
|
|
22
|
-
get 'jsx-no-literals'() { return require("./rules/react/jsx-no-literals").jsxNoLiterals; },
|
|
23
|
-
get 'no-adjacent-inline-elements'() { return require("./rules/react/no-adjacent-inline-elements").noAdjacentInlineElements; },
|
|
24
|
-
get 'no-arrow-function-lifecycle'() { return require("./rules/react/no-arrow-function-lifecycle").noArrowFunctionLifecycle; },
|
|
25
|
-
get 'no-did-mount-set-state'() { return require("./rules/react/no-did-mount-set-state").noDidMountSetState; },
|
|
26
|
-
get 'no-did-update-set-state'() { return require("./rules/react/no-did-update-set-state").noDidUpdateSetState; },
|
|
27
|
-
get 'no-invalid-html-attribute'() { return require("./rules/react/no-invalid-html-attribute").noInvalidHtmlAttribute; },
|
|
28
|
-
get 'no-is-mounted'() { return require("./rules/react/no-is-mounted").noIsMounted; },
|
|
29
|
-
get 'no-multi-comp'() { return require("./rules/react/no-multi-comp").noMultiComp; },
|
|
30
|
-
get 'no-namespace'() { return require("./rules/react/no-namespace").noNamespace; },
|
|
31
|
-
get 'no-object-type-as-default-prop'() { return require("./rules/react/no-object-type-as-default-prop").noObjectTypeAsDefaultProp; },
|
|
32
|
-
get 'no-redundant-should-component-update'() { return require("./rules/react/no-redundant-should-component-update").noRedundantShouldComponentUpdate; },
|
|
33
|
-
get 'no-render-return-value'() { return require("./rules/react/no-render-return-value").noRenderReturnValue; },
|
|
34
|
-
get 'no-typos'() { return require("./rules/react/no-typos").noTypos; },
|
|
35
|
-
get 'no-unescaped-entities'() { return require("./rules/react/no-unescaped-entities").noUnescapedEntities; },
|
|
36
|
-
get 'prefer-es6-class'() { return require("./rules/react/prefer-es6-class").preferEs6Class; },
|
|
37
|
-
get 'prefer-stateless-function'() { return require("./rules/react/prefer-stateless-function").preferStatelessFunction; },
|
|
38
|
-
get 'prop-types'() { return require("./rules/react/prop-types").propTypes; },
|
|
39
|
-
get 'react-in-jsx-scope'() { return require("./rules/react/react-in-jsx-scope").reactInJsxScope; },
|
|
40
|
-
get 'require-default-props'() { return require("./rules/react/require-default-props").requireDefaultProps; },
|
|
41
|
-
get 'require-render-return'() { return require("./rules/react/require-render-return").requireRenderReturn; },
|
|
42
|
-
get 'sort-comp'() { return require("./rules/react/sort-comp").sortComp; },
|
|
43
|
-
get 'state-in-constructor'() { return require("./rules/react/state-in-constructor").stateInConstructor; },
|
|
44
|
-
get 'static-property-placement'() { return require("./rules/react/static-property-placement").staticPropertyPlacement; },
|
|
45
|
-
get 'hooks-exhaustive-deps'() { return require("./rules/react/hooks-exhaustive-deps").hooksExhaustiveDeps; },
|
|
46
|
-
get 'jsx-no-target-blank'() { return require("./rules/react/jsx-no-target-blank").jsxNoTargetBlank; },
|
|
47
|
-
get 'jsx-no-script-url'() { return require("./rules/react/jsx-no-script-url").jsxNoScriptUrl; },
|
|
48
|
-
get 'jsx-no-duplicate-props'() { return require("./rules/react/jsx-no-duplicate-props").jsxNoDuplicateProps; },
|
|
49
|
-
get 'no-danger-with-children'() { return require("./rules/react/no-danger-with-children").noDangerWithChildren; },
|
|
50
|
-
get 'no-deprecated'() { return require("./rules/react/no-deprecated").noDeprecated; },
|
|
51
|
-
get 'no-find-dom-node'() { return require("./rules/react/no-find-dom-node").noFindDomNode; },
|
|
52
|
-
get 'no-unsafe'() { return require("./rules/react/no-unsafe").noUnsafe; },
|
|
53
|
-
get 'void-dom-elements-no-children'() { return require("./rules/react/void-dom-elements-no-children").voidDomElementsNoChildren; },
|
|
54
|
-
get 'react-class-to-hooks'() { return require("./rules/migration/react-class-to-hooks").reactClassToHooks; },
|
|
55
|
-
get 'no-unnecessary-rerenders'() { return require("./rules/performance/no-unnecessary-rerenders").noUnnecessaryRerenders; },
|
|
56
|
-
get 'react-render-optimization'() { return require("./rules/performance/react-render-optimization").reactRenderOptimization; },
|
|
57
|
-
get 'react-no-inline-functions'() { return require("./rules/performance/react-no-inline-functions").reactNoInlineFunctions; },
|
|
58
|
-
get 'no-default-test-id'() { return require("./rules/component-api/no-default-test-id").noDefaultTestId; },
|
|
59
|
-
get 'require-data-slot'() { return require("./rules/component-api/require-data-slot").requireDataSlot; },
|
|
60
|
-
get 'no-is-prefix-prop'() { return require("./rules/component-api/no-is-prefix-prop").noIsPrefixProp; },
|
|
61
|
-
get 'no-inline-style'() { return require("./rules/component-api/no-inline-style").noInlineStyle; },
|
|
62
|
-
get 'no-raw-color-literal'() { return require("./rules/component-api/no-raw-color-literal").noRawColorLiteral; },
|
|
63
|
-
get 'no-arbitrary-token-class'() { return require("./rules/component-api/no-arbitrary-token-class").noArbitraryTokenClass; },
|
|
64
|
-
get 'no-kind-prop-discriminator'() { return require("./rules/component-api/no-kind-prop-discriminator").noKindPropDiscriminator; },
|
|
65
|
-
get 'no-wrapper-sub-component'() { return require("./rules/component-api/no-wrapper-sub-component").noWrapperSubComponent; },
|
|
66
|
-
get 'react/required-attributes'() { return require("./rules/react/required-attributes").requiredAttributes; },
|
|
67
|
-
get 'react/jsx-key'() { return require("./rules/react/jsx-key").jsxKey; },
|
|
68
|
-
get 'react/no-direct-mutation-state'() { return require("./rules/react/no-direct-mutation-state").noDirectMutationState; },
|
|
69
|
-
get 'react/require-optimization'() { return require("./rules/react/require-optimization").requireOptimization; },
|
|
70
|
-
get 'react/no-set-state'() { return require("./rules/react/no-set-state").noSetState; },
|
|
71
|
-
get 'react/no-this-in-sfc'() { return require("./rules/react/no-this-in-sfc").noThisInSfc; },
|
|
72
|
-
get 'react/no-access-state-in-setstate'() { return require("./rules/react/no-access-state-in-setstate").noAccessStateInSetState; },
|
|
73
|
-
get 'react/no-children-prop'() { return require("./rules/react/no-children-prop").noChildrenProp; },
|
|
74
|
-
get 'react/no-danger'() { return require("./rules/react/no-danger").noDanger; },
|
|
75
|
-
get 'react/no-string-refs'() { return require("./rules/react/no-string-refs").noStringRefs; },
|
|
76
|
-
get 'react/no-unknown-property'() { return require("./rules/react/no-unknown-property").noUnknownProperty; },
|
|
77
|
-
get 'react/checked-requires-onchange-or-readonly'() { return require("./rules/react/checked-requires-onchange-or-readonly").checkedRequiresOnchangeOrReadonly; },
|
|
78
|
-
get 'react/default-props-match-prop-types'() { return require("./rules/react/default-props-match-prop-types").defaultPropsMatchPropTypes; },
|
|
79
|
-
get 'react/display-name'() { return require("./rules/react/display-name").displayName; },
|
|
80
|
-
get 'react/jsx-handler-names'() { return require("./rules/react/jsx-handler-names").jsxHandlerNames; },
|
|
81
|
-
get 'react/jsx-max-depth'() { return require("./rules/react/jsx-max-depth").jsxMaxDepth; },
|
|
82
|
-
get 'react/jsx-no-bind'() { return require("./rules/react/jsx-no-bind").jsxNoBind; },
|
|
83
|
-
get 'react/jsx-no-literals'() { return require("./rules/react/jsx-no-literals").jsxNoLiterals; },
|
|
84
|
-
get 'react/no-adjacent-inline-elements'() { return require("./rules/react/no-adjacent-inline-elements").noAdjacentInlineElements; },
|
|
85
|
-
get 'react/no-arrow-function-lifecycle'() { return require("./rules/react/no-arrow-function-lifecycle").noArrowFunctionLifecycle; },
|
|
86
|
-
get 'react/no-did-mount-set-state'() { return require("./rules/react/no-did-mount-set-state").noDidMountSetState; },
|
|
87
|
-
get 'react/no-did-update-set-state'() { return require("./rules/react/no-did-update-set-state").noDidUpdateSetState; },
|
|
88
|
-
get 'react/no-invalid-html-attribute'() { return require("./rules/react/no-invalid-html-attribute").noInvalidHtmlAttribute; },
|
|
89
|
-
get 'react/no-is-mounted'() { return require("./rules/react/no-is-mounted").noIsMounted; },
|
|
90
|
-
get 'react/no-multi-comp'() { return require("./rules/react/no-multi-comp").noMultiComp; },
|
|
91
|
-
get 'react/no-namespace'() { return require("./rules/react/no-namespace").noNamespace; },
|
|
92
|
-
get 'react/no-object-type-as-default-prop'() { return require("./rules/react/no-object-type-as-default-prop").noObjectTypeAsDefaultProp; },
|
|
93
|
-
get 'react/no-redundant-should-component-update'() { return require("./rules/react/no-redundant-should-component-update").noRedundantShouldComponentUpdate; },
|
|
94
|
-
get 'react/no-render-return-value'() { return require("./rules/react/no-render-return-value").noRenderReturnValue; },
|
|
95
|
-
get 'react/no-typos'() { return require("./rules/react/no-typos").noTypos; },
|
|
96
|
-
get 'react/no-unescaped-entities'() { return require("./rules/react/no-unescaped-entities").noUnescapedEntities; },
|
|
97
|
-
get 'react/prefer-es6-class'() { return require("./rules/react/prefer-es6-class").preferEs6Class; },
|
|
98
|
-
get 'react/prefer-stateless-function'() { return require("./rules/react/prefer-stateless-function").preferStatelessFunction; },
|
|
99
|
-
get 'react/prop-types'() { return require("./rules/react/prop-types").propTypes; },
|
|
100
|
-
get 'react/react-in-jsx-scope'() { return require("./rules/react/react-in-jsx-scope").reactInJsxScope; },
|
|
101
|
-
get 'react/require-default-props'() { return require("./rules/react/require-default-props").requireDefaultProps; },
|
|
102
|
-
get 'react/require-render-return'() { return require("./rules/react/require-render-return").requireRenderReturn; },
|
|
103
|
-
get 'react/sort-comp'() { return require("./rules/react/sort-comp").sortComp; },
|
|
104
|
-
get 'react/state-in-constructor'() { return require("./rules/react/state-in-constructor").stateInConstructor; },
|
|
105
|
-
get 'react/static-property-placement'() { return require("./rules/react/static-property-placement").staticPropertyPlacement; },
|
|
106
|
-
get 'react/hooks-exhaustive-deps'() { return require("./rules/react/hooks-exhaustive-deps").hooksExhaustiveDeps; },
|
|
107
|
-
get 'react/jsx-no-target-blank'() { return require("./rules/react/jsx-no-target-blank").jsxNoTargetBlank; },
|
|
108
|
-
get 'react/jsx-no-script-url'() { return require("./rules/react/jsx-no-script-url").jsxNoScriptUrl; },
|
|
109
|
-
get 'react/jsx-no-duplicate-props'() { return require("./rules/react/jsx-no-duplicate-props").jsxNoDuplicateProps; },
|
|
110
|
-
get 'react/no-danger-with-children'() { return require("./rules/react/no-danger-with-children").noDangerWithChildren; },
|
|
111
|
-
get 'react/no-deprecated'() { return require("./rules/react/no-deprecated").noDeprecated; },
|
|
112
|
-
get 'react/no-find-dom-node'() { return require("./rules/react/no-find-dom-node").noFindDomNode; },
|
|
113
|
-
get 'react/no-unsafe'() { return require("./rules/react/no-unsafe").noUnsafe; },
|
|
114
|
-
get 'react/void-dom-elements-no-children'() { return require("./rules/react/void-dom-elements-no-children").voidDomElementsNoChildren; },
|
|
115
|
-
get 'migration/react-class-to-hooks'() { return require("./rules/migration/react-class-to-hooks").reactClassToHooks; },
|
|
116
|
-
get 'performance/no-unnecessary-rerenders'() { return require("./rules/performance/no-unnecessary-rerenders").noUnnecessaryRerenders; },
|
|
117
|
-
get 'performance/react-render-optimization'() { return require("./rules/performance/react-render-optimization").reactRenderOptimization; },
|
|
118
|
-
get 'performance/react-no-inline-functions'() { return require("./rules/performance/react-no-inline-functions").reactNoInlineFunctions; },
|
|
119
|
-
get 'component-api/no-default-test-id'() { return require("./rules/component-api/no-default-test-id").noDefaultTestId; },
|
|
120
|
-
get 'component-api/require-data-slot'() { return require("./rules/component-api/require-data-slot").requireDataSlot; },
|
|
121
|
-
get 'component-api/no-is-prefix-prop'() { return require("./rules/component-api/no-is-prefix-prop").noIsPrefixProp; },
|
|
122
|
-
get 'component-api/no-inline-style'() { return require("./rules/component-api/no-inline-style").noInlineStyle; },
|
|
123
|
-
get 'component-api/no-raw-color-literal'() { return require("./rules/component-api/no-raw-color-literal").noRawColorLiteral; },
|
|
124
|
-
get 'component-api/no-arbitrary-token-class'() { return require("./rules/component-api/no-arbitrary-token-class").noArbitraryTokenClass; },
|
|
125
|
-
get 'component-api/no-kind-prop-discriminator'() { return require("./rules/component-api/no-kind-prop-discriminator").noKindPropDiscriminator; },
|
|
126
|
-
get 'component-api/no-wrapper-sub-component'() { return require("./rules/component-api/no-wrapper-sub-component").noWrapperSubComponent; },
|
|
127
|
-
|
|
128
|
-
};
|
|
129
|
-
exports.plugin = {
|
|
130
|
-
meta: {
|
|
131
|
-
name: 'eslint-plugin-react-features',
|
|
132
|
-
version: '1.2.9',
|
|
133
|
-
},
|
|
134
|
-
rules: exports.rules,
|
|
135
|
-
};
|
|
136
|
-
exports.configs = {
|
|
137
|
-
flagship: {
|
|
138
|
-
plugins: {
|
|
139
|
-
'react-features': exports.plugin,
|
|
140
|
-
},
|
|
141
|
-
rules: {
|
|
142
|
-
'react-features/hooks-exhaustive-deps': 'error',
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
recommended: {
|
|
146
|
-
plugins: {
|
|
147
|
-
'react-features': exports.plugin,
|
|
148
|
-
},
|
|
149
|
-
rules: {
|
|
150
|
-
'react-features/jsx-key': 'error',
|
|
151
|
-
'react-features/no-children-prop': 'warn',
|
|
152
|
-
'react-features/no-danger': 'warn',
|
|
153
|
-
'react-features/no-string-refs': 'error',
|
|
154
|
-
'react-features/no-unknown-property': 'error',
|
|
155
|
-
'react-features/hooks-exhaustive-deps': 'warn',
|
|
156
|
-
'react-features/jsx-no-target-blank': 'error',
|
|
157
|
-
'react-features/jsx-no-script-url': 'error',
|
|
158
|
-
'react-features/jsx-no-duplicate-props': 'error',
|
|
159
|
-
'react-features/no-danger-with-children': 'error',
|
|
160
|
-
'react-features/no-deprecated': 'warn',
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
componentApi: {
|
|
164
|
-
plugins: {
|
|
165
|
-
'react-features': exports.plugin,
|
|
166
|
-
},
|
|
167
|
-
rules: {
|
|
168
|
-
'react-features/component-api/no-default-test-id': 'error',
|
|
169
|
-
'react-features/component-api/require-data-slot': 'warn',
|
|
170
|
-
'react-features/component-api/no-is-prefix-prop': 'warn',
|
|
171
|
-
'react-features/component-api/no-inline-style': 'warn',
|
|
172
|
-
'react-features/component-api/no-raw-color-literal': 'warn',
|
|
173
|
-
'react-features/component-api/no-arbitrary-token-class': 'warn',
|
|
174
|
-
'react-features/component-api/no-kind-prop-discriminator': 'warn',
|
|
175
|
-
'react-features/component-api/no-wrapper-sub-component': 'warn',
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
};
|
|
179
|
-
exports.default = exports.plugin;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.configs=exports.plugin=exports.rules=void 0;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}};exports.plugin={meta:{name:"eslint-plugin-react-features",version:"1.2.10"},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;
|
package/src/oxlint.js
CHANGED
|
@@ -1,74 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noArbitraryTokenClass = void 0;
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
const TOKENIZABLE_PROPS = new Set([
|
|
6
|
-
'rounded',
|
|
7
|
-
'rounded-t', 'rounded-r', 'rounded-b', 'rounded-l',
|
|
8
|
-
'rounded-tl', 'rounded-tr', 'rounded-bl', 'rounded-br',
|
|
9
|
-
'px', 'py', 'pt', 'pb', 'pl', 'pr', 'p',
|
|
10
|
-
'mx', 'my', 'mt', 'mb', 'ml', 'mr', 'm',
|
|
11
|
-
'gap', 'gap-x', 'gap-y',
|
|
12
|
-
'space-x', 'space-y',
|
|
13
|
-
]);
|
|
14
|
-
const ARBITRARY_CLASS_PATTERN = /([\w-]+)-\[([^\]]+)\]/g;
|
|
15
|
-
const TOKENIZABLE_VALUE = /^\d+(?:\.\d+)?(?:px|rem|em)$/;
|
|
16
|
-
exports.noArbitraryTokenClass = (0, eslint_devkit_1.createRule)({
|
|
17
|
-
name: 'no-arbitrary-token-class',
|
|
18
|
-
meta: {
|
|
19
|
-
type: 'problem',
|
|
20
|
-
docs: {
|
|
21
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-arbitrary-token-class.md',
|
|
22
|
-
description: 'No Tailwind arbitrary values when a token exists for that property (R19)',
|
|
23
|
-
},
|
|
24
|
-
schema: [],
|
|
25
|
-
messages: {
|
|
26
|
-
arbitraryClass: (0, eslint_devkit_1.formatLLMMessage)({
|
|
27
|
-
icon: eslint_devkit_1.MessageIcons.WARNING,
|
|
28
|
-
issueName: 'Arbitrary Tailwind class',
|
|
29
|
-
description: 'Arbitrary value `{{cls}}` — use a token or extend the theme (R19)',
|
|
30
|
-
severity: 'MEDIUM',
|
|
31
|
-
fix: 'Replace with the matching spacing/radius token or wire a `var(--token)` Tailwind class.',
|
|
32
|
-
documentationLink: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-arbitrary-token-class.md',
|
|
33
|
-
}),
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
defaultOptions: [],
|
|
37
|
-
create(context) {
|
|
38
|
-
const scanString = (node, raw) => {
|
|
39
|
-
for (const match of raw.matchAll(ARBITRARY_CLASS_PATTERN)) {
|
|
40
|
-
const [whole, prop, value] = match;
|
|
41
|
-
if (!TOKENIZABLE_PROPS.has(prop))
|
|
42
|
-
continue;
|
|
43
|
-
if (!TOKENIZABLE_VALUE.test(value))
|
|
44
|
-
continue;
|
|
45
|
-
context.report({
|
|
46
|
-
node,
|
|
47
|
-
messageId: 'arbitraryClass',
|
|
48
|
-
data: { cls: whole },
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
return {
|
|
53
|
-
'JSXAttribute[name.name="className"] > Literal'(node) {
|
|
54
|
-
if (typeof node.value === 'string')
|
|
55
|
-
scanString(node, node.value);
|
|
56
|
-
},
|
|
57
|
-
'JSXAttribute[name.name="className"] TemplateElement'(node) {
|
|
58
|
-
scanString(node, node.value.cooked);
|
|
59
|
-
},
|
|
60
|
-
CallExpression(node) {
|
|
61
|
-
if (node.callee.type !== 'Identifier')
|
|
62
|
-
return;
|
|
63
|
-
const name = node.callee.name;
|
|
64
|
-
if (name !== 'cn' && name !== 'clsx' && name !== 'twMerge' && name !== 'classNames')
|
|
65
|
-
return;
|
|
66
|
-
for (const arg of node.arguments) {
|
|
67
|
-
if (arg.type === 'Literal' && typeof arg.value === 'string') {
|
|
68
|
-
scanString(arg, arg.value);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noArbitraryTokenClass=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const TOKENIZABLE_PROPS=new Set(["rounded","rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-bl","rounded-br","px","py","pt","pb","pl","pr","p","mx","my","mt","mb","ml","mr","m","gap","gap-x","gap-y","space-x","space-y"]);const ARBITRARY_CLASS_PATTERN=/([\w-]+)-\[([^\]]+)\]/g;const TOKENIZABLE_VALUE=/^\d+(?:\.\d+)?(?:px|rem|em)$/;exports.noArbitraryTokenClass=(0,eslint_devkit_1.createRule)({name:"no-arbitrary-token-class",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-arbitrary-token-class.md",description:"No Tailwind arbitrary values when a token exists for that property (R19)"},schema:[],messages:{arbitraryClass:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.WARNING,issueName:"Arbitrary Tailwind class",description:"Arbitrary value `{{cls}}` \u2014 use a token or extend the theme (R19)",severity:"MEDIUM",fix:"Replace with the matching spacing/radius token or wire a `var(--token)` Tailwind class.",documentationLink:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-arbitrary-token-class.md"})}},defaultOptions:[],create(context){const scanString=(node,raw)=>{for(const match of raw.matchAll(ARBITRARY_CLASS_PATTERN)){const[whole,prop,value]=match;if(!TOKENIZABLE_PROPS.has(prop))continue;if(!TOKENIZABLE_VALUE.test(value))continue;context.report({node,messageId:"arbitraryClass",data:{cls:whole}})}};return{'JSXAttribute[name.name="className"] > Literal'(node){if(typeof node.value==="string")scanString(node,node.value)},'JSXAttribute[name.name="className"] TemplateElement'(node){scanString(node,node.value.cooked)},CallExpression(node){if(node.callee.type!=="Identifier")return;const name=node.callee.name;if(name!=="cn"&&name!=="clsx"&&name!=="twMerge"&&name!=="classNames")return;for(const arg of node.arguments){if(arg.type==="Literal"&&typeof arg.value==="string"){scanString(arg,arg.value)}}}}}});
|
|
@@ -1,46 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noDefaultTestId = void 0;
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
exports.noDefaultTestId = (0, eslint_devkit_1.createRule)({
|
|
6
|
-
name: 'no-default-test-id',
|
|
7
|
-
meta: {
|
|
8
|
-
type: 'problem',
|
|
9
|
-
docs: {
|
|
10
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-default-test-id.md',
|
|
11
|
-
description: 'data-testid must be consumer-provided — no runtime default value (R5)',
|
|
12
|
-
},
|
|
13
|
-
fixable: 'code',
|
|
14
|
-
schema: [],
|
|
15
|
-
messages: {
|
|
16
|
-
defaultTestId: (0, eslint_devkit_1.formatLLMMessage)({
|
|
17
|
-
icon: eslint_devkit_1.MessageIcons.WARNING,
|
|
18
|
-
issueName: 'data-testid default value',
|
|
19
|
-
description: 'data-testid has a runtime default — consumer must provide it (R5)',
|
|
20
|
-
severity: 'HIGH',
|
|
21
|
-
fix: 'Remove the default. Require data-testid at the type level and let the consumer pass it.',
|
|
22
|
-
documentationLink: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-default-test-id.md',
|
|
23
|
-
}),
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
defaultOptions: [],
|
|
27
|
-
create(context) {
|
|
28
|
-
return {
|
|
29
|
-
Property(node) {
|
|
30
|
-
if (node.key.type !== 'Literal' || node.key.value !== 'data-testid')
|
|
31
|
-
return;
|
|
32
|
-
if (node.value.type !== 'AssignmentPattern')
|
|
33
|
-
return;
|
|
34
|
-
const assignment = node.value;
|
|
35
|
-
context.report({
|
|
36
|
-
node: assignment,
|
|
37
|
-
messageId: 'defaultTestId',
|
|
38
|
-
fix(fixer) {
|
|
39
|
-
const bindingText = context.sourceCode.getText(assignment.left);
|
|
40
|
-
return fixer.replaceText(assignment, bindingText);
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noDefaultTestId=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");exports.noDefaultTestId=(0,eslint_devkit_1.createRule)({name:"no-default-test-id",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-default-test-id.md",description:"data-testid must be consumer-provided \u2014 no runtime default value (R5)"},fixable:"code",schema:[],messages:{defaultTestId:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.WARNING,issueName:"data-testid default value",description:"data-testid has a runtime default \u2014 consumer must provide it (R5)",severity:"HIGH",fix:"Remove the default. Require data-testid at the type level and let the consumer pass it.",documentationLink:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-default-test-id.md"})}},defaultOptions:[],create(context){return{Property(node){if(node.key.type!=="Literal"||node.key.value!=="data-testid")return;if(node.value.type!=="AssignmentPattern")return;const assignment=node.value;context.report({node:assignment,messageId:"defaultTestId",fix(fixer){const bindingText=context.sourceCode.getText(assignment.left);return fixer.replaceText(assignment,bindingText)}})}}}});
|
|
@@ -1,57 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noInlineStyle = void 0;
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
const isCssVariableKey = (prop) => {
|
|
6
|
-
if (prop.type !== 'Property')
|
|
7
|
-
return false;
|
|
8
|
-
if (prop.key.type === 'Literal' && typeof prop.key.value === 'string') {
|
|
9
|
-
return prop.key.value.startsWith('--');
|
|
10
|
-
}
|
|
11
|
-
return false;
|
|
12
|
-
};
|
|
13
|
-
const isStaticLiteralValue = (prop) => {
|
|
14
|
-
if (prop.type !== 'Property')
|
|
15
|
-
return false;
|
|
16
|
-
const v = prop.value;
|
|
17
|
-
return v.type === 'Literal' && (typeof v.value === 'string' || typeof v.value === 'number');
|
|
18
|
-
};
|
|
19
|
-
exports.noInlineStyle = (0, eslint_devkit_1.createRule)({
|
|
20
|
-
name: 'no-inline-style',
|
|
21
|
-
meta: {
|
|
22
|
-
type: 'problem',
|
|
23
|
-
docs: {
|
|
24
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-inline-style.md',
|
|
25
|
-
description: 'No inline `style={{}}` except for CSS-variable assignment (R18)',
|
|
26
|
-
},
|
|
27
|
-
schema: [],
|
|
28
|
-
messages: {
|
|
29
|
-
inlineStyle: (0, eslint_devkit_1.formatLLMMessage)({
|
|
30
|
-
icon: eslint_devkit_1.MessageIcons.WARNING,
|
|
31
|
-
issueName: 'Inline style prop',
|
|
32
|
-
description: 'Inline `style={{}}` with static value(s) — use Tailwind classes (R18)',
|
|
33
|
-
severity: 'MEDIUM',
|
|
34
|
-
fix: 'Move the static value to a Tailwind class. Reserve inline style for CSS variables and computed dynamic values.',
|
|
35
|
-
documentationLink: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-inline-style.md',
|
|
36
|
-
}),
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
defaultOptions: [],
|
|
40
|
-
create(context) {
|
|
41
|
-
return {
|
|
42
|
-
JSXAttribute(node) {
|
|
43
|
-
if (node.name.type !== 'JSXIdentifier' || node.name.name !== 'style')
|
|
44
|
-
return;
|
|
45
|
-
if (!node.value || node.value.type !== 'JSXExpressionContainer')
|
|
46
|
-
return;
|
|
47
|
-
const expr = node.value.expression;
|
|
48
|
-
if (expr.type !== 'ObjectExpression')
|
|
49
|
-
return;
|
|
50
|
-
const hasStaticNonVarProp = expr.properties.some((p) => !isCssVariableKey(p) && isStaticLiteralValue(p));
|
|
51
|
-
if (hasStaticNonVarProp) {
|
|
52
|
-
context.report({ node, messageId: 'inlineStyle' });
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noInlineStyle=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const isCssVariableKey=prop=>{if(prop.type!=="Property")return false;if(prop.key.type==="Literal"&&typeof prop.key.value==="string"){return prop.key.value.startsWith("--")}return false};const isStaticLiteralValue=prop=>{if(prop.type!=="Property")return false;const v=prop.value;return v.type==="Literal"&&(typeof v.value==="string"||typeof v.value==="number")};exports.noInlineStyle=(0,eslint_devkit_1.createRule)({name:"no-inline-style",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-inline-style.md",description:"No inline `style={{}}` except for CSS-variable assignment (R18)"},schema:[],messages:{inlineStyle:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.WARNING,issueName:"Inline style prop",description:"Inline `style={{}}` with static value(s) \u2014 use Tailwind classes (R18)",severity:"MEDIUM",fix:"Move the static value to a Tailwind class. Reserve inline style for CSS variables and computed dynamic values.",documentationLink:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-inline-style.md"})}},defaultOptions:[],create(context){return{JSXAttribute(node){if(node.name.type!=="JSXIdentifier"||node.name.name!=="style")return;if(!node.value||node.value.type!=="JSXExpressionContainer")return;const expr=node.value.expression;if(expr.type!=="ObjectExpression")return;const hasStaticNonVarProp=expr.properties.some(p=>!isCssVariableKey(p)&&isStaticLiteralValue(p));if(hasStaticNonVarProp){context.report({node,messageId:"inlineStyle"})}}}}});
|
|
@@ -1,59 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noIsPrefixProp = void 0;
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
const stripIsPrefix = (name) => name.slice(2, 3).toLowerCase() + name.slice(3);
|
|
6
|
-
exports.noIsPrefixProp = (0, eslint_devkit_1.createRule)({
|
|
7
|
-
name: 'no-is-prefix-prop',
|
|
8
|
-
meta: {
|
|
9
|
-
type: 'problem',
|
|
10
|
-
docs: {
|
|
11
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-is-prefix-prop.md',
|
|
12
|
-
description: 'Boolean props must not be prefixed with `is` (R8)',
|
|
13
|
-
},
|
|
14
|
-
hasSuggestions: true,
|
|
15
|
-
schema: [],
|
|
16
|
-
messages: {
|
|
17
|
-
isPrefix: (0, eslint_devkit_1.formatLLMMessage)({
|
|
18
|
-
icon: eslint_devkit_1.MessageIcons.WARNING,
|
|
19
|
-
issueName: '`is` prefix on boolean prop',
|
|
20
|
-
description: 'Boolean prop `{{name}}` should be renamed to `{{suggested}}` (R8)',
|
|
21
|
-
severity: 'MEDIUM',
|
|
22
|
-
fix: 'Rename to `{{suggested}}` — booleans describe the true state directly.',
|
|
23
|
-
documentationLink: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-is-prefix-prop.md',
|
|
24
|
-
}),
|
|
25
|
-
renameSuggestion: 'Rename to `{{suggested}}` (also rename consumer call sites manually)',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
defaultOptions: [],
|
|
29
|
-
create(context) {
|
|
30
|
-
return {
|
|
31
|
-
TSPropertySignature(node) {
|
|
32
|
-
if (node.key.type !== 'Identifier')
|
|
33
|
-
return;
|
|
34
|
-
const { name } = node.key;
|
|
35
|
-
if (!/^is[A-Z]/.test(name))
|
|
36
|
-
return;
|
|
37
|
-
const ann = node.typeAnnotation?.typeAnnotation;
|
|
38
|
-
if (!ann || ann.type !== 'TSBooleanKeyword')
|
|
39
|
-
return;
|
|
40
|
-
const suggested = stripIsPrefix(name);
|
|
41
|
-
const keyNode = node.key;
|
|
42
|
-
context.report({
|
|
43
|
-
node: keyNode,
|
|
44
|
-
messageId: 'isPrefix',
|
|
45
|
-
data: { name, suggested },
|
|
46
|
-
suggest: [
|
|
47
|
-
{
|
|
48
|
-
messageId: 'renameSuggestion',
|
|
49
|
-
data: { suggested },
|
|
50
|
-
fix(fixer) {
|
|
51
|
-
return fixer.replaceText(keyNode, suggested);
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
});
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
});
|
|
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,57 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noKindPropDiscriminator = void 0;
|
|
4
|
-
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
5
|
-
const FLAGGED_NAMES = new Set(['type', 'kind']);
|
|
6
|
-
const isStringLiteralUnion = (node) => {
|
|
7
|
-
if (!node)
|
|
8
|
-
return false;
|
|
9
|
-
if (node.type !== 'TSUnionType')
|
|
10
|
-
return false;
|
|
11
|
-
const members = node.types;
|
|
12
|
-
if (members.length < 2)
|
|
13
|
-
return false;
|
|
14
|
-
return members.every((m) => m.type === 'TSLiteralType' &&
|
|
15
|
-
m.literal.type === 'Literal' &&
|
|
16
|
-
typeof m.literal.value === 'string');
|
|
17
|
-
};
|
|
18
|
-
exports.noKindPropDiscriminator = (0, eslint_devkit_1.createRule)({
|
|
19
|
-
name: 'no-kind-prop-discriminator',
|
|
20
|
-
meta: {
|
|
21
|
-
type: 'problem',
|
|
22
|
-
docs: {
|
|
23
|
-
url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-kind-prop-discriminator.md',
|
|
24
|
-
description: 'Ban `type`/`kind` string-union props that select between rendered trees (R11)',
|
|
25
|
-
},
|
|
26
|
-
schema: [],
|
|
27
|
-
messages: {
|
|
28
|
-
kindProp: (0, eslint_devkit_1.formatLLMMessage)({
|
|
29
|
-
icon: eslint_devkit_1.MessageIcons.WARNING,
|
|
30
|
-
issueName: 'Kind-prop discriminator',
|
|
31
|
-
description: 'Prop `{{name}}: "A" | "B"` likely switches the rendered tree — split into sub-components (R11)',
|
|
32
|
-
severity: 'MEDIUM',
|
|
33
|
-
fix: 'Split into sub-components (`Foo.A`, `Foo.B`). If this is only a CVA contract switch (e.g. role only), rename to `variant` and document the test.',
|
|
34
|
-
documentationLink: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-kind-prop-discriminator.md',
|
|
35
|
-
}),
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
defaultOptions: [],
|
|
39
|
-
create(context) {
|
|
40
|
-
return {
|
|
41
|
-
TSPropertySignature(node) {
|
|
42
|
-
if (node.key.type !== 'Identifier')
|
|
43
|
-
return;
|
|
44
|
-
if (!FLAGGED_NAMES.has(node.key.name))
|
|
45
|
-
return;
|
|
46
|
-
const ann = node.typeAnnotation?.typeAnnotation;
|
|
47
|
-
if (!isStringLiteralUnion(ann))
|
|
48
|
-
return;
|
|
49
|
-
context.report({
|
|
50
|
-
node: node.key,
|
|
51
|
-
messageId: 'kindProp',
|
|
52
|
-
data: { name: node.key.name },
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.noKindPropDiscriminator=void 0;const eslint_devkit_1=require("@interlace/eslint-devkit");const FLAGGED_NAMES=new Set(["type","kind"]);const isStringLiteralUnion=node=>{if(!node)return false;if(node.type!=="TSUnionType")return false;const members=node.types;if(members.length<2)return false;return members.every(m=>m.type==="TSLiteralType"&&m.literal.type==="Literal"&&typeof m.literal.value==="string")};exports.noKindPropDiscriminator=(0,eslint_devkit_1.createRule)({name:"no-kind-prop-discriminator",meta:{type:"problem",docs:{url:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-kind-prop-discriminator.md",description:"Ban `type`/`kind` string-union props that select between rendered trees (R11)"},schema:[],messages:{kindProp:(0,eslint_devkit_1.formatLLMMessage)({icon:eslint_devkit_1.MessageIcons.WARNING,issueName:"Kind-prop discriminator",description:'Prop `{{name}}: "A" | "B"` likely switches the rendered tree \u2014 split into sub-components (R11)',severity:"MEDIUM",fix:"Split into sub-components (`Foo.A`, `Foo.B`). If this is only a CVA contract switch (e.g. role only), rename to `variant` and document the test.",documentationLink:"https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/component-api/no-kind-prop-discriminator.md"})}},defaultOptions:[],create(context){return{TSPropertySignature(node){if(node.key.type!=="Identifier")return;if(!FLAGGED_NAMES.has(node.key.name))return;const ann=node.typeAnnotation?.typeAnnotation;if(!isStringLiteralUnion(ann))return;context.report({node:node.key,messageId:"kindProp",data:{name:node.key.name}})}}}});
|