@sarj/eslint-plugin 9.7.1 → 9.9.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.
package/README.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @sarj/eslint-plugin
2
2
 
3
+ ## New in 9.9.0 — static Next.js matchers
4
+
5
+ `require-static-next-matcher` rejects runtime expressions in exported
6
+ `middleware.ts` and `proxy.ts` matcher configuration. Next.js reads these values
7
+ during static analysis, so identifiers, calls, concatenation, interpolated
8
+ templates, and spreads can pass type checking but fail the production build.
9
+
3
10
  Custom ESLint rules for hypermodern TypeScript / React / Next.js projects.
4
11
 
5
12
  ```bash
@@ -12,11 +19,47 @@ import sarj from "@sarj/eslint-plugin";
12
19
  export default [...sarj.configs.recommended];
13
20
  ```
14
21
 
15
- 55 rules. Each source under `src/rules/` states one concise claim and links to
22
+ 57 rules. Each source under `src/rules/` states one concise claim and links to
16
23
  its paired tests. The definition and named test cases are the complete rule
17
24
  specification, and `meta.docs.url` points directly to those executable examples.
18
25
 
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.
26
+ Presets: `recommended` (warn-first), `strict` (every general-profile rule at its declared strict severity), `style-guide` (formatting/naming subset). Application-only rules are exported through `applicationOnlyRules` and configured by the application profile. The two-sentence comment rule warns; its three-sentence companion errors.
27
+
28
+ ## New in 9.8.0 — application library policy adapters
29
+
30
+ `no-restricted-library-load` extends a configured dependency policy to runtime
31
+ loading forms that ESLint's `no-restricted-imports` does not cover: literal
32
+ `import()`, unshadowed `require()` / `require.resolve()`, and TypeScript
33
+ `import x = require(...)`. It matches a package and all of its subpaths, but
34
+ deliberately ignores computed names and shadowed local `require` functions.
35
+
36
+ `prefer-native-random-uuid` reports resolved, zero-argument UUID v4 calls from
37
+ the `uuid` package and suggests `globalThis.crypto.randomUUID()`. The suggestion
38
+ changes only the call; import cleanup remains explicit. Other UUID versions,
39
+ custom-randomness arguments, re-exports, and function references are untouched.
40
+
41
+ Neither rule is in the general presets. The application profile configures them
42
+ for its Node 22+ runtime contract and supplies catalog entries to the loader
43
+ rule:
44
+
45
+ ```js
46
+ rules: {
47
+ "@sarj/no-restricted-library-load": [
48
+ "error",
49
+ {
50
+ libraries: [
51
+ {
52
+ id: "LIB101",
53
+ module: "axios",
54
+ replacement: "Ky",
55
+ note: "The APIs are not drop-in equivalents.",
56
+ },
57
+ ],
58
+ },
59
+ ],
60
+ "@sarj/prefer-native-random-uuid": "error",
61
+ }
62
+ ```
20
63
 
21
64
  ## Renamed in 7.0.0, aliases deleted in 9.0.0 (breaking)
22
65
 
@@ -78,6 +121,8 @@ platform too.
78
121
 
79
122
  | Rule | What it catches | Preset |
80
123
  |---|---|---|
124
+ | `no-hand-rolled-spinner` | Intrinsic elements styled as Tailwind border-ring loading spinners outside the design system. | error / error |
125
+ | `require-static-next-matcher` | Dynamic values in exported Next.js middleware and proxy matcher configuration. | error / error |
81
126
  | `no-hand-rolled-sleep` | `new Promise((r) => setTimeout(r, ms))` in any spelling, and an uncleared `Promise.race`/`Promise.any` timeout arm. Options: `checkClientModules` (default `false`), `allowIn`. | warn / error |
82
127
 
83
128
  ## New in 2.14.0 — `no-tautological-expect`