@codelaw/rules-js 0.1.0 → 0.2.0

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 (82) hide show
  1. package/NOTICE +0 -9
  2. package/README.md +14 -47
  3. package/codelaw-pack.toml +3 -3
  4. package/corpus.toml +76 -0
  5. package/package.json +2 -2
  6. package/presets/js/conventions.toml +0 -4
  7. package/presets/js/project.toml +4 -0
  8. package/presets/js/typescript.toml +7 -0
  9. package/data/node/deprecated-api.json +0 -83
  10. package/data/react/dom-property-aliases.json +0 -131
  11. package/presets/node/recommended.toml +0 -13
  12. package/presets/react/recommended.toml +0 -22
  13. package/presets/stencil/recommended.toml +0 -18
  14. package/presets/ts/recommended.toml +0 -27
  15. package/rules/node/hashbang.md +0 -71
  16. package/rules/node/no-deprecated-api.md +0 -91
  17. package/rules/node/no-exports-assign.md +0 -92
  18. package/rules/node/no-extraneous-import.md +0 -118
  19. package/rules/node/no-extraneous-require.md +0 -117
  20. package/rules/node/no-missing-import.md +0 -118
  21. package/rules/node/no-missing-require.md +0 -117
  22. package/rules/node/no-process-exit.md +0 -99
  23. package/rules/node/no-unpublished-import.md +0 -134
  24. package/rules/node/no-unpublished-require.md +0 -133
  25. package/rules/react/display-name.md +0 -91
  26. package/rules/react/exhaustive-deps.md +0 -116
  27. package/rules/react/hook-prefix.md +0 -108
  28. package/rules/react/jsx-key.md +0 -99
  29. package/rules/react/jsx-no-comment-textnodes.md +0 -87
  30. package/rules/react/jsx-no-duplicate-props.md +0 -66
  31. package/rules/react/jsx-no-target-blank.md +0 -78
  32. package/rules/react/jsx-no-undef.md +0 -78
  33. package/rules/react/no-children-prop.md +0 -80
  34. package/rules/react/no-danger-with-children.md +0 -83
  35. package/rules/react/no-deprecated.md +0 -84
  36. package/rules/react/no-direct-mutation-state.md +0 -102
  37. package/rules/react/no-find-dom-node.md +0 -72
  38. package/rules/react/no-is-mounted.md +0 -109
  39. package/rules/react/no-render-return-value.md +0 -75
  40. package/rules/react/no-string-refs.md +0 -72
  41. package/rules/react/no-unescaped-entities.md +0 -69
  42. package/rules/react/no-unknown-property.md +0 -69
  43. package/rules/react/props-type-name.md +0 -43
  44. package/rules/react/require-render-return.md +0 -91
  45. package/rules/react/rules-of-hooks.md +0 -128
  46. package/rules/stencil/ban-default-true.md +0 -70
  47. package/rules/stencil/ban-exported-const-enums.md +0 -60
  48. package/rules/stencil/ban-prefix.md +0 -76
  49. package/rules/stencil/decorators-context.md +0 -61
  50. package/rules/stencil/host-data-deprecated.md +0 -73
  51. package/rules/stencil/methods-must-be-public.md +0 -69
  52. package/rules/stencil/no-unused-watch.md +0 -68
  53. package/rules/stencil/own-methods-must-be-private.md +0 -68
  54. package/rules/stencil/own-props-must-be-private.md +0 -60
  55. package/rules/stencil/prefer-vdom-listener.md +0 -67
  56. package/rules/stencil/prop-readonly.md +0 -63
  57. package/rules/stencil/props-must-be-public.md +0 -68
  58. package/rules/stencil/required-jsdoc.md +0 -66
  59. package/rules/stencil/reserved-member-names.md +0 -70
  60. package/rules/stencil/strict-mutable.md +0 -75
  61. package/rules/stencil/tag-prefix.md +0 -75
  62. package/rules/ts/ban-ts-comment.md +0 -64
  63. package/rules/ts/no-array-constructor.md +0 -58
  64. package/rules/ts/no-duplicate-enum-values.md +0 -65
  65. package/rules/ts/no-empty-object-type.md +0 -65
  66. package/rules/ts/no-explicit-any.md +0 -61
  67. package/rules/ts/no-extra-non-null-assertion.md +0 -50
  68. package/rules/ts/no-misused-new.md +0 -70
  69. package/rules/ts/no-namespace.md +0 -65
  70. package/rules/ts/no-non-null-asserted-optional-chain.md +0 -55
  71. package/rules/ts/no-require-imports.md +0 -54
  72. package/rules/ts/no-this-alias.md +0 -68
  73. package/rules/ts/no-unnecessary-type-constraint.md +0 -64
  74. package/rules/ts/no-unsafe-declaration-merging.md +0 -73
  75. package/rules/ts/no-unsafe-function-type.md +0 -57
  76. package/rules/ts/no-unused-expressions.md +0 -61
  77. package/rules/ts/no-unused-vars.md +0 -68
  78. package/rules/ts/no-wrapper-object-types.md +0 -49
  79. package/rules/ts/prefer-as-const.md +0 -47
  80. package/rules/ts/prefer-namespace-keyword.md +0 -63
  81. package/rules/ts/triple-slash-reference.md +0 -60
  82. package/rules/ts/type-only-imports.md +0 -57
package/NOTICE CHANGED
@@ -5,15 +5,6 @@ https://github.com/sindresorhus/globals — Copyright (c) Sindre Sorhus
5
5
  <sindresorhus@gmail.com> (https://sindresorhus.com), released under the MIT
6
6
  License.
7
7
 
8
- data/node/deprecated-api.json was written for this pack: the Node.js APIs that
9
- the Node.js documentation deprecates (https://nodejs.org/api/deprecations.html),
10
- each with its documented replacement, in codelaw's own words. No text or code
11
- is copied from Node.js.
12
-
13
- data/react/dom-property-aliases.json was written for this pack: HTML attribute
14
- names and the React DOM prop names that replace them (`class` -> `className`),
15
- as React documents them. No React code is included.
16
-
17
8
  The rules are reimplementations written for codelaw. Their `ported_from:`
18
9
  fields name the ESLint rules (https://eslint.org, MIT License) whose documented
19
10
  behaviour they reproduce; no ESLint code or documentation text is included.
package/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  # @codelaw/rules-js · codelaw-rules-js
2
2
 
3
- codelaw's rules for JavaScript, TypeScript, JSX and TSX — one of the five
4
- first-party rule packs ([SR-RULE-PACKS](../../records/0101_rule-packs.md)). The
5
- same files ship on npm as `@codelaw/rules-js` and on PyPI as
6
- `codelaw-rules-js`.
3
+ codelaw's core JavaScript rules, which also run on TypeScript, JSX and TSX — one of codelaw's first-party rule packs
4
+ ([SR-RULE-PACKS](../../records/0101_rule-packs.md)). The
5
+ same files ship on npm as `@codelaw/rules-js` and on PyPI as `codelaw-rules-js`.
7
6
 
8
7
  ```toml
9
8
  # codelaw.toml
@@ -13,20 +12,22 @@ preview = true # every rule is `preview` until a corpus run promotes it
13
12
 
14
13
  ## Presets
15
14
 
15
+ <!-- docs-sync:presets -->
16
+
16
17
  | preset | rules | ported from |
17
18
  |---|---|---|
18
19
  | `js/recommended` | 64 | ESLint `js.configs.recommended`, `@eslint/js` 10.0.1 — all 64 rules |
19
- | `ts/recommended` | 24 | typescript-eslint `recommended` 8.71.2 (not type-checked) — all 20 rules — plus the four core rules its `eslint-recommended` switches on for TypeScript: `js/no-var`, `js/prefer-const`, `js/prefer-rest-params`, `js/prefer-spread` |
20
- | `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` |
21
- | `node/recommended` | 10 | eslint-plugin-n 18.5.0 `recommended-module` — 10 of its 14 rules: the 3 that need no `package.json`, `node/hashbang`, which reads the nearest `package.json`'s `bin`, and the 6 import rules, which run on the project graph |
22
- | `stencil/recommended` | 15 | @stencil/eslint-plugin 1.4.0 `recommended` — 15 of its 21 rules |
23
- | `js/conventions` | 7 | codelaw's starter catalogue: `js/exports-at-end`, `js/import-groups`, `js/no-default-export`, `ts/type-only-imports`, `react/hook-prefix`, `react/props-type-name`, `stencil/tag-prefix` — opt in |
20
+ | `js/typescript` | 4 | the four core rules typescript-eslint 8.71.2's `eslint-recommended` switches on for TypeScript: `js/no-var`, `js/prefer-const`, `js/prefer-rest-params`, `js/prefer-spread`; use it with `codelaw:ts/recommended` |
21
+ | `js/conventions` | 3 | codelaw's starter catalogue: `js/exports-at-end`, `js/import-groups`, `js/no-default-export` — opt in |
22
+ | `js/project` | 1 | `graph/no-unused-exports`, the rule that reads the whole repo, from knip's `exports` and `types` — opt in |
23
+
24
+ <!-- /docs-sync:presets -->
24
25
 
25
26
  Rules that typescript-eslint's `eslint-recommended` switches off for TypeScript
26
27
  (`no-undef`, `no-redeclare`, `no-dupe-class-members` and the rest, which the
27
- compiler checks) declare only `javascript` and `jsx` here. The four core rules
28
- `ts/recommended` adds declare all four languages, so they also run on
29
- JavaScript files when that preset is on.
28
+ compiler checks) declare only `javascript` and `jsx` here. The four rules in
29
+ `js/typescript` declare all four languages, so they also run on JavaScript
30
+ files when that preset is on.
30
31
 
31
32
  Every rule is **reimplemented**, not vendored: the matchers, messages and docs
32
33
  are written fresh, and each rule's `ported_from:` names the source rule.
@@ -46,46 +47,12 @@ section says so. The larger ones:
46
47
  | `js/no-useless-assignment` | dead stores a straight-line reading proves; ESLint follows every code path |
47
48
  | `js/no-useless-escape` | strings and templates; escapes inside regular expressions are not checked yet |
48
49
  | `js/no-undef` | environments come from the `env` option (`shared-node-browser` by default), using the `globals` data tables |
49
- | `ts/no-unused-expressions` | `x satisfies T;` is a compile-time type test and is allowed |
50
50
  | `js/prefer-spread` | only `f.apply(null, args)` on a plain function name |
51
51
  | `js/no-var` | `suggest`, not `auto`: `let` is block-scoped, so the swap can change meaning |
52
- | `react/jsx-key` | elements returned from a `.map()` callback's block body are not checked yet |
53
- | `react/no-unknown-property` | renames HTML spellings (`class`, `onclick`, `tabindex`); in `.js`/`.jsx` the JavaScript grammar can't parse `class=` and `for=` |
54
- | `react/exhaustive-deps` | dependencies compared by root name; setters, dispatchers and refs are stable |
55
- | `react/rules-of-hooks` | an early `return` anywhere before a hook counts as making it conditional |
56
- | `node/no-deprecated-api` | the APIs come from the pack's `node/deprecated-api` table; the supported Node.js version is not read |
57
- | `node/no-missing-import`, `node/no-missing-require` | `scope: project` rules on the project graph, which never reads `node_modules`: only the project's own paths are judged (relative, absolute, tsconfig `paths`), and only extensionless or JavaScript/TypeScript ones; a package name is not looked up |
58
- | `node/no-extraneous-import`, `node/no-extraneous-require` | the nearest `package.json` only; a type-only import is satisfied by its `@types/` package |
59
- | `node/no-unpublished-import`, `node/no-unpublished-require` | only in a package that is not `private` and lists `files`; `.npmignore` and the `convertPath` option are not read, so source files that build into `files` are not judged |
60
- | `node/hashbang` | JavaScript and JSX only (no `convertPath` for TypeScript sources); `suggest`, since removing a hashbang can stop a script that is run directly |
61
- | `stencil/tag-prefix` | with no `prefix` option set, a tag only needs some prefix |
62
- | `stencil/prop-readonly` | the starter id for upstream `props-must-be-readonly` |
63
-
64
- ## Not ported, and why
65
-
66
- | rule | why |
67
- |---|---|
68
- | `react/prop-types` | needs the component's declared prop types matched to its uses; TypeScript types do this job |
69
- | `react/jsx-uses-vars` | marks JSX names as used for `no-unused-vars`; codelaw's semantic model already counts them |
70
- | `react/react-in-jsx-scope`, `react/jsx-uses-react` | turned off by `jsx-runtime` |
71
- | eslint-plugin-react-hooks' 14 React Compiler rules | need the React Compiler's analysis |
72
- | `node/no-unsupported-features/es-builtins`, `/es-syntax`, `/node-builtins` | need the project's Node.js version from `package.json` and per-version feature tables |
73
- | `node/process-exit-as-throw` | reports nothing; it only changes ESLint's code-path analysis |
74
- | `stencil/async-methods`, `stencil/render-returns-host`, `stencil/single-export`, `stencil/strict-boolean-conditions` | need type information |
75
- | `stencil/element-type` | needs the component's tag mapped to its element type name |
76
- | `stencil/decorators-style` | layout: the formatter owns it |
77
- | `stencil/dependency-suggestions` | advisory, with no fixed check to port |
78
52
 
79
- Nothing from `js.configs.recommended` or typescript-eslint's non-type-checked
80
- `recommended` is left out. Every `*-type-checked` typescript-eslint config is
81
- out of scope: those rules need type information (L3).
53
+ Nothing from `js.configs.recommended` is left out.
82
54
 
83
55
  ## Data
84
56
 
85
- `data/node/deprecated-api.json` — Node.js APIs the Node.js documentation deprecates, with their replacements, written for this pack.
86
-
87
- `data/react/dom-property-aliases.json` — HTML attribute names and the React prop names that replace them, written for this pack.
88
-
89
-
90
57
  `data/globals/*.json` — the globals of each environment `js/no-undef`'s `env`
91
58
  option names, from the `globals` package 17.13.0 (MIT). See `NOTICE`.
package/codelaw-pack.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  name = "@codelaw/rules-js"
2
- version = "0.1.0"
2
+ version = "0.2.0"
3
3
  min_codelaw = "0.1.0"
4
4
  languages = ["javascript", "jsx", "typescript", "tsx"]
5
- presets = ["js/recommended", "ts/recommended", "react/recommended", "node/recommended", "stencil/recommended", "js/conventions"]
6
- description = "codelaw's rules for JavaScript, TypeScript, JSX and TSX (SR-RULE-PACKS)"
5
+ presets = ["js/recommended", "js/typescript", "js/conventions", "js/project"]
6
+ description = "codelaw's rules for JavaScript, and the core JavaScript rules on TypeScript, JSX and TSX (SR-RULE-PACKS)"
package/corpus.toml ADDED
@@ -0,0 +1,76 @@
1
+ # `codelaw test --corpus` finding counts (SR-RULE-AUTHORING decision 4).
2
+ # Rewrite with --update-snapshot, and review the change.
3
+
4
+ [findings]
5
+ "graph/no-unused-exports" = 118
6
+ "js/constructor-super" = 0
7
+ "js/exports-at-end" = 436
8
+ "js/for-direction" = 0
9
+ "js/getter-return" = 0
10
+ "js/import-groups" = 76
11
+ "js/no-async-promise-executor" = 0
12
+ "js/no-case-declarations" = 0
13
+ "js/no-class-assign" = 0
14
+ "js/no-compare-neg-zero" = 0
15
+ "js/no-cond-assign" = 0
16
+ "js/no-const-assign" = 0
17
+ "js/no-constant-binary-expression" = 0
18
+ "js/no-constant-condition" = 0
19
+ "js/no-control-regex" = 0
20
+ "js/no-debugger" = 0
21
+ "js/no-default-export" = 61
22
+ "js/no-delete-var" = 0
23
+ "js/no-dupe-args" = 0
24
+ "js/no-dupe-class-members" = 0
25
+ "js/no-dupe-else-if" = 0
26
+ "js/no-dupe-keys" = 0
27
+ "js/no-duplicate-case" = 0
28
+ "js/no-empty" = 0
29
+ "js/no-empty-character-class" = 0
30
+ "js/no-empty-pattern" = 0
31
+ "js/no-empty-static-block" = 0
32
+ "js/no-ex-assign" = 0
33
+ "js/no-extra-boolean-cast" = 0
34
+ "js/no-fallthrough" = 0
35
+ "js/no-func-assign" = 0
36
+ "js/no-global-assign" = 0
37
+ "js/no-import-assign" = 0
38
+ "js/no-invalid-regexp" = 0
39
+ "js/no-irregular-whitespace" = 0
40
+ "js/no-loss-of-precision" = 0
41
+ "js/no-misleading-character-class" = 0
42
+ "js/no-new-native-nonconstructor" = 0
43
+ "js/no-nonoctal-decimal-escape" = 0
44
+ "js/no-obj-calls" = 0
45
+ "js/no-octal" = 0
46
+ "js/no-prototype-builtins" = 0
47
+ "js/no-redeclare" = 0
48
+ "js/no-regex-spaces" = 0
49
+ "js/no-self-assign" = 0
50
+ "js/no-setter-return" = 0
51
+ "js/no-shadow-restricted-names" = 0
52
+ "js/no-sparse-arrays" = 0
53
+ "js/no-this-before-super" = 0
54
+ "js/no-unassigned-vars" = 0
55
+ "js/no-undef" = 61
56
+ "js/no-unexpected-multiline" = 0
57
+ "js/no-unreachable" = 0
58
+ "js/no-unsafe-finally" = 0
59
+ "js/no-unsafe-negation" = 0
60
+ "js/no-unsafe-optional-chaining" = 0
61
+ "js/no-unused-labels" = 0
62
+ "js/no-unused-private-class-members" = 0
63
+ "js/no-unused-vars" = 2
64
+ "js/no-useless-assignment" = 14
65
+ "js/no-useless-backreference" = 0
66
+ "js/no-useless-catch" = 0
67
+ "js/no-useless-escape" = 0
68
+ "js/no-var" = 0
69
+ "js/no-with" = 0
70
+ "js/prefer-const" = 0
71
+ "js/prefer-rest-params" = 0
72
+ "js/prefer-spread" = 0
73
+ "js/preserve-caught-error" = 0
74
+ "js/require-yield" = 0
75
+ "js/use-isnan" = 0
76
+ "js/valid-typeof" = 0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codelaw/rules-js",
3
- "version": "0.1.0",
4
- "description": "codelaw's rules for JavaScript, TypeScript, JSX and TSX (SR-RULE-PACKS)",
3
+ "version": "0.2.0",
4
+ "description": "codelaw's rules for JavaScript, and the core JavaScript rules on TypeScript, JSX and TSX (SR-RULE-PACKS)",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -4,7 +4,3 @@ description = "House conventions from codelaw's starter catalogue; opt in"
4
4
  "js/exports-at-end" = "error"
5
5
  "js/import-groups" = "error"
6
6
  "js/no-default-export" = "error"
7
- "ts/type-only-imports" = "error"
8
- "react/hook-prefix" = "error"
9
- "react/props-type-name" = "error"
10
- "stencil/tag-prefix" = "error"
@@ -0,0 +1,4 @@
1
+ description = "The rule that reads the whole repo: exports nothing imports (knip's exports and types); opt in"
2
+
3
+ [rules]
4
+ "graph/no-unused-exports" = "error"
@@ -0,0 +1,7 @@
1
+ description = "The four core rules typescript-eslint's eslint-recommended switches on for TypeScript (8.71.2); use with codelaw:ts/recommended"
2
+
3
+ [rules]
4
+ "js/no-var" = "error"
5
+ "js/prefer-const" = "error"
6
+ "js/prefer-rest-params" = "error"
7
+ "js/prefer-spread" = "error"
@@ -1,83 +0,0 @@
1
- {
2
- "buffer": {
3
- "Buffer": "the global `Buffer` with `Buffer.from()` or `Buffer.alloc()`",
4
- "SlowBuffer": "`Buffer.allocUnsafeSlow()`"
5
- },
6
- "constants": {
7
- "*": "`fs.constants` or `os.constants`"
8
- },
9
- "crypto": {
10
- "Credentials": "`tls.SecureContext`",
11
- "DEFAULT_ENCODING": "an explicit encoding argument",
12
- "createCipher": "`crypto.createCipheriv()`",
13
- "createDecipher": "`crypto.createDecipheriv()`",
14
- "fips": "`crypto.getFips()` / `crypto.setFips()`",
15
- "prng": "`crypto.randomBytes()`",
16
- "pseudoRandomBytes": "`crypto.randomBytes()`",
17
- "rng": "`crypto.randomBytes()`"
18
- },
19
- "domain": {
20
- "*": "`async_hooks` (`AsyncLocalStorage`) or explicit error handling"
21
- },
22
- "events": {
23
- "listenerCount": "`emitter.listenerCount()`"
24
- },
25
- "fs": {
26
- "SyncWriteStream": "a `fs.WriteStream`",
27
- "exists": "`fs.stat()` or `fs.access()`",
28
- "lchmod": "`fs.chmod()`",
29
- "lchmodSync": "`fs.chmodSync()`"
30
- },
31
- "globals": {
32
- "Buffer": "`Buffer.from()`, `Buffer.alloc()` or `Buffer.allocUnsafe()`"
33
- },
34
- "module": {
35
- "_debug": "`util.debuglog()`",
36
- "createRequireFromPath": "`module.createRequire()`"
37
- },
38
- "os": {
39
- "getNetworkInterfaces": "`os.networkInterfaces()`",
40
- "tmpDir": "`os.tmpdir()`"
41
- },
42
- "path": {
43
- "_makeLong": "`path.toNamespacedPath()`"
44
- },
45
- "punycode": {
46
- "*": "the `punycode` package from npm, or `url.domainToASCII()`"
47
- },
48
- "sys": {
49
- "*": "`util`"
50
- },
51
- "tls": {
52
- "SecurePair": "`tls.TLSSocket`",
53
- "createSecurePair": "`tls.TLSSocket`"
54
- },
55
- "url": {
56
- "parse": "the WHATWG `new URL()`",
57
- "resolve": "`new URL(input, base)`"
58
- },
59
- "util": {
60
- "_extend": "`Object.assign()`",
61
- "debug": "`util.debuglog()`",
62
- "error": "`console.error()`",
63
- "isArray": "`Array.isArray()`",
64
- "isBoolean": "`typeof value === \"boolean\"`",
65
- "isBuffer": "`Buffer.isBuffer()`",
66
- "isDate": "`value instanceof Date`",
67
- "isError": "`value instanceof Error`",
68
- "isFunction": "`typeof value === \"function\"`",
69
- "isNull": "`value === null`",
70
- "isNullOrUndefined": "`value == null`",
71
- "isNumber": "`typeof value === \"number\"`",
72
- "isObject": "`value !== null && typeof value === \"object\"`",
73
- "isPrimitive": "a `typeof` check",
74
- "isRegExp": "`value instanceof RegExp`",
75
- "isString": "`typeof value === \"string\"`",
76
- "isSymbol": "`typeof value === \"symbol\"`",
77
- "isUndefined": "`value === undefined`",
78
- "log": "`console.log()`",
79
- "print": "`console.log()`",
80
- "pump": "`stream.pipeline()`",
81
- "puts": "`console.log()`"
82
- }
83
- }
@@ -1,131 +0,0 @@
1
- {
2
- "accept-charset": "acceptCharset",
3
- "accesskey": "accessKey",
4
- "autocapitalize": "autoCapitalize",
5
- "autocomplete": "autoComplete",
6
- "autofocus": "autoFocus",
7
- "autoplay": "autoPlay",
8
- "cellpadding": "cellPadding",
9
- "cellspacing": "cellSpacing",
10
- "charset": "charSet",
11
- "class": "className",
12
- "colspan": "colSpan",
13
- "contenteditable": "contentEditable",
14
- "crossorigin": "crossOrigin",
15
- "datetime": "dateTime",
16
- "enctype": "encType",
17
- "enterkeyhint": "enterKeyHint",
18
- "fetchpriority": "fetchPriority",
19
- "for": "htmlFor",
20
- "formaction": "formAction",
21
- "formenctype": "formEncType",
22
- "formmethod": "formMethod",
23
- "formnovalidate": "formNoValidate",
24
- "formtarget": "formTarget",
25
- "frameborder": "frameBorder",
26
- "hreflang": "hrefLang",
27
- "http-equiv": "httpEquiv",
28
- "inputmode": "inputMode",
29
- "itemprop": "itemProp",
30
- "itemscope": "itemScope",
31
- "itemtype": "itemType",
32
- "marginheight": "marginHeight",
33
- "marginwidth": "marginWidth",
34
- "maxlength": "maxLength",
35
- "minlength": "minLength",
36
- "nomodule": "noModule",
37
- "novalidate": "noValidate",
38
- "onabort": "onAbort",
39
- "onanimationend": "onAnimationEnd",
40
- "onanimationiteration": "onAnimationIteration",
41
- "onanimationstart": "onAnimationStart",
42
- "onauxclick": "onAuxClick",
43
- "onbeforeinput": "onBeforeInput",
44
- "onblur": "onBlur",
45
- "oncancel": "onCancel",
46
- "oncanplay": "onCanPlay",
47
- "oncanplaythrough": "onCanPlayThrough",
48
- "onchange": "onChange",
49
- "onclick": "onClick",
50
- "onclose": "onClose",
51
- "oncompositionend": "onCompositionEnd",
52
- "oncompositionstart": "onCompositionStart",
53
- "oncompositionupdate": "onCompositionUpdate",
54
- "oncontextmenu": "onContextMenu",
55
- "oncopy": "onCopy",
56
- "oncut": "onCut",
57
- "ondblclick": "onDoubleClick",
58
- "ondrag": "onDrag",
59
- "ondragend": "onDragEnd",
60
- "ondragenter": "onDragEnter",
61
- "ondragleave": "onDragLeave",
62
- "ondragover": "onDragOver",
63
- "ondragstart": "onDragStart",
64
- "ondrop": "onDrop",
65
- "ondurationchange": "onDurationChange",
66
- "onemptied": "onEmptied",
67
- "onended": "onEnded",
68
- "onerror": "onError",
69
- "onfocus": "onFocus",
70
- "ongotpointercapture": "onGotPointerCapture",
71
- "oninput": "onInput",
72
- "oninvalid": "onInvalid",
73
- "onkeydown": "onKeyDown",
74
- "onkeypress": "onKeyPress",
75
- "onkeyup": "onKeyUp",
76
- "onload": "onLoad",
77
- "onloadeddata": "onLoadedData",
78
- "onloadedmetadata": "onLoadedMetadata",
79
- "onloadstart": "onLoadStart",
80
- "onlostpointercapture": "onLostPointerCapture",
81
- "onmousedown": "onMouseDown",
82
- "onmouseenter": "onMouseEnter",
83
- "onmouseleave": "onMouseLeave",
84
- "onmousemove": "onMouseMove",
85
- "onmouseout": "onMouseOut",
86
- "onmouseover": "onMouseOver",
87
- "onmouseup": "onMouseUp",
88
- "onpaste": "onPaste",
89
- "onpause": "onPause",
90
- "onplay": "onPlay",
91
- "onplaying": "onPlaying",
92
- "onpointercancel": "onPointerCancel",
93
- "onpointerdown": "onPointerDown",
94
- "onpointerenter": "onPointerEnter",
95
- "onpointerleave": "onPointerLeave",
96
- "onpointermove": "onPointerMove",
97
- "onpointerout": "onPointerOut",
98
- "onpointerover": "onPointerOver",
99
- "onpointerup": "onPointerUp",
100
- "onprogress": "onProgress",
101
- "onratechange": "onRateChange",
102
- "onreset": "onReset",
103
- "onresize": "onResize",
104
- "onscroll": "onScroll",
105
- "onseeked": "onSeeked",
106
- "onseeking": "onSeeking",
107
- "onselect": "onSelect",
108
- "onstalled": "onStalled",
109
- "onsubmit": "onSubmit",
110
- "onsuspend": "onSuspend",
111
- "ontimeupdate": "onTimeUpdate",
112
- "ontoggle": "onToggle",
113
- "ontouchcancel": "onTouchCancel",
114
- "ontouchend": "onTouchEnd",
115
- "ontouchmove": "onTouchMove",
116
- "ontouchstart": "onTouchStart",
117
- "ontransitionend": "onTransitionEnd",
118
- "onvolumechange": "onVolumeChange",
119
- "onwaiting": "onWaiting",
120
- "onwheel": "onWheel",
121
- "playsinline": "playsInline",
122
- "readonly": "readOnly",
123
- "referrerpolicy": "referrerPolicy",
124
- "rowspan": "rowSpan",
125
- "spellcheck": "spellCheck",
126
- "srcdoc": "srcDoc",
127
- "srclang": "srcLang",
128
- "srcset": "srcSet",
129
- "tabindex": "tabIndex",
130
- "usemap": "useMap"
131
- }
@@ -1,13 +0,0 @@
1
- description = "eslint-plugin-n 18.5.0 recommended-module: the rules that need no package.json, hashbang on package.json's bin, and the import rules on the project graph, reimplemented"
2
-
3
- [rules]
4
- "node/hashbang" = "error"
5
- "node/no-deprecated-api" = "error"
6
- "node/no-exports-assign" = "error"
7
- "node/no-process-exit" = "error"
8
- "node/no-missing-import" = "error"
9
- "node/no-missing-require" = "error"
10
- "node/no-extraneous-import" = "error"
11
- "node/no-extraneous-require" = "error"
12
- "node/no-unpublished-import" = "error"
13
- "node/no-unpublished-require" = "error"
@@ -1,22 +0,0 @@
1
- description = "eslint-plugin-react 7.37.5 recommended with jsx-runtime, and eslint-plugin-react-hooks 7.1.1 rules-of-hooks and exhaustive-deps, reimplemented"
2
-
3
- [rules]
4
- "react/display-name" = "error"
5
- "react/exhaustive-deps" = "error"
6
- "react/jsx-key" = "error"
7
- "react/jsx-no-comment-textnodes" = "error"
8
- "react/jsx-no-duplicate-props" = "error"
9
- "react/jsx-no-target-blank" = "error"
10
- "react/jsx-no-undef" = "error"
11
- "react/no-children-prop" = "error"
12
- "react/no-danger-with-children" = "error"
13
- "react/no-deprecated" = "error"
14
- "react/no-direct-mutation-state" = "error"
15
- "react/no-find-dom-node" = "error"
16
- "react/no-is-mounted" = "error"
17
- "react/no-render-return-value" = "error"
18
- "react/no-string-refs" = "error"
19
- "react/no-unescaped-entities" = "error"
20
- "react/no-unknown-property" = "error"
21
- "react/require-render-return" = "error"
22
- "react/rules-of-hooks" = "error"
@@ -1,18 +0,0 @@
1
- description = "@stencil/eslint-plugin 1.4.0 recommended without its type-checked rules, reimplemented"
2
-
3
- [rules]
4
- "stencil/ban-default-true" = "error"
5
- "stencil/ban-exported-const-enums" = "error"
6
- "stencil/ban-prefix" = "error"
7
- "stencil/decorators-context" = "error"
8
- "stencil/host-data-deprecated" = "error"
9
- "stencil/methods-must-be-public" = "error"
10
- "stencil/no-unused-watch" = "error"
11
- "stencil/own-methods-must-be-private" = "error"
12
- "stencil/own-props-must-be-private" = "error"
13
- "stencil/prefer-vdom-listener" = "error"
14
- "stencil/prop-readonly" = "error"
15
- "stencil/props-must-be-public" = "error"
16
- "stencil/required-jsdoc" = "error"
17
- "stencil/reserved-member-names" = "error"
18
- "stencil/strict-mutable" = "error"
@@ -1,27 +0,0 @@
1
- description = "typescript-eslint's recommended preset (8.71.2, not type-checked), reimplemented, with the core rules it switches on for TypeScript"
2
-
3
- [rules]
4
- "ts/ban-ts-comment" = "error"
5
- "ts/no-array-constructor" = "error"
6
- "ts/no-duplicate-enum-values" = "error"
7
- "ts/no-empty-object-type" = "error"
8
- "ts/no-explicit-any" = "error"
9
- "ts/no-extra-non-null-assertion" = "error"
10
- "ts/no-misused-new" = "error"
11
- "ts/no-namespace" = "error"
12
- "ts/no-non-null-asserted-optional-chain" = "error"
13
- "ts/no-require-imports" = "error"
14
- "ts/no-this-alias" = "error"
15
- "ts/no-unnecessary-type-constraint" = "error"
16
- "ts/no-unsafe-declaration-merging" = "error"
17
- "ts/no-unsafe-function-type" = "error"
18
- "ts/no-unused-expressions" = "error"
19
- "ts/no-unused-vars" = "error"
20
- "ts/no-wrapper-object-types" = "error"
21
- "ts/prefer-as-const" = "error"
22
- "ts/prefer-namespace-keyword" = "error"
23
- "ts/triple-slash-reference" = "error"
24
- "js/no-var" = "error"
25
- "js/prefer-const" = "error"
26
- "js/prefer-rest-params" = "error"
27
- "js/prefer-spread" = "error"
@@ -1,71 +0,0 @@
1
- ---
2
- id: node/hashbang
3
- title: "Commands start with a Node.js hashbang, and nothing else has one"
4
- languages: [javascript, jsx]
5
- fix: suggest
6
- fix_reason: "removing the hashbang of a script someone runs directly (`./tool.js`) stops it running"
7
- stability: preview
8
- ported_from: [eslint-plugin-n/hashbang]
9
- since: 0.1.0
10
- ---
11
-
12
- A file the nearest `package.json` names in `bin` starts with `#!/usr/bin/env node`; a file it doesn't name has no hashbang. Without a `package.json` above the file, nothing is checked.
13
-
14
- **Why:** npm links a `bin` entry as an executable, which the shell runs through its hashbang: without one the command fails, or runs under the wrong interpreter. A hashbang on a library file is noise that suggests it is a command.
15
-
16
- ```codelaw
17
- native: node/hashbang
18
- ```
19
-
20
- ## How to fix
21
-
22
- 1. On a command `bin` names, make the first line `#!/usr/bin/env node`.
23
- 2. On any other file, remove the hashbang, or add the file to `bin` if it is a command.
24
-
25
- ## Examples
26
-
27
- ### JavaScript
28
-
29
- #### Don't
30
-
31
- ```js
32
- // package.json
33
- { "name": "tool", "bin": { "tool": "./bin/tool.js" } }
34
- // bin/tool.js
35
- console.log("hello");
36
- ```
37
-
38
- #### Do
39
-
40
- ```js
41
- // package.json
42
- { "name": "tool", "bin": { "tool": "./bin/tool.js" } }
43
- // bin/tool.js
44
- #!/usr/bin/env node
45
- console.log("hello");
46
- ```
47
-
48
- ### JSX
49
-
50
- #### Don't
51
-
52
- ```jsx
53
- // package.json
54
- { "name": "tool", "bin": "./cli.jsx" }
55
- // lib/view.jsx
56
- #!/usr/bin/env node
57
- export const View = () => <p>hello</p>;
58
- ```
59
-
60
- #### Do
61
-
62
- ```jsx
63
- // package.json
64
- { "name": "tool", "bin": "./cli.jsx" }
65
- // lib/view.jsx
66
- export const View = () => <p>hello</p>;
67
- ```
68
-
69
- ## Differences from the source
70
-
71
- TypeScript sources are not checked: eslint-plugin-n maps them to their built JavaScript through `convertPath`, which this rule has no option for yet. The source's checks for a byte-order mark and CRLF line endings in a command are not ported, and there is no `additionalExecutables` or `executableMap` option.