@neralabs/rerail-pack-react 0.1.3 → 0.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.
- package/README.md +84 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,3 +45,87 @@ every false positive and false negative printed:
|
|
|
45
45
|
node candidates/build.mjs
|
|
46
46
|
node --import tsx conformance/languages/cli.ts --pack react --rule react-jsx-key --fixtures
|
|
47
47
|
```
|
|
48
|
+
|
|
49
|
+
## Rule details
|
|
50
|
+
|
|
51
|
+
What each rule matches beyond its one-line description: exact matching, edge cases, upstream settings and known divergences.
|
|
52
|
+
|
|
53
|
+
### `react-button-has-type`
|
|
54
|
+
|
|
55
|
+
Port of eslint-plugin-react 7.37.5 react/button-has-type with button, submit and reset allowed. Reports a `<button>` with no `type` attribute (looked up case-insensitively, as jsx-ast-utils getProp does) or whose first `type` value is not a literal button/submit/reset. Each leaf of a conditional `type` is checked, and a non-literal leaf is reported at itself. The same applies to `React.createElement('button', props)` with the default pragma.
|
|
56
|
+
|
|
57
|
+
### `react-hooks-exhaustive-deps`
|
|
58
|
+
|
|
59
|
+
Port of eslint-plugin-react-hooks 7.1.1 react-hooks/exhaustive-deps, missing-dependency report only (no unnecessary/duplicate-dependency reports). Checks the dependency array literal of useEffect, useLayoutEffect, useInsertionEffect, useCallback and useMemo (bare or as `React.*`) when the inline callback reads a name bound in the calling function (outside the callback) that no dependency's root names. useState/useReducer setters and dispatchers, useRef, useEffectEvent and useTransition results count as stable and need not be listed.
|
|
60
|
+
|
|
61
|
+
### `react-hooks-rules-of-hooks`
|
|
62
|
+
|
|
63
|
+
Port of eslint-plugin-react-hooks 7.1.1 react-hooks/rules-of-hooks. A hook call (`use`, `useX`, `Namespace.useX`) is reported at its callee when it runs, in a component or hook (a function named `X…`/`useX`, or the callback of memo/forwardRef), conditionally (if/conditional/logical/switch/catch/default branch, or after an earlier return); in a class method or field; in another named function; at the top level; in an anonymous callback inside a component or hook; in a loop; in an async component or hook; and `use` inside try/catch. ESLint's code-path analysis is approximated syntactically.
|
|
64
|
+
|
|
65
|
+
### `react-jsx-key`
|
|
66
|
+
|
|
67
|
+
Port of eslint-plugin-react 7.37.5 react/jsx-key, default options. Reports an element (not a fragment) without `key` that is an array literal's element, or that a `.map(fn)` / `.from(x, fn)` callback returns: the arrow's body, a branch of its conditional body, the right side of its logical body, or a return statement directly in the callback body or in nested if/else branches. Never reported inside `React.Children.toArray(...)` / `Children.toArray(...)`.
|
|
68
|
+
|
|
69
|
+
### `react-jsx-no-comment-textnodes`
|
|
70
|
+
|
|
71
|
+
Port of eslint-plugin-react 7.37.5 react/jsx-no-comment-textnodes: JSX text with a line that starts (after whitespace) with `//` or `/*`.
|
|
72
|
+
|
|
73
|
+
### `react-jsx-no-duplicate-props`
|
|
74
|
+
|
|
75
|
+
Port of eslint-plugin-react 7.37.5 react/jsx-no-duplicate-props, case-sensitive. Namespaced attribute names and spreads are skipped.
|
|
76
|
+
|
|
77
|
+
### `react-jsx-no-target-blank`
|
|
78
|
+
|
|
79
|
+
Port of eslint-plugin-react 7.37.5 react/jsx-no-target-blank with default options (links only, enforceDynamicLinks always, allowReferrer false). Reports an `<a>` whose last `target` is possibly `_blank` (a string, or a conditional with a `_blank` branch), with an external last `href` string (`scheme:` or `//`) or any `href` expression, and whose last `rel` does not give `noreferrer` on every value it may take (a string, the first quasi of a template, both branches of a conditional, or, when target and rel test the same name, the branch on which target is `_blank`).
|
|
80
|
+
|
|
81
|
+
### `react-jsx-no-undef`
|
|
82
|
+
|
|
83
|
+
Port of eslint-plugin-react 7.37.5 react/jsx-no-undef (allowGlobals: false, module code). Checks a non-DOM JSX tag name, or the root of a member tag name, against file-local bindings; globals, even configured ones, do not count in a module.
|
|
84
|
+
|
|
85
|
+
### `react-no-children-prop`
|
|
86
|
+
|
|
87
|
+
Port of eslint-plugin-react 7.37.5 react/no-children-prop (allowFunctions: false): a `children` JSX attribute, and a createElement call (default pragma) whose second argument is an object literal with a `children` key.
|
|
88
|
+
|
|
89
|
+
### `react-no-danger`
|
|
90
|
+
|
|
91
|
+
Port of eslint-plugin-react 7.37.5 react/no-danger, default options. Only DOM elements (tag name starting lower-case, per jsx-ast-utils elementType) are checked; custom components receiving the prop are not reported.
|
|
92
|
+
|
|
93
|
+
### `react-no-danger-with-children`
|
|
94
|
+
|
|
95
|
+
Port of eslint-plugin-react 7.37.5 react/no-danger-with-children. Children means a first child that is not a line break, or a `children` prop. Props are also read through `{...name}` spreads of a variable initialised with an object literal. For `x.createElement(type, props, ...)`, props may be an object literal or a variable initialised with one, and children is a third argument or a `children` prop.
|
|
96
|
+
|
|
97
|
+
### `react-no-direct-mutation-state`
|
|
98
|
+
|
|
99
|
+
Port of eslint-plugin-react 7.37.5 react/no-direct-mutation-state. Reports an assignment or update whose target is a member chain rooted at `this.state`, inside a class component (nearest class extends Component / PureComponent / React.Component / React.PureComponent) or a function that is a property of the object passed to createReactClass. In a constructor it is reported only when inside a call. Reported at `this`. Function components (the plugin's Components.detect stateless detection) are not modelled.
|
|
100
|
+
|
|
101
|
+
### `react-no-find-dom-node`
|
|
102
|
+
|
|
103
|
+
Port of eslint-plugin-react 7.37.5 react/no-find-dom-node: any call whose callee is `findDOMNode` or a member `.findDOMNode`.
|
|
104
|
+
|
|
105
|
+
### `react-no-is-mounted`
|
|
106
|
+
|
|
107
|
+
Port of eslint-plugin-react 7.37.5 react/no-is-mounted: `this.isMounted()` inside an object property or a method (ESTree Property / MethodDefinition ancestor).
|
|
108
|
+
|
|
109
|
+
### `react-no-render-return-value`
|
|
110
|
+
|
|
111
|
+
Port of eslint-plugin-react 7.37.5 react/no-render-return-value (latest React). The value counts as used when the call's parent (parentheses aside) is a declarator, a property, a return, an arrow body or an assignment.
|
|
112
|
+
|
|
113
|
+
### `react-no-string-refs`
|
|
114
|
+
|
|
115
|
+
Port of eslint-plugin-react 7.37.5 react/no-string-refs (latest React, noTemplateLiterals: false): a `ref` attribute whose value is a string literal, bare or in braces. Template literals are not reported. From React 18.3 on the plugin no longer reports `this.refs` reads, so neither does the port.
|
|
116
|
+
|
|
117
|
+
### `react-no-unescaped-entities`
|
|
118
|
+
|
|
119
|
+
Port of eslint-plugin-react 7.37.5 react/no-unescaped-entities (forbids >, ", ', }). One finding per such character, but only on the first line of a JSX text node (the k-th check holds where that line has at least k of them; ESLint reports each character at its own column). Characters on a text node's later lines are not reported, because a finding is anchored at a node and a text node has no node per line.
|
|
120
|
+
|
|
121
|
+
### `react-react-in-jsx-scope`
|
|
122
|
+
|
|
123
|
+
Port of eslint-plugin-react 7.37.5 react/react-in-jsx-scope (pragma React). A JSX opening element or fragment is reported when no `React` binding is visible: none declared at the top level (import, var/let/const, function), in an enclosing block's own declarations, or as an enclosing function's parameter.
|
|
124
|
+
|
|
125
|
+
### `react-self-closing-comp`
|
|
126
|
+
|
|
127
|
+
Port of eslint-plugin-react 7.37.5 react/self-closing-comp (component: true, html: true). Reports an element with a closing tag and no children except whitespace that contains a line break (a same-line space is text and is not reported). Namespaced tags only when lower-case (DOM).
|
|
128
|
+
|
|
129
|
+
### `react-void-dom-elements-no-children`
|
|
130
|
+
|
|
131
|
+
Port of eslint-plugin-react 7.37.5 react/void-dom-elements-no-children. Void elements: area, base, br, col, embed, hr, img, input, keygen, link, menuitem, meta, param, source, track, wbr. Reports children, a `children` attribute or a `dangerouslySetInnerHTML` attribute (one report each); the same through createElement with an object-literal props argument.
|
package/package.json
CHANGED