codelaw-rules-react 0.2.0__py3-none-any.whl
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.
- codelaw_rules_react/LICENSE +23 -0
- codelaw_rules_react/NOTICE +10 -0
- codelaw_rules_react/README.md +51 -0
- codelaw_rules_react/codelaw-pack.toml +6 -0
- codelaw_rules_react/corpus.toml +25 -0
- codelaw_rules_react/data/react/dom-property-aliases.json +131 -0
- codelaw_rules_react/presets/react/conventions.toml +5 -0
- codelaw_rules_react/presets/react/recommended.toml +22 -0
- codelaw_rules_react/rules/react/display-name.md +91 -0
- codelaw_rules_react/rules/react/exhaustive-deps.md +116 -0
- codelaw_rules_react/rules/react/hook-prefix.md +108 -0
- codelaw_rules_react/rules/react/jsx-key.md +99 -0
- codelaw_rules_react/rules/react/jsx-no-comment-textnodes.md +87 -0
- codelaw_rules_react/rules/react/jsx-no-duplicate-props.md +66 -0
- codelaw_rules_react/rules/react/jsx-no-target-blank.md +78 -0
- codelaw_rules_react/rules/react/jsx-no-undef.md +78 -0
- codelaw_rules_react/rules/react/no-children-prop.md +80 -0
- codelaw_rules_react/rules/react/no-danger-with-children.md +83 -0
- codelaw_rules_react/rules/react/no-deprecated.md +84 -0
- codelaw_rules_react/rules/react/no-direct-mutation-state.md +102 -0
- codelaw_rules_react/rules/react/no-find-dom-node.md +72 -0
- codelaw_rules_react/rules/react/no-is-mounted.md +109 -0
- codelaw_rules_react/rules/react/no-render-return-value.md +75 -0
- codelaw_rules_react/rules/react/no-string-refs.md +72 -0
- codelaw_rules_react/rules/react/no-unescaped-entities.md +69 -0
- codelaw_rules_react/rules/react/no-unknown-property.md +69 -0
- codelaw_rules_react/rules/react/props-type-name.md +43 -0
- codelaw_rules_react/rules/react/require-render-return.md +91 -0
- codelaw_rules_react/rules/react/rules-of-hooks.md +128 -0
- codelaw_rules_react-0.2.0.dist-info/METADATA +61 -0
- codelaw_rules_react-0.2.0.dist-info/RECORD +33 -0
- codelaw_rules_react-0.2.0.dist-info/WHEEL +4 -0
- codelaw_rules_react-0.2.0.dist-info/licenses/LICENSE +23 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codelaw-rules-react
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: codelaw's React rules, from eslint-plugin-react and eslint-plugin-react-hooks (SR-RULE-PACKS)
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Project-URL: Repository, https://github.com/arpitarya/codelaw
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# @codelaw/rules-react · codelaw-rules-react
|
|
12
|
+
|
|
13
|
+
codelaw's React rules — one of codelaw's first-party rule packs
|
|
14
|
+
([SR-RULE-PACKS](../../records/0101_rule-packs.md)). The
|
|
15
|
+
same files ship on npm as `@codelaw/rules-react` and on PyPI as `codelaw-rules-react`.
|
|
16
|
+
|
|
17
|
+
```toml
|
|
18
|
+
# codelaw.toml
|
|
19
|
+
extends = ["codelaw:js/recommended", "codelaw:react/recommended"]
|
|
20
|
+
preview = true # every rule is `preview` until a corpus run promotes it
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Presets
|
|
24
|
+
|
|
25
|
+
<!-- docs-sync:presets -->
|
|
26
|
+
|
|
27
|
+
| preset | rules | ported from |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| `react/recommended` | 19 | eslint-plugin-react 7.37.5 `recommended` + `jsx-runtime` (17 of its 20 active rules), and eslint-plugin-react-hooks 7.1.1's `rules-of-hooks` and `exhaustive-deps` |
|
|
30
|
+
| `react/conventions` | 2 | codelaw's starter catalogue: `react/hook-prefix`, `react/props-type-name` — opt in |
|
|
31
|
+
|
|
32
|
+
<!-- /docs-sync:presets -->
|
|
33
|
+
|
|
34
|
+
Every rule is **reimplemented**, not vendored: the matchers, messages and docs
|
|
35
|
+
are written fresh, and each rule's `ported_from:` names the source rule.
|
|
36
|
+
|
|
37
|
+
## How the ports differ
|
|
38
|
+
|
|
39
|
+
Every rule matches its source's documented behaviour on the source's own
|
|
40
|
+
examples. Where codelaw differs, the rule's `## Differences from the source`
|
|
41
|
+
section says so. The larger ones:
|
|
42
|
+
|
|
43
|
+
| rule | difference |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `react/jsx-key` | elements returned from a `.map()` callback's block body are not checked yet |
|
|
46
|
+
| `react/no-unknown-property` | renames HTML spellings (`class`, `onclick`, `tabindex`); in `.js`/`.jsx` the JavaScript grammar can't parse `class=` and `for=` |
|
|
47
|
+
| `react/exhaustive-deps` | dependencies compared by root name; setters, dispatchers and refs are stable |
|
|
48
|
+
| `react/rules-of-hooks` | an early `return` anywhere before a hook counts as making it conditional |
|
|
49
|
+
|
|
50
|
+
## Not ported, and why
|
|
51
|
+
|
|
52
|
+
| rule | why |
|
|
53
|
+
|---|---|
|
|
54
|
+
| `react/prop-types` | needs the component's declared prop types matched to its uses; TypeScript types do this job |
|
|
55
|
+
| `react/jsx-uses-vars` | marks JSX names as used for `no-unused-vars`; codelaw's semantic model already counts them |
|
|
56
|
+
| `react/react-in-jsx-scope`, `react/jsx-uses-react` | turned off by `jsx-runtime` |
|
|
57
|
+
| eslint-plugin-react-hooks' 14 React Compiler rules | need the React Compiler's analysis |
|
|
58
|
+
|
|
59
|
+
## Data
|
|
60
|
+
|
|
61
|
+
`data/react/dom-property-aliases.json` — HTML attribute names and the React prop names that replace them, written for this pack.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
codelaw_rules_react/LICENSE,sha256=_R8NFLyGiKUo7mPzbUGbqg3hdEKYhaTsIgBGXqtFfa8,1097
|
|
2
|
+
codelaw_rules_react/NOTICE,sha256=sRzqz8XicXXxpxJzYS4-h74s62-rrcEE0tYJ6Wplkb4,513
|
|
3
|
+
codelaw_rules_react/README.md,sha256=FYFgDfR8Vz-rr8PRNJ_OYtQUGoVU--wzoPK6XgCA90c,2320
|
|
4
|
+
codelaw_rules_react/codelaw-pack.toml,sha256=FXsb_OOQB7SGEs9biip8-L9ONWGeA7zLfbqS1fyukqM,288
|
|
5
|
+
codelaw_rules_react/corpus.toml,sha256=7qSDhsFWTHmX1K-P_plSfGQE5X6efZc1ow_dBog33hw,769
|
|
6
|
+
codelaw_rules_react/data/react/dom-property-aliases.json,sha256=9et0Ga_COmMLwWESMjNbcWtMxOUnJ_fMfmGa3aXfJH4,3677
|
|
7
|
+
codelaw_rules_react/presets/react/conventions.toml,sha256=RX_xxg6JbGJsoKIAHccYSE6iz44Kyrd_M5RGGkbUqYg,148
|
|
8
|
+
codelaw_rules_react/presets/react/recommended.toml,sha256=I3_igcKXROdOVZsX-mYh8Je-tXdtIMbtiIUtIxSvlrA,856
|
|
9
|
+
codelaw_rules_react/rules/react/display-name.md,sha256=CHpYZcOazbY4CNpJBUs_kae1EH9IrhQG-KnpPJaYW_M,1767
|
|
10
|
+
codelaw_rules_react/rules/react/exhaustive-deps.md,sha256=4Rf673ipZm_lgfAN_qcoDBCX4CxvhCPo8I1nWXtavuA,1820
|
|
11
|
+
codelaw_rules_react/rules/react/hook-prefix.md,sha256=qBHOQd85LZ8ati5eNOYVa7gYH7JMgtOy-y3d4cKp3z8,1809
|
|
12
|
+
codelaw_rules_react/rules/react/jsx-key.md,sha256=7qzmOVyew4axQFedx6Ddrdtd1NGZRM_ULWn-KkuwxSg,2504
|
|
13
|
+
codelaw_rules_react/rules/react/jsx-no-comment-textnodes.md,sha256=3bJSnTkKBgnEQDtHB27eJi0QnP94dvPdf01t0H1OuCY,1167
|
|
14
|
+
codelaw_rules_react/rules/react/jsx-no-duplicate-props.md,sha256=Vjohx1VLtP9NSA1PwoHsaZG0XO9Ty7s3_gs6t2VHY4o,935
|
|
15
|
+
codelaw_rules_react/rules/react/jsx-no-target-blank.md,sha256=D_YokQI1jdBYzvPkIwa-pQHF4_YKGMvwEPuZvoHJMGQ,1565
|
|
16
|
+
codelaw_rules_react/rules/react/jsx-no-undef.md,sha256=8-gtVg1HFAFtAiwxwxMWSQXcXzOPgDTISEdZDaGZFzY,1258
|
|
17
|
+
codelaw_rules_react/rules/react/no-children-prop.md,sha256=uB54Qez4KhBXGIkn9TalamIYLVLOpbxF_aZuaHUYEHg,1293
|
|
18
|
+
codelaw_rules_react/rules/react/no-danger-with-children.md,sha256=b_CthGtnQU-aHhCmLvKMgsNU8zNv6H0xGFp8Tlvedw4,1820
|
|
19
|
+
codelaw_rules_react/rules/react/no-deprecated.md,sha256=ne0_J2pcNHslCqXS614d6MfoxI3BRgXRYd-locSQpeE,1826
|
|
20
|
+
codelaw_rules_react/rules/react/no-direct-mutation-state.md,sha256=CSxtZ0dQiOzcqrUnDhYRKzT4n9YSJ3XYz-ycKrJ-aJI,1801
|
|
21
|
+
codelaw_rules_react/rules/react/no-find-dom-node.md,sha256=I71JEvCvl8nXJoqqxWINFnNLXD3QypK_xxYyrbPTZgk,1077
|
|
22
|
+
codelaw_rules_react/rules/react/no-is-mounted.md,sha256=SF26sUIfQw5irX5ViXw-tCjN-4dJpf7orwfXJXIZZ7M,1577
|
|
23
|
+
codelaw_rules_react/rules/react/no-render-return-value.md,sha256=uwO8ud5446ZFq-QqzL7QrPXwcVtc04K1Zs2v4olRcc8,1276
|
|
24
|
+
codelaw_rules_react/rules/react/no-string-refs.md,sha256=62xqUz53MlXFksozSXOrniZsBymxExURkUTeYbeNaCE,1088
|
|
25
|
+
codelaw_rules_react/rules/react/no-unescaped-entities.md,sha256=W4O7nOlYfkEToNZ6LyW5-69TRt4aSrCNc8cPM4rns0s,1063
|
|
26
|
+
codelaw_rules_react/rules/react/no-unknown-property.md,sha256=RWs01xlox_1MgQmh-nVEjbNMEAUrkoy0JSNiWu4Z0NY,1387
|
|
27
|
+
codelaw_rules_react/rules/react/props-type-name.md,sha256=3tZk-Q_va3fDhPz9dYZ8oZZRCHncjogTQGunFMydbcY,877
|
|
28
|
+
codelaw_rules_react/rules/react/require-render-return.md,sha256=qp8nvHc6eUNui_AFGPQYRUrE5j5-NCNXMGXJYqAvvIc,1324
|
|
29
|
+
codelaw_rules_react/rules/react/rules-of-hooks.md,sha256=zfJ82WenO7igbgWHw_9Vrji-rW4irnsHdrvnGWYWEjc,2027
|
|
30
|
+
codelaw_rules_react-0.2.0.dist-info/METADATA,sha256=NLROOQFTw4Ha9OItOzfGcAl4AkbTx4TOF50Oye4mALo,2659
|
|
31
|
+
codelaw_rules_react-0.2.0.dist-info/WHEEL,sha256=iL940CG79gUG1gJG0fuOXtdNe75u1bVsFzkAeObStpM,97
|
|
32
|
+
codelaw_rules_react-0.2.0.dist-info/licenses/LICENSE,sha256=_R8NFLyGiKUo7mPzbUGbqg3hdEKYhaTsIgBGXqtFfa8,1097
|
|
33
|
+
codelaw_rules_react-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Arpit Arya
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
SPDX-License-Identifier: MIT
|