eslint-plugin-react-features 1.2.8 → 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.
Files changed (65) hide show
  1. package/package.json +2 -3
  2. package/src/index.js +1 -239
  3. package/src/oxlint.js +1 -3
  4. package/src/rules/component-api/no-arbitrary-token-class.js +1 -74
  5. package/src/rules/component-api/no-default-test-id.js +1 -46
  6. package/src/rules/component-api/no-inline-style.js +1 -57
  7. package/src/rules/component-api/no-is-prefix-prop.js +1 -59
  8. package/src/rules/component-api/no-kind-prop-discriminator.js +1 -57
  9. package/src/rules/component-api/no-raw-color-literal.js +1 -55
  10. package/src/rules/component-api/no-wrapper-sub-component.js +1 -95
  11. package/src/rules/component-api/require-data-slot.js +1 -40
  12. package/src/rules/migration/react-class-to-hooks.js +1 -159
  13. package/src/rules/performance/no-unnecessary-rerenders.js +1 -185
  14. package/src/rules/performance/react-no-inline-functions.js +1 -187
  15. package/src/rules/performance/react-render-optimization.js +1 -256
  16. package/src/rules/react/checked-requires-onchange-or-readonly.js +1 -68
  17. package/src/rules/react/default-props-match-prop-types.js +1 -99
  18. package/src/rules/react/display-name.js +1 -133
  19. package/src/rules/react/hooks-exhaustive-deps.js +1 -466
  20. package/src/rules/react/jsx-handler-names.js +1 -50
  21. package/src/rules/react/jsx-key.js +1 -323
  22. package/src/rules/react/jsx-max-depth.js +1 -71
  23. package/src/rules/react/jsx-no-bind.js +1 -55
  24. package/src/rules/react/jsx-no-duplicate-props.js +1 -66
  25. package/src/rules/react/jsx-no-literals.js +1 -79
  26. package/src/rules/react/jsx-no-script-url.js +1 -119
  27. package/src/rules/react/jsx-no-target-blank.js +1 -163
  28. package/src/rules/react/no-access-state-in-setstate.js +1 -80
  29. package/src/rules/react/no-adjacent-inline-elements.js +1 -72
  30. package/src/rules/react/no-arrow-function-lifecycle.js +1 -57
  31. package/src/rules/react/no-children-prop.js +1 -54
  32. package/src/rules/react/no-danger-with-children.js +1 -99
  33. package/src/rules/react/no-danger.js +1 -43
  34. package/src/rules/react/no-deprecated.js +1 -130
  35. package/src/rules/react/no-did-mount-set-state.js +1 -50
  36. package/src/rules/react/no-did-update-set-state.js +1 -71
  37. package/src/rules/react/no-direct-mutation-state.js +3 -211
  38. package/src/rules/react/no-find-dom-node.js +1 -50
  39. package/src/rules/react/no-invalid-html-attribute.js +1 -80
  40. package/src/rules/react/no-is-mounted.js +1 -46
  41. package/src/rules/react/no-multi-comp.js +1 -150
  42. package/src/rules/react/no-namespace.js +1 -37
  43. package/src/rules/react/no-object-type-as-default-prop.js +1 -53
  44. package/src/rules/react/no-redundant-should-component-update.js +1 -50
  45. package/src/rules/react/no-render-return-value.js +1 -67
  46. package/src/rules/react/no-set-state.js +1 -45
  47. package/src/rules/react/no-string-refs.js +1 -61
  48. package/src/rules/react/no-this-in-sfc.js +1 -55
  49. package/src/rules/react/no-typos.js +1 -90
  50. package/src/rules/react/no-unescaped-entities.js +1 -44
  51. package/src/rules/react/no-unknown-property.js +1 -124
  52. package/src/rules/react/no-unsafe.js +1 -106
  53. package/src/rules/react/prefer-es6-class.js +1 -50
  54. package/src/rules/react/prefer-stateless-function.js +1 -126
  55. package/src/rules/react/prop-types.js +1 -143
  56. package/src/rules/react/react-in-jsx-scope.js +1 -86
  57. package/src/rules/react/require-default-props.js +1 -134
  58. package/src/rules/react/require-optimization.js +1 -397
  59. package/src/rules/react/require-render-return.js +1 -79
  60. package/src/rules/react/required-attributes.js +1 -185
  61. package/src/rules/react/sort-comp.js +1 -146
  62. package/src/rules/react/state-in-constructor.js +1 -95
  63. package/src/rules/react/static-property-placement.js +1 -122
  64. package/src/rules/react/void-dom-elements-no-children.js +1 -89
  65. 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.8",
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,8 +65,7 @@
65
65
  }
66
66
  },
67
67
  "dependencies": {
68
- "tslib": "^2.3.0",
69
- "@interlace/eslint-devkit": "^1.7.0"
68
+ "@interlace/eslint-devkit": "^1.10.0"
70
69
  },
71
70
  "repository": {
72
71
  "type": "git",
package/src/index.js CHANGED
@@ -1,239 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configs = exports.plugin = exports.rules = void 0;
4
- const required_attributes_1 = require("./rules/react/required-attributes");
5
- const jsx_key_1 = require("./rules/react/jsx-key");
6
- const no_direct_mutation_state_1 = require("./rules/react/no-direct-mutation-state");
7
- const require_optimization_1 = require("./rules/react/require-optimization");
8
- const no_set_state_1 = require("./rules/react/no-set-state");
9
- const no_this_in_sfc_1 = require("./rules/react/no-this-in-sfc");
10
- const no_access_state_in_setstate_1 = require("./rules/react/no-access-state-in-setstate");
11
- const no_children_prop_1 = require("./rules/react/no-children-prop");
12
- const no_danger_1 = require("./rules/react/no-danger");
13
- const no_string_refs_1 = require("./rules/react/no-string-refs");
14
- const no_unknown_property_1 = require("./rules/react/no-unknown-property");
15
- const checked_requires_onchange_or_readonly_1 = require("./rules/react/checked-requires-onchange-or-readonly");
16
- const default_props_match_prop_types_1 = require("./rules/react/default-props-match-prop-types");
17
- const display_name_1 = require("./rules/react/display-name");
18
- const jsx_handler_names_1 = require("./rules/react/jsx-handler-names");
19
- const jsx_max_depth_1 = require("./rules/react/jsx-max-depth");
20
- const jsx_no_bind_1 = require("./rules/react/jsx-no-bind");
21
- const jsx_no_literals_1 = require("./rules/react/jsx-no-literals");
22
- const no_adjacent_inline_elements_1 = require("./rules/react/no-adjacent-inline-elements");
23
- const no_arrow_function_lifecycle_1 = require("./rules/react/no-arrow-function-lifecycle");
24
- const no_did_mount_set_state_1 = require("./rules/react/no-did-mount-set-state");
25
- const no_did_update_set_state_1 = require("./rules/react/no-did-update-set-state");
26
- const no_invalid_html_attribute_1 = require("./rules/react/no-invalid-html-attribute");
27
- const no_is_mounted_1 = require("./rules/react/no-is-mounted");
28
- const no_multi_comp_1 = require("./rules/react/no-multi-comp");
29
- const no_namespace_1 = require("./rules/react/no-namespace");
30
- const no_object_type_as_default_prop_1 = require("./rules/react/no-object-type-as-default-prop");
31
- const no_redundant_should_component_update_1 = require("./rules/react/no-redundant-should-component-update");
32
- const no_render_return_value_1 = require("./rules/react/no-render-return-value");
33
- const no_typos_1 = require("./rules/react/no-typos");
34
- const no_unescaped_entities_1 = require("./rules/react/no-unescaped-entities");
35
- const prefer_es6_class_1 = require("./rules/react/prefer-es6-class");
36
- const prefer_stateless_function_1 = require("./rules/react/prefer-stateless-function");
37
- const prop_types_1 = require("./rules/react/prop-types");
38
- const react_in_jsx_scope_1 = require("./rules/react/react-in-jsx-scope");
39
- const require_default_props_1 = require("./rules/react/require-default-props");
40
- const require_render_return_1 = require("./rules/react/require-render-return");
41
- const sort_comp_1 = require("./rules/react/sort-comp");
42
- const state_in_constructor_1 = require("./rules/react/state-in-constructor");
43
- const static_property_placement_1 = require("./rules/react/static-property-placement");
44
- const hooks_exhaustive_deps_1 = require("./rules/react/hooks-exhaustive-deps");
45
- const jsx_no_target_blank_1 = require("./rules/react/jsx-no-target-blank");
46
- const jsx_no_script_url_1 = require("./rules/react/jsx-no-script-url");
47
- const jsx_no_duplicate_props_1 = require("./rules/react/jsx-no-duplicate-props");
48
- const no_danger_with_children_1 = require("./rules/react/no-danger-with-children");
49
- const no_deprecated_1 = require("./rules/react/no-deprecated");
50
- const no_find_dom_node_1 = require("./rules/react/no-find-dom-node");
51
- const no_unsafe_1 = require("./rules/react/no-unsafe");
52
- const void_dom_elements_no_children_1 = require("./rules/react/void-dom-elements-no-children");
53
- const react_class_to_hooks_1 = require("./rules/migration/react-class-to-hooks");
54
- const no_unnecessary_rerenders_1 = require("./rules/performance/no-unnecessary-rerenders");
55
- const react_render_optimization_1 = require("./rules/performance/react-render-optimization");
56
- const react_no_inline_functions_1 = require("./rules/performance/react-no-inline-functions");
57
- const no_default_test_id_1 = require("./rules/component-api/no-default-test-id");
58
- const require_data_slot_1 = require("./rules/component-api/require-data-slot");
59
- const no_is_prefix_prop_1 = require("./rules/component-api/no-is-prefix-prop");
60
- const no_inline_style_1 = require("./rules/component-api/no-inline-style");
61
- const no_raw_color_literal_1 = require("./rules/component-api/no-raw-color-literal");
62
- const no_arbitrary_token_class_1 = require("./rules/component-api/no-arbitrary-token-class");
63
- const no_kind_prop_discriminator_1 = require("./rules/component-api/no-kind-prop-discriminator");
64
- const no_wrapper_sub_component_1 = require("./rules/component-api/no-wrapper-sub-component");
65
- exports.rules = {
66
- 'required-attributes': required_attributes_1.requiredAttributes,
67
- 'jsx-key': jsx_key_1.jsxKey,
68
- 'no-direct-mutation-state': no_direct_mutation_state_1.noDirectMutationState,
69
- 'require-optimization': require_optimization_1.requireOptimization,
70
- 'no-set-state': no_set_state_1.noSetState,
71
- 'no-this-in-sfc': no_this_in_sfc_1.noThisInSfc,
72
- 'no-access-state-in-setstate': no_access_state_in_setstate_1.noAccessStateInSetState,
73
- 'no-children-prop': no_children_prop_1.noChildrenProp,
74
- 'no-danger': no_danger_1.noDanger,
75
- 'no-string-refs': no_string_refs_1.noStringRefs,
76
- 'no-unknown-property': no_unknown_property_1.noUnknownProperty,
77
- 'checked-requires-onchange-or-readonly': checked_requires_onchange_or_readonly_1.checkedRequiresOnchangeOrReadonly,
78
- 'default-props-match-prop-types': default_props_match_prop_types_1.defaultPropsMatchPropTypes,
79
- 'display-name': display_name_1.displayName,
80
- 'jsx-handler-names': jsx_handler_names_1.jsxHandlerNames,
81
- 'jsx-max-depth': jsx_max_depth_1.jsxMaxDepth,
82
- 'jsx-no-bind': jsx_no_bind_1.jsxNoBind,
83
- 'jsx-no-literals': jsx_no_literals_1.jsxNoLiterals,
84
- 'no-adjacent-inline-elements': no_adjacent_inline_elements_1.noAdjacentInlineElements,
85
- 'no-arrow-function-lifecycle': no_arrow_function_lifecycle_1.noArrowFunctionLifecycle,
86
- 'no-did-mount-set-state': no_did_mount_set_state_1.noDidMountSetState,
87
- 'no-did-update-set-state': no_did_update_set_state_1.noDidUpdateSetState,
88
- 'no-invalid-html-attribute': no_invalid_html_attribute_1.noInvalidHtmlAttribute,
89
- 'no-is-mounted': no_is_mounted_1.noIsMounted,
90
- 'no-multi-comp': no_multi_comp_1.noMultiComp,
91
- 'no-namespace': no_namespace_1.noNamespace,
92
- 'no-object-type-as-default-prop': no_object_type_as_default_prop_1.noObjectTypeAsDefaultProp,
93
- 'no-redundant-should-component-update': no_redundant_should_component_update_1.noRedundantShouldComponentUpdate,
94
- 'no-render-return-value': no_render_return_value_1.noRenderReturnValue,
95
- 'no-typos': no_typos_1.noTypos,
96
- 'no-unescaped-entities': no_unescaped_entities_1.noUnescapedEntities,
97
- 'prefer-es6-class': prefer_es6_class_1.preferEs6Class,
98
- 'prefer-stateless-function': prefer_stateless_function_1.preferStatelessFunction,
99
- 'prop-types': prop_types_1.propTypes,
100
- 'react-in-jsx-scope': react_in_jsx_scope_1.reactInJsxScope,
101
- 'require-default-props': require_default_props_1.requireDefaultProps,
102
- 'require-render-return': require_render_return_1.requireRenderReturn,
103
- 'sort-comp': sort_comp_1.sortComp,
104
- 'state-in-constructor': state_in_constructor_1.stateInConstructor,
105
- 'static-property-placement': static_property_placement_1.staticPropertyPlacement,
106
- 'hooks-exhaustive-deps': hooks_exhaustive_deps_1.hooksExhaustiveDeps,
107
- 'jsx-no-target-blank': jsx_no_target_blank_1.jsxNoTargetBlank,
108
- 'jsx-no-script-url': jsx_no_script_url_1.jsxNoScriptUrl,
109
- 'jsx-no-duplicate-props': jsx_no_duplicate_props_1.jsxNoDuplicateProps,
110
- 'no-danger-with-children': no_danger_with_children_1.noDangerWithChildren,
111
- 'no-deprecated': no_deprecated_1.noDeprecated,
112
- 'no-find-dom-node': no_find_dom_node_1.noFindDomNode,
113
- 'no-unsafe': no_unsafe_1.noUnsafe,
114
- 'void-dom-elements-no-children': void_dom_elements_no_children_1.voidDomElementsNoChildren,
115
- 'react-class-to-hooks': react_class_to_hooks_1.reactClassToHooks,
116
- 'no-unnecessary-rerenders': no_unnecessary_rerenders_1.noUnnecessaryRerenders,
117
- 'react-render-optimization': react_render_optimization_1.reactRenderOptimization,
118
- 'react-no-inline-functions': react_no_inline_functions_1.reactNoInlineFunctions,
119
- 'no-default-test-id': no_default_test_id_1.noDefaultTestId,
120
- 'require-data-slot': require_data_slot_1.requireDataSlot,
121
- 'no-is-prefix-prop': no_is_prefix_prop_1.noIsPrefixProp,
122
- 'no-inline-style': no_inline_style_1.noInlineStyle,
123
- 'no-raw-color-literal': no_raw_color_literal_1.noRawColorLiteral,
124
- 'no-arbitrary-token-class': no_arbitrary_token_class_1.noArbitraryTokenClass,
125
- 'no-kind-prop-discriminator': no_kind_prop_discriminator_1.noKindPropDiscriminator,
126
- 'no-wrapper-sub-component': no_wrapper_sub_component_1.noWrapperSubComponent,
127
- 'react/required-attributes': required_attributes_1.requiredAttributes,
128
- 'react/jsx-key': jsx_key_1.jsxKey,
129
- 'react/no-direct-mutation-state': no_direct_mutation_state_1.noDirectMutationState,
130
- 'react/require-optimization': require_optimization_1.requireOptimization,
131
- 'react/no-set-state': no_set_state_1.noSetState,
132
- 'react/no-this-in-sfc': no_this_in_sfc_1.noThisInSfc,
133
- 'react/no-access-state-in-setstate': no_access_state_in_setstate_1.noAccessStateInSetState,
134
- 'react/no-children-prop': no_children_prop_1.noChildrenProp,
135
- 'react/no-danger': no_danger_1.noDanger,
136
- 'react/no-string-refs': no_string_refs_1.noStringRefs,
137
- 'react/no-unknown-property': no_unknown_property_1.noUnknownProperty,
138
- 'react/checked-requires-onchange-or-readonly': checked_requires_onchange_or_readonly_1.checkedRequiresOnchangeOrReadonly,
139
- 'react/default-props-match-prop-types': default_props_match_prop_types_1.defaultPropsMatchPropTypes,
140
- 'react/display-name': display_name_1.displayName,
141
- 'react/jsx-handler-names': jsx_handler_names_1.jsxHandlerNames,
142
- 'react/jsx-max-depth': jsx_max_depth_1.jsxMaxDepth,
143
- 'react/jsx-no-bind': jsx_no_bind_1.jsxNoBind,
144
- 'react/jsx-no-literals': jsx_no_literals_1.jsxNoLiterals,
145
- 'react/no-adjacent-inline-elements': no_adjacent_inline_elements_1.noAdjacentInlineElements,
146
- 'react/no-arrow-function-lifecycle': no_arrow_function_lifecycle_1.noArrowFunctionLifecycle,
147
- 'react/no-did-mount-set-state': no_did_mount_set_state_1.noDidMountSetState,
148
- 'react/no-did-update-set-state': no_did_update_set_state_1.noDidUpdateSetState,
149
- 'react/no-invalid-html-attribute': no_invalid_html_attribute_1.noInvalidHtmlAttribute,
150
- 'react/no-is-mounted': no_is_mounted_1.noIsMounted,
151
- 'react/no-multi-comp': no_multi_comp_1.noMultiComp,
152
- 'react/no-namespace': no_namespace_1.noNamespace,
153
- 'react/no-object-type-as-default-prop': no_object_type_as_default_prop_1.noObjectTypeAsDefaultProp,
154
- 'react/no-redundant-should-component-update': no_redundant_should_component_update_1.noRedundantShouldComponentUpdate,
155
- 'react/no-render-return-value': no_render_return_value_1.noRenderReturnValue,
156
- 'react/no-typos': no_typos_1.noTypos,
157
- 'react/no-unescaped-entities': no_unescaped_entities_1.noUnescapedEntities,
158
- 'react/prefer-es6-class': prefer_es6_class_1.preferEs6Class,
159
- 'react/prefer-stateless-function': prefer_stateless_function_1.preferStatelessFunction,
160
- 'react/prop-types': prop_types_1.propTypes,
161
- 'react/react-in-jsx-scope': react_in_jsx_scope_1.reactInJsxScope,
162
- 'react/require-default-props': require_default_props_1.requireDefaultProps,
163
- 'react/require-render-return': require_render_return_1.requireRenderReturn,
164
- 'react/sort-comp': sort_comp_1.sortComp,
165
- 'react/state-in-constructor': state_in_constructor_1.stateInConstructor,
166
- 'react/static-property-placement': static_property_placement_1.staticPropertyPlacement,
167
- 'react/hooks-exhaustive-deps': hooks_exhaustive_deps_1.hooksExhaustiveDeps,
168
- 'react/jsx-no-target-blank': jsx_no_target_blank_1.jsxNoTargetBlank,
169
- 'react/jsx-no-script-url': jsx_no_script_url_1.jsxNoScriptUrl,
170
- 'react/jsx-no-duplicate-props': jsx_no_duplicate_props_1.jsxNoDuplicateProps,
171
- 'react/no-danger-with-children': no_danger_with_children_1.noDangerWithChildren,
172
- 'react/no-deprecated': no_deprecated_1.noDeprecated,
173
- 'react/no-find-dom-node': no_find_dom_node_1.noFindDomNode,
174
- 'react/no-unsafe': no_unsafe_1.noUnsafe,
175
- 'react/void-dom-elements-no-children': void_dom_elements_no_children_1.voidDomElementsNoChildren,
176
- 'migration/react-class-to-hooks': react_class_to_hooks_1.reactClassToHooks,
177
- 'performance/no-unnecessary-rerenders': no_unnecessary_rerenders_1.noUnnecessaryRerenders,
178
- 'performance/react-render-optimization': react_render_optimization_1.reactRenderOptimization,
179
- 'performance/react-no-inline-functions': react_no_inline_functions_1.reactNoInlineFunctions,
180
- 'component-api/no-default-test-id': no_default_test_id_1.noDefaultTestId,
181
- 'component-api/require-data-slot': require_data_slot_1.requireDataSlot,
182
- 'component-api/no-is-prefix-prop': no_is_prefix_prop_1.noIsPrefixProp,
183
- 'component-api/no-inline-style': no_inline_style_1.noInlineStyle,
184
- 'component-api/no-raw-color-literal': no_raw_color_literal_1.noRawColorLiteral,
185
- 'component-api/no-arbitrary-token-class': no_arbitrary_token_class_1.noArbitraryTokenClass,
186
- 'component-api/no-kind-prop-discriminator': no_kind_prop_discriminator_1.noKindPropDiscriminator,
187
- 'component-api/no-wrapper-sub-component': no_wrapper_sub_component_1.noWrapperSubComponent,
188
- };
189
- exports.plugin = {
190
- meta: {
191
- name: 'eslint-plugin-react-features',
192
- version: '1.2.8',
193
- },
194
- rules: exports.rules,
195
- };
196
- exports.configs = {
197
- flagship: {
198
- plugins: {
199
- 'react-features': exports.plugin,
200
- },
201
- rules: {
202
- 'react-features/hooks-exhaustive-deps': 'error',
203
- },
204
- },
205
- recommended: {
206
- plugins: {
207
- 'react-features': exports.plugin,
208
- },
209
- rules: {
210
- 'react-features/jsx-key': 'error',
211
- 'react-features/no-children-prop': 'warn',
212
- 'react-features/no-danger': 'warn',
213
- 'react-features/no-string-refs': 'error',
214
- 'react-features/no-unknown-property': 'error',
215
- 'react-features/hooks-exhaustive-deps': 'warn',
216
- 'react-features/jsx-no-target-blank': 'error',
217
- 'react-features/jsx-no-script-url': 'error',
218
- 'react-features/jsx-no-duplicate-props': 'error',
219
- 'react-features/no-danger-with-children': 'error',
220
- 'react-features/no-deprecated': 'warn',
221
- },
222
- },
223
- componentApi: {
224
- plugins: {
225
- 'react-features': exports.plugin,
226
- },
227
- rules: {
228
- 'react-features/component-api/no-default-test-id': 'error',
229
- 'react-features/component-api/require-data-slot': 'warn',
230
- 'react-features/component-api/no-is-prefix-prop': 'warn',
231
- 'react-features/component-api/no-inline-style': 'warn',
232
- 'react-features/component-api/no-raw-color-literal': 'warn',
233
- 'react-features/component-api/no-arbitrary-token-class': 'warn',
234
- 'react-features/component-api/no-kind-prop-discriminator': 'warn',
235
- 'react-features/component-api/no-wrapper-sub-component': 'warn',
236
- },
237
- },
238
- };
239
- 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,3 +1 @@
1
- "use strict";
2
- const index_1 = require("./index");
3
- module.exports = index_1.plugin;
1
+ "use strict";const index_1=require("./index");module.exports=index_1.plugin;
@@ -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}})}}}});