oxlint-config-awesomeness 3.4.2 → 3.5.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 +100 -16
- package/anti-slop/index.js +481 -109
- package/awesomeness/index.js +39 -43
- package/bin/init.js +38 -17
- package/index.d.ts +1 -2
- package/index.js +31 -124
- package/package.json +18 -8
package/README.md
CHANGED
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Opinionated Oxlint config for software houses that want all their apps to feel the same.
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**455 rules** across **16 plugins**. Built for full-stack TypeScript monorepos with React, Next.js, Hono, Prisma, and more.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
npm install -D oxlint-config-awesomeness eslint-plugin-no-only-tests eslint-plugin-perfectionist eslint-plugin-react-hooks eslint-plugin-unused-imports
|
|
10
|
+
npm install -D oxlint-config-awesomeness eslint-plugin-no-only-tests eslint-plugin-perfectionist eslint-plugin-react-hooks eslint-plugin-unused-imports oxlint-plugin-react-doctor
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
> [!NOTE]
|
|
14
|
-
>
|
|
14
|
+
> Oxlint resolves JS plugin specifiers from your project root, not from this
|
|
15
|
+
> package, so the plugins have to be installed alongside it. They are declared as
|
|
16
|
+
> peer dependencies: npm and pnpm install them for you, and Yarn will warn if any
|
|
17
|
+
> are missing.
|
|
15
18
|
|
|
16
19
|
## Usage
|
|
17
20
|
|
|
@@ -124,15 +127,15 @@ Plus JS plugins: **perfectionist** (sorting), **react-hooks** + **React Compiler
|
|
|
124
127
|
|
|
125
128
|
The config includes smart overrides so strict rules don't create noise in files that need flexibility:
|
|
126
129
|
|
|
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.)
|
|
130
|
+
| Files | Relaxed Rules |
|
|
131
|
+
| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
132
|
+
| `*.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`, `require-safety-comment-for-type-assertion`) |
|
|
133
|
+
| `*.stories.tsx` | `no-console` |
|
|
134
|
+
| `**/seed.ts`, `**/migrate.ts` | `no-console` |
|
|
135
|
+
| `**/bin/**`, `scripts/**` | `no-console`, `unicorn/no-process-exit` |
|
|
136
|
+
| `*.config.ts`, `next.config.*`, etc. | `max-lines`, `no-anonymous-default-export` |
|
|
137
|
+
| `**/e2e/**` | `rules-of-hooks`, all `no-unsafe-*`, the `anti-slop` assertion family, `strict-boolean-expressions` |
|
|
138
|
+
| `*.ts`, `*.tsx` (all TypeScript) | Rules handled natively by the TS compiler (`no-undef`, `no-redeclare`, etc.) |
|
|
136
139
|
|
|
137
140
|
## Cherry-Picked Restriction Rules
|
|
138
141
|
|
|
@@ -8054,7 +8057,7 @@ const user = userSchema.parse(JSON.parse(raw));
|
|
|
8054
8057
|
|
|
8055
8058
|
### anti-slop/no-conditional-empty-object-spread
|
|
8056
8059
|
|
|
8057
|
-
Disallow spreading a conditional that falls back to an empty object to omit fields. Severity: `
|
|
8060
|
+
Disallow spreading a conditional that falls back to an empty object to omit fields. Severity: `warn`.
|
|
8058
8061
|
|
|
8059
8062
|
```ts
|
|
8060
8063
|
// bad
|
|
@@ -8066,7 +8069,7 @@ const payload = { id };
|
|
|
8066
8069
|
|
|
8067
8070
|
### anti-slop/no-known-value-widening
|
|
8068
8071
|
|
|
8069
|
-
Disallow annotating a known value with a broad type that discards what TypeScript already inferred. Severity: `
|
|
8072
|
+
Disallow annotating a known value with a broad type that discards what TypeScript already inferred. Severity: `warn`.
|
|
8070
8073
|
|
|
8071
8074
|
```ts
|
|
8072
8075
|
// bad
|
|
@@ -8076,6 +8079,22 @@ const mode: string = "dark";
|
|
|
8076
8079
|
const mode = "dark";
|
|
8077
8080
|
```
|
|
8078
8081
|
|
|
8082
|
+
### anti-slop/no-module-mocking
|
|
8083
|
+
|
|
8084
|
+
Disallow Vitest and Jest module mocks in favor of explicit dependency seams. Severity: `error`.
|
|
8085
|
+
|
|
8086
|
+
Rejected:
|
|
8087
|
+
|
|
8088
|
+
```ts
|
|
8089
|
+
vi.mock("./user-store");
|
|
8090
|
+
```
|
|
8091
|
+
|
|
8092
|
+
Preferred:
|
|
8093
|
+
|
|
8094
|
+
```ts
|
|
8095
|
+
const service = createUserService({ store: fakeUserStore });
|
|
8096
|
+
```
|
|
8097
|
+
|
|
8079
8098
|
### anti-slop/no-object-parameters
|
|
8080
8099
|
|
|
8081
8100
|
Disallow the broad `object` type on function parameters. Severity: `error`.
|
|
@@ -8088,6 +8107,38 @@ const track = (event: object) => send(event);
|
|
|
8088
8107
|
const track = (event: AnalyticsEvent) => send(event);
|
|
8089
8108
|
```
|
|
8090
8109
|
|
|
8110
|
+
### anti-slop/no-reflect-apply
|
|
8111
|
+
|
|
8112
|
+
Disallow `Reflect.apply` in favor of typed function calls. Severity: `error`.
|
|
8113
|
+
|
|
8114
|
+
Rejected:
|
|
8115
|
+
|
|
8116
|
+
```ts
|
|
8117
|
+
const value = Reflect.apply(operation, owner, args);
|
|
8118
|
+
```
|
|
8119
|
+
|
|
8120
|
+
Preferred:
|
|
8121
|
+
|
|
8122
|
+
```ts
|
|
8123
|
+
const value = operation.call(owner, ...args);
|
|
8124
|
+
```
|
|
8125
|
+
|
|
8126
|
+
### anti-slop/no-reflect-get
|
|
8127
|
+
|
|
8128
|
+
Disallow `Reflect.get` in favor of typed property access or boundary parsing. Severity: `error`.
|
|
8129
|
+
|
|
8130
|
+
Rejected:
|
|
8131
|
+
|
|
8132
|
+
```ts
|
|
8133
|
+
const value = Reflect.get(owner, key);
|
|
8134
|
+
```
|
|
8135
|
+
|
|
8136
|
+
Preferred:
|
|
8137
|
+
|
|
8138
|
+
```ts
|
|
8139
|
+
const value = owner[key];
|
|
8140
|
+
```
|
|
8141
|
+
|
|
8091
8142
|
### anti-slop/no-runtime-typeof
|
|
8092
8143
|
|
|
8093
8144
|
Disallow runtime `typeof` checks in favor of parsing at the I/O boundary. Severity: `off` in this config: the rule flags every `typeof`, including the `typeof window` SSR guards other enabled rules steer toward and ordinary `typeof x === "string"` narrowing.
|
|
@@ -8127,6 +8178,22 @@ const handle = (value: unknown) => process(value);
|
|
|
8127
8178
|
const handle = (value: Payload) => process(value);
|
|
8128
8179
|
```
|
|
8129
8180
|
|
|
8181
|
+
### anti-slop/no-unknown-returns
|
|
8182
|
+
|
|
8183
|
+
Disallow functions whose contracts return `unknown` or `Promise<unknown>`. Severity: `error`.
|
|
8184
|
+
|
|
8185
|
+
Rejected:
|
|
8186
|
+
|
|
8187
|
+
```ts
|
|
8188
|
+
const loadUser = (): unknown => input;
|
|
8189
|
+
```
|
|
8190
|
+
|
|
8191
|
+
Preferred:
|
|
8192
|
+
|
|
8193
|
+
```ts
|
|
8194
|
+
const loadUser = (): User => userSchema.parse(input);
|
|
8195
|
+
```
|
|
8196
|
+
|
|
8130
8197
|
### anti-slop/no-unknown-type-aliases
|
|
8131
8198
|
|
|
8132
8199
|
Disallow type aliases that only rename `unknown`. Severity: `error`.
|
|
@@ -8141,7 +8208,7 @@ type Payload = { id: string; body: string };
|
|
|
8141
8208
|
|
|
8142
8209
|
### anti-slop/no-unsafe-dictionary-type
|
|
8143
8210
|
|
|
8144
|
-
Disallow dictionary value types that are `unknown`, `any`, `object`, or `{}`. Severity: `
|
|
8211
|
+
Disallow dictionary value types that are `unknown`, `any`, `object`, or `{}`. Severity: `warn`.
|
|
8145
8212
|
|
|
8146
8213
|
```ts
|
|
8147
8214
|
// bad
|
|
@@ -8165,13 +8232,30 @@ const status = "active";
|
|
|
8165
8232
|
use(status);
|
|
8166
8233
|
```
|
|
8167
8234
|
|
|
8235
|
+
### anti-slop/require-safety-comment-for-type-assertion
|
|
8236
|
+
|
|
8237
|
+
Require every non-const type assertion to document the checked invariant that makes it safe. Severity: `error`.
|
|
8238
|
+
|
|
8239
|
+
Rejected:
|
|
8240
|
+
|
|
8241
|
+
```ts
|
|
8242
|
+
const userId = value as UserId;
|
|
8243
|
+
```
|
|
8244
|
+
|
|
8245
|
+
Preferred:
|
|
8246
|
+
|
|
8247
|
+
```ts
|
|
8248
|
+
// SAFETY: parseUserId validated the identifier before branding it.
|
|
8249
|
+
const userId = value as UserId;
|
|
8250
|
+
```
|
|
8251
|
+
|
|
8168
8252
|
## Awesomeness Rules
|
|
8169
8253
|
|
|
8170
8254
|
First-party rules that ship with this config.
|
|
8171
8255
|
|
|
8172
8256
|
### awesomeness/no-novel-comments
|
|
8173
8257
|
|
|
8174
|
-
Disallow block comments or contiguous runs of line comments longer than 5 lines. Directive comments (`eslint-`, `oxlint-`, `@ts-`, and similar) and license headers are exempt. Severity: `
|
|
8258
|
+
Disallow block comments or contiguous runs of line comments longer than 5 lines. Directive comments (`eslint-`, `oxlint-`, `@ts-`, and similar) and license headers are exempt. Severity: `warn`.
|
|
8175
8259
|
|
|
8176
8260
|
```ts
|
|
8177
8261
|
// bad
|