eslint-plugin-react-features 1.1.2 → 1.1.4

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 (61) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +71 -10
  3. package/package.json +15 -3
  4. package/src/index.d.ts +375 -6
  5. package/src/index.js +15 -1
  6. package/src/oxlint.d.ts +20 -0
  7. package/src/oxlint.js +21 -0
  8. package/src/rules/migration/react-class-to-hooks.js +6 -1
  9. package/src/rules/performance/no-unnecessary-rerenders.js +7 -3
  10. package/src/rules/performance/react-no-inline-functions.js +3 -0
  11. package/src/rules/performance/react-render-optimization.js +2 -1
  12. package/src/rules/react/checked-requires-onchange-or-readonly.js +1 -0
  13. package/src/rules/react/default-props-match-prop-types.js +1 -0
  14. package/src/rules/react/display-name.js +1 -0
  15. package/src/rules/react/hooks-exhaustive-deps.d.ts +1 -1
  16. package/src/rules/react/hooks-exhaustive-deps.js +136 -47
  17. package/src/rules/react/jsx-handler-names.js +1 -0
  18. package/src/rules/react/jsx-key.js +3 -2
  19. package/src/rules/react/jsx-max-depth.js +1 -0
  20. package/src/rules/react/jsx-no-bind.js +1 -0
  21. package/src/rules/react/jsx-no-duplicate-props.js +1 -0
  22. package/src/rules/react/jsx-no-literals.js +1 -0
  23. package/src/rules/react/jsx-no-script-url.js +6 -2
  24. package/src/rules/react/jsx-no-target-blank.js +7 -1
  25. package/src/rules/react/no-access-state-in-setstate.js +1 -0
  26. package/src/rules/react/no-adjacent-inline-elements.js +1 -0
  27. package/src/rules/react/no-arrow-function-lifecycle.js +1 -0
  28. package/src/rules/react/no-children-prop.js +1 -0
  29. package/src/rules/react/no-danger-with-children.js +2 -0
  30. package/src/rules/react/no-danger.js +3 -0
  31. package/src/rules/react/no-deprecated.js +1 -0
  32. package/src/rules/react/no-did-mount-set-state.js +1 -0
  33. package/src/rules/react/no-did-update-set-state.js +1 -0
  34. package/src/rules/react/no-direct-mutation-state.js +24 -66
  35. package/src/rules/react/no-find-dom-node.js +1 -0
  36. package/src/rules/react/no-invalid-html-attribute.js +1 -0
  37. package/src/rules/react/no-is-mounted.js +1 -0
  38. package/src/rules/react/no-multi-comp.js +4 -0
  39. package/src/rules/react/no-namespace.js +1 -0
  40. package/src/rules/react/no-object-type-as-default-prop.js +1 -0
  41. package/src/rules/react/no-redundant-should-component-update.js +1 -0
  42. package/src/rules/react/no-render-return-value.js +1 -0
  43. package/src/rules/react/no-set-state.js +1 -0
  44. package/src/rules/react/no-string-refs.js +1 -0
  45. package/src/rules/react/no-this-in-sfc.js +1 -0
  46. package/src/rules/react/no-typos.js +1 -0
  47. package/src/rules/react/no-unescaped-entities.js +1 -0
  48. package/src/rules/react/no-unknown-property.js +1 -0
  49. package/src/rules/react/no-unsafe.js +1 -0
  50. package/src/rules/react/prefer-es6-class.js +1 -0
  51. package/src/rules/react/prefer-stateless-function.js +8 -3
  52. package/src/rules/react/prop-types.js +2 -0
  53. package/src/rules/react/react-in-jsx-scope.js +1 -0
  54. package/src/rules/react/require-default-props.js +4 -0
  55. package/src/rules/react/require-optimization.js +1 -0
  56. package/src/rules/react/require-render-return.js +1 -0
  57. package/src/rules/react/required-attributes.js +6 -0
  58. package/src/rules/react/sort-comp.js +17 -13
  59. package/src/rules/react/state-in-constructor.js +3 -0
  60. package/src/rules/react/static-property-placement.js +7 -0
  61. package/src/rules/react/void-dom-elements-no-children.js +2 -0
@@ -23,6 +23,7 @@ exports.staticPropertyPlacement = (0, eslint_devkit_1.createRule)({
23
23
  meta: {
24
24
  type: 'problem',
25
25
  docs: {
26
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/static-property-placement.md',
26
27
  description: 'Enforce static property placement',
27
28
  },
28
29
  schema: [
@@ -69,6 +70,7 @@ exports.staticPropertyPlacement = (0, eslint_devkit_1.createRule)({
69
70
  }
70
71
  },
71
72
  };
73
+ // oxlint-disable-next-line consistent-function-scoping
72
74
  function isReactComponent(node) {
73
75
  if (!node.superClass)
74
76
  return false;
@@ -124,12 +126,14 @@ exports.staticPropertyPlacement = (0, eslint_devkit_1.createRule)({
124
126
  }
125
127
  }
126
128
  }
129
+ // oxlint-disable-next-line consistent-function-scoping
127
130
  function isStaticProperty(member) {
128
131
  return (
129
132
  // Handle PropertyDefinition and MethodDefinition
130
133
  (member.type === 'PropertyDefinition' || member.type === 'MethodDefinition') &&
131
134
  member.static);
132
135
  }
136
+ // oxlint-disable-next-line consistent-function-scoping
133
137
  function getPropertyName(member) {
134
138
  if (member.key.type === 'Identifier') {
135
139
  return member.key.name;
@@ -137,10 +141,12 @@ exports.staticPropertyPlacement = (0, eslint_devkit_1.createRule)({
137
141
  return null;
138
142
  }
139
143
  /* v8 ignore start - only used in unreachable code path above */
144
+ // oxlint-disable-next-line consistent-function-scoping
140
145
  function getPropertyKeyNode(member) {
141
146
  return member.key;
142
147
  }
143
148
  /* v8 ignore stop */
149
+ // oxlint-disable-next-line consistent-function-scoping
144
150
  function areInSameGroup(name1, name2, groups) {
145
151
  for (const group of groups) {
146
152
  if (group.properties.includes(name1) && group.properties.includes(name2)) {
@@ -150,6 +156,7 @@ exports.staticPropertyPlacement = (0, eslint_devkit_1.createRule)({
150
156
  return false;
151
157
  }
152
158
  /* v8 ignore start - only used in unreachable code path above */
159
+ // oxlint-disable-next-line consistent-function-scoping
153
160
  function shouldBeBetween(name, before, after, groups) {
154
161
  for (const group of groups) {
155
162
  const beforeIndex = group.properties.indexOf(before);
@@ -31,6 +31,7 @@ exports.voidDomElementsNoChildren = (0, eslint_devkit_2.createRule)({
31
31
  meta: {
32
32
  type: 'problem',
33
33
  docs: {
34
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-react-features/docs/rules/void-dom-elements-no-children.md',
34
35
  description: 'Prevent void DOM elements from having children',
35
36
  },
36
37
  messages: {
@@ -57,6 +58,7 @@ exports.voidDomElementsNoChildren = (0, eslint_devkit_2.createRule)({
57
58
  attr.name.type === 'JSXIdentifier' &&
58
59
  attr.name.name === 'dangerouslySetInnerHTML');
59
60
  }
61
+ // oxlint-disable-next-line consistent-function-scoping
60
62
  function hasJSXChildren(node) {
61
63
  return node.children.some(child => {
62
64
  if (child.type === 'JSXText') {