@sarj/eslint-plugin 9.6.0 → 9.7.1
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 +9 -12
- package/dist/index.cjs +927 -681
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -14
- package/dist/index.d.ts +27 -14
- package/dist/index.js +916 -670
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -12,14 +12,11 @@ import sarj from "@sarj/eslint-plugin";
|
|
|
12
12
|
export default [...sarj.configs.recommended];
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
alternatives that were rejected. `meta.docs.url` points at the same document, so
|
|
19
|
-
`--format=stylish` prints it. Both links are derived from the rule's name, so a
|
|
20
|
-
rename moves them.
|
|
15
|
+
55 rules. Each source under `src/rules/` states one concise claim and links to
|
|
16
|
+
its paired tests. The definition and named test cases are the complete rule
|
|
17
|
+
specification, and `meta.docs.url` points directly to those executable examples.
|
|
21
18
|
|
|
22
|
-
Presets: `recommended` (warn-first), `strict` (every rule at
|
|
19
|
+
Presets: `recommended` (warn-first), `strict` (every shipped rule at its declared strict severity), `style-guide` (formatting/naming subset). The two-sentence comment rule warns; its three-sentence companion errors.
|
|
23
20
|
|
|
24
21
|
## Renamed in 7.0.0, aliases deleted in 9.0.0 (breaking)
|
|
25
22
|
|
|
@@ -43,8 +40,8 @@ exported for codemods:
|
|
|
43
40
|
import { renamedRules } from "@sarj/eslint-plugin";
|
|
44
41
|
```
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
[`
|
|
43
|
+
The rename map and migration behavior live in
|
|
44
|
+
[`src/rules/_renames.ts`](src/rules/_renames.ts) and its tests.
|
|
48
45
|
|
|
49
46
|
## New in 4.1.0 — `no-hand-rolled-sleep`
|
|
50
47
|
|
|
@@ -118,8 +115,8 @@ an abandoned placeholder.
|
|
|
118
115
|
|
|
119
116
|
From a 37,918-comment, nine-repo measurement study. All three are
|
|
120
117
|
deletion-class, so each was validated against zod / swr / zustand / TanStack
|
|
121
|
-
Query as well as the maintained repos.
|
|
122
|
-
|
|
118
|
+
Query as well as the maintained repos. Each paired test suite records the
|
|
119
|
+
false-positive shapes guarded by the implementation.
|
|
123
120
|
|
|
124
121
|
| Rule | What it catches | Preset |
|
|
125
122
|
|---|---|---|
|
|
@@ -141,7 +138,7 @@ Both distilled from two years of PR-review comments across ~1,065 PRs.
|
|
|
141
138
|
| `prefer-zod-infer` | An `interface`/`type` that restates a Zod schema declared in the same module instead of deriving it with `z.infer`. Options: `ignoreTypeNames`, `requireIdenticalShape` (default `true`). | warn / error |
|
|
142
139
|
| `prefer-module-level-constant` | A literal-only `const` collection (array, object, `Set`, `Map`, `Object.freeze`) or non-global regex declared inside a function body, never mutated and never escaping — hoist it to module scope. Options: `minElements` (default 3), `checkRegex`, `ignoreTestFiles`. | warn / error |
|
|
143
140
|
| `prefer-module-level-schema` | A Zod schema built inside a function body that closes over nothing the function owns — hoist it to module scope instead of rebuilding it per call, per request, per render. Silent when it references a parameter, local, type parameter, local type, or `this` (that is a schema FACTORY), when it is already memoized, and inside `z.lazy`. Options: `factories` (default: the object-like composites), `minProperties` (default 1), `ignoreTestFiles`. | warn / error |
|
|
144
|
-
| `prefer-non-nullable-collection` |
|
|
141
|
+
| `prefer-non-nullable-collection` | A required array property or direct alias explicitly combined with `null`/`undefined`, creating two equivalent empty states. Optional API fields are excluded because omission can be meaningful. | warn / error |
|
|
145
142
|
|
|
146
143
|
## Options
|
|
147
144
|
|