oxlint-config-awesomeness 3.4.0 → 3.4.2

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 (3) hide show
  1. package/README.md +10 -10
  2. package/index.js +42 -14
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -124,15 +124,15 @@ Plus JS plugins: **perfectionist** (sorting), **react-hooks** + **React Compiler
124
124
 
125
125
  The config includes smart overrides so strict rules don't create noise in files that need flexibility:
126
126
 
127
- | Files | Relaxed Rules |
128
- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
129
- | `*.test.*`, `*.spec.*`, `__tests__/**` | `no-explicit-any`, `no-non-null-assertion` (+ asserted-nullish variant), `no-require-imports`, `no-var-requires`, `promise-function-async`, all `no-unsafe-*`, `import/no-cycle`, `max-lines`, `max-lines-per-function`, `max-nested-callbacks`, `max-statements`, `no-empty`, `no-empty-function`, `no-use-before-define`, `react/no-multi-comp` |
130
- | `*.stories.tsx` | `no-console`, `no-multi-comp` |
131
- | `**/seed.ts`, `**/migrate.ts` | `no-console` |
132
- | `**/bin/**`, `scripts/**` | `no-console`, `unicorn/no-process-exit` |
133
- | `*.config.ts`, `next.config.*`, etc. | `max-lines`, `no-anonymous-default-export` |
134
- | `**/e2e/**/fixtures/**` | `rules-of-hooks` |
135
- | `*.ts`, `*.tsx` (all TypeScript) | Rules handled natively by the TS compiler (`no-undef`, `no-redeclare`, etc.) |
127
+ | Files | Relaxed Rules |
128
+ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
129
+ | `*.test.*`, `*.spec.*`, `__tests__/**` | `no-explicit-any`, `no-non-null-assertion` (+ asserted-nullish variant), `no-require-imports`, `no-var-requires`, `promise-function-async`, all `no-unsafe-*`, `import/no-cycle`, `max-lines`, `max-lines-per-function`, `max-nested-callbacks`, `max-statements`, `no-empty`, `no-empty-function`, `no-use-before-define`, the `anti-slop` assertion family (`no-chained-type-assertions`, `no-known-value-widening`, `no-unknown-type-aliases`, `no-unsafe-dictionary-type`, `no-widen-then-assert`) |
130
+ | `*.stories.tsx` | `no-console` |
131
+ | `**/seed.ts`, `**/migrate.ts` | `no-console` |
132
+ | `**/bin/**`, `scripts/**` | `no-console`, `unicorn/no-process-exit` |
133
+ | `*.config.ts`, `next.config.*`, etc. | `max-lines`, `no-anonymous-default-export` |
134
+ | `**/e2e/**` | `rules-of-hooks`, all `no-unsafe-*`, the `anti-slop` assertion family, `strict-boolean-expressions` |
135
+ | `*.ts`, `*.tsx` (all TypeScript) | Rules handled natively by the TS compiler (`no-undef`, `no-redeclare`, etc.) |
136
136
 
137
137
  ## Cherry-Picked Restriction Rules
138
138
 
@@ -145,7 +145,7 @@ Instead of enabling the entire `restriction` category (which includes rules like
145
145
  `@typescript-eslint/no-dynamic-delete`, `no-empty-object-type`, `no-explicit-any`, `no-import-type-side-effects`, `no-invalid-void-type`, `no-non-null-asserted-nullish-coalescing`, `no-non-null-assertion`, `no-require-imports`, `no-var-requires`, `promise-function-async`, `use-unknown-in-catch-callback-variable`
146
146
 
147
147
  **React**
148
- `react/button-has-type`, `react/no-danger`, `react/no-multi-comp`, `react/no-unknown-property`
148
+ `react/button-has-type`, `react/no-danger`, `react/no-unknown-property`
149
149
 
150
150
  **Import graph**
151
151
  `import/no-cycle`
package/index.js CHANGED
@@ -111,6 +111,16 @@ export default defineConfig({
111
111
  "@typescript-eslint/no-unsafe-return": "off",
112
112
  // Same rationale: casting mock/fixture data is routine in tests.
113
113
  "@typescript-eslint/no-unsafe-type-assertion": "off",
114
+ // anti-slop's premise is "parse external data once at its boundary and
115
+ // carry the domain type from there." A test is the other side of that
116
+ // boundary: it asserts on whatever the system under test emitted, often
117
+ // an untyped document (an OpenAPI blob, a webhook body), and reaching
118
+ // into it with a cast or an index signature is the assertion, not slop.
119
+ "anti-slop/no-chained-type-assertions": "off",
120
+ "anti-slop/no-known-value-widening": "off",
121
+ "anti-slop/no-unknown-type-aliases": "off",
122
+ "anti-slop/no-unsafe-dictionary-type": "off",
123
+ "anti-slop/no-widen-then-assert": "off",
114
124
  // Legacy `var x = require(...)` still appears in older test setups.
115
125
  "@typescript-eslint/no-var-requires": "off",
116
126
  // Mock implementations may return bare promises without `async`.
@@ -128,8 +138,6 @@ export default defineConfig({
128
138
  "no-empty-function": "off",
129
139
  // Test helpers are often defined after the `describe` that uses them.
130
140
  "no-use-before-define": "off",
131
- // Inline wrapper/mock components (providers, stubs) are test idiom.
132
- "react/no-multi-comp": "off",
133
141
  },
134
142
  },
135
143
  // Storybook stories — component documentation has its own idioms.
@@ -138,8 +146,6 @@ export default defineConfig({
138
146
  rules: {
139
147
  // `console.log` is a valid teaching tool in stories.
140
148
  "no-console": "off",
141
- // Stories legitimately export multiple component variants.
142
- "react/no-multi-comp": "off",
143
149
  },
144
150
  },
145
151
  // Seed and migration scripts — one-shot CLI tools with log output.
@@ -197,6 +203,13 @@ export default defineConfig({
197
203
  "@typescript-eslint/no-unsafe-member-access": "off",
198
204
  "@typescript-eslint/no-unsafe-return": "off",
199
205
  "@typescript-eslint/no-unsafe-type-assertion": "off",
206
+ // Matching the unit-test override: a harness asserting on what the app
207
+ // emitted sits on the far side of the parse boundary anti-slop guards.
208
+ "anti-slop/no-chained-type-assertions": "off",
209
+ "anti-slop/no-known-value-widening": "off",
210
+ "anti-slop/no-unknown-type-aliases": "off",
211
+ "anti-slop/no-unsafe-dictionary-type": "off",
212
+ "anti-slop/no-widen-then-assert": "off",
200
213
  // Harness code branches on optional env vars (`if (process.env.CI)`).
201
214
  "@typescript-eslint/strict-boolean-expressions": "off",
202
215
  // Playwright fixtures use hook-like names (`test.extend`) that trip the rule.
@@ -356,9 +369,13 @@ export default defineConfig({
356
369
  ],
357
370
  // Raw HTML insertion in JSX is an XSS vector — require a deliberate opt-out.
358
371
  "react/no-danger": "error",
359
- // One component per file, stateless included; keeps files focused and
360
- // imports unambiguous. Stories and test files are relaxed in overrides.
361
- "react/no-multi-comp": "error",
372
+ // Off: the two dominant shapes in these codebases both put several
373
+ // components in one file on purpose. shadcn primitives ship as families
374
+ // (`card.tsx` exports Card, CardHeader, CardTitle, CardContent, ...) and
375
+ // splitting them permanently forks the file from upstream; form shells keep
376
+ // their single-use field components colocated so each form stays readable
377
+ // on its own. Enforcing one-per-file trades both for import ceremony.
378
+ "react/no-multi-comp": "off",
362
379
  // Catches typos like `class=` or `tabindex=` in JSX.
363
380
  "react/no-unknown-property": "error",
364
381
 
@@ -601,10 +618,14 @@ export default defineConfig({
601
618
 
602
619
  // `x as unknown as T` launders any value into any type.
603
620
  "anti-slop/no-chained-type-assertions": "error",
604
- // `...(cond ? {} : obj)` hides field omission; declare the property directly.
605
- "anti-slop/no-conditional-empty-object-spread": "error",
606
- // Annotating a known literal with a broad type discards what TS inferred.
607
- "anti-slop/no-known-value-widening": "error",
621
+ // Warn, not error: `...(cond ? { key } : {})` is how an optional key is
622
+ // omitted in Next config objects and Better Auth options, where the
623
+ // alternative (build the object in separate statements) reads worse.
624
+ "anti-slop/no-conditional-empty-object-spread": "warn",
625
+ // Warn, not error: fires on `const X: Record<Union, string> = {...}` lookup
626
+ // tables and on named-shape return annotations, which are deliberate
627
+ // contracts here rather than laundered types. 76 sites across four repos.
628
+ "anti-slop/no-known-value-widening": "warn",
608
629
  // `object` on inputs accepts nearly everything; name the expected fields.
609
630
  "anti-slop/no-object-parameters": "error",
610
631
  // Flags every `typeof` unary, including the `typeof window` SSR guards the
@@ -620,8 +641,10 @@ export default defineConfig({
620
641
  "anti-slop/no-unknown-parameters": "warn",
621
642
  // `type X = unknown` hides the escape hatch behind a domain-sounding name.
622
643
  "anti-slop/no-unknown-type-aliases": "error",
623
- // Dictionary values typed `unknown`/`any`/`object`/`{}` defeat lookups.
624
- "anti-slop/no-unsafe-dictionary-type": "error",
644
+ // Warn, not error: `Record<string, unknown>` is the correct type at a real
645
+ // boundary (structured log context, a recursive deep-merge input), and the
646
+ // rule cannot tell those from a lazy escape hatch.
647
+ "anti-slop/no-unsafe-dictionary-type": "warn",
625
648
  // Widening a known value and asserting it back is a two-step type lie.
626
649
  "anti-slop/no-widen-then-assert": "error",
627
650
 
@@ -629,7 +652,12 @@ export default defineConfig({
629
652
 
630
653
  // Comments longer than 5 lines narrate instead of inform. Directive
631
654
  // comments (eslint-/oxlint-/@ts-) and license headers are exempt.
632
- "awesomeness/no-novel-comments": "error",
655
+ //
656
+ // Warn, not error: length is a proxy for narration, and after a comment
657
+ // sweep the long survivors are the load-bearing ones (external-system
658
+ // behavior, e2e helper contracts). Blocking a build on prose is the wrong
659
+ // trade; the warning still surfaces every one of them.
660
+ "awesomeness/no-novel-comments": "warn",
633
661
 
634
662
  // React Doctor (react-doctor): original diagnostic rules at upstream severities
635
663
  // (warn = advisory, error = definite bug). Excluded on purpose: the ports of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-config-awesomeness",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
4
4
  "description": "Oxlint config with sensible defaults.",
5
5
  "keywords": [
6
6
  "autofix",