@himynameisdave/oxlint-config 1.2.0 → 2.0.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 +38 -14
- package/dist/base.d.ts +1 -1
- package/dist/bun.d.ts +16 -0
- package/dist/bun.js +25 -0
- package/dist/index.d.ts +13 -2
- package/dist/index.js +4 -2
- package/dist/type-aware.js +1 -1
- package/package.json +15 -7
package/README.md
CHANGED
|
@@ -29,18 +29,21 @@ pnpm add -D oxlint @himynameisdave/oxlint-config
|
|
|
29
29
|
yarn add -D oxlint @himynameisdave/oxlint-config
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
- Requires `oxlint >=1.
|
|
32
|
+
- Requires `oxlint >=1.85.0 <2`. Why that range, and how it moves: [Versioning & compatibility](#versioning--compatibility).
|
|
33
33
|
- Type-aware linting requires TypeScript 7+ and a `strict` tsconfig.
|
|
34
34
|
|
|
35
35
|
## Configurations
|
|
36
36
|
|
|
37
|
-
| Config | Import | What it is
|
|
38
|
-
| ------------ | ------------------------------------------ |
|
|
39
|
-
| `base` | `@himynameisdave/oxlint-config/base` | Core JS/TS rules. No framework assumptions. Start here.
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
|
|
|
37
|
+
| Config | Import | What it is |
|
|
38
|
+
| ------------ | ------------------------------------------ | ---------------------------------------------------------------------------- |
|
|
39
|
+
| `base` | `@himynameisdave/oxlint-config/base` | Core JS/TS rules. No framework assumptions. Start here. |
|
|
40
|
+
| `bun` | `@himynameisdave/oxlint-config/bun` | All rules from the pinned bunisms plugin, as errors. Bun-targeted code only. |
|
|
41
|
+
| `svelte` | `@himynameisdave/oxlint-config/svelte` | Svelte 5 (runes) overrides for `.svelte`/`.svelte.ts` files. |
|
|
42
|
+
| `type-aware` | `@himynameisdave/oxlint-config/type-aware` | Rules needing type info. Requires `oxlint-tsgolint` + `--type-aware`. |
|
|
43
|
+
| `vitest` | `@himynameisdave/oxlint-config/vitest` | Test-suite rules for Vitest projects (`.only` in CI, etc). |
|
|
44
|
+
| _(default)_ | `@himynameisdave/oxlint-config` | Kitchen sink for Bun projects: all of the above. |
|
|
45
|
+
|
|
46
|
+
The default assumes your code targets Bun. For Node or browser projects, compose the individual presets without `bun`.
|
|
44
47
|
|
|
45
48
|
## Usage
|
|
46
49
|
|
|
@@ -91,27 +94,48 @@ oxlint -c oxlint.config.ts --deny-warnings
|
|
|
91
94
|
|
|
92
95
|
Version bumps describe what a release does to _your_ CI:
|
|
93
96
|
|
|
94
|
-
- **major**: structural change to what this package _is_. An oxlint major bump, a new plugin enabled, an entry point renamed or removed.
|
|
95
|
-
- **minor**: rule decisions. New rules decided (usually after an oxlint release adds them), an existing rule flipped between `error` and `off`, or
|
|
97
|
+
- **major**: structural change to what this package _is_. An oxlint major bump, a new plugin enabled in an existing preset, an entry point or public rule name renamed or removed, or an incompatible runtime requirement.
|
|
98
|
+
- **minor**: rule decisions. New rules decided (usually after an oxlint release adds them), an existing rule flipped between `error` and `off`, options tightened, or a plugin update changes lint findings. New errors can appear in code that passed before.
|
|
96
99
|
- **patch**: docs, comments, tooling. No behavior change.
|
|
97
100
|
|
|
98
101
|
Rule churn is deliberately _not_ a major bump. A newly-decided rule and a rule flipped from `off` to `error` break your build in exactly the same way, so pretending one is riskier than the other would just inflate the major number without telling you anything. New errors are the point of the package.
|
|
99
102
|
|
|
100
103
|
`^` accepts new errors on update. Don't want that? Use `~` (patch only) with a committed lockfile, and upgrade deliberately.
|
|
101
104
|
|
|
102
|
-
**Supported oxlint: `>=1.
|
|
105
|
+
**Supported oxlint: `>=1.85.0 <2`.** The floor is the version this release's rule inventory was certified against, so it moves whenever new rules are decided. Older oxlint skips rules it doesn't know instead of erroring, which means a stale binary quietly under-lints. The `<2` ceiling is there because an oxlint 2.0 needs a release here anyway.
|
|
103
106
|
|
|
104
107
|
**Type-aware assumes a strict tsconfig.** The `type-aware` config expects `"strict": true`, and does its best work with `"noUncheckedIndexedAccess"`. Without them, rules like `typescript/no-unnecessary-condition` both over- and under-report.
|
|
105
108
|
|
|
106
109
|
**Plugins you add start off.** Every category is `"off"` by design, so adding `plugins: ['react']` to your own config enables zero react rules until you name each one. Surprising once, then greppable forever.
|
|
107
110
|
|
|
111
|
+
## Bun support and upstream updates
|
|
112
|
+
|
|
113
|
+
The `bun` preset enables the reviewed rules from [`eslint-plugin-bunisms`](https://github.com/himynameisdave/eslint-plugin-bunisms) as errors. The plugin is bundled as a runtime dependency, so consumers only need this config and Oxlint. Use it for code targeting Bun >=1.4.0.
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
import { defineConfig } from 'oxlint';
|
|
117
|
+
import base from '@himynameisdave/oxlint-config/base';
|
|
118
|
+
import bun from '@himynameisdave/oxlint-config/bun';
|
|
119
|
+
|
|
120
|
+
export default defineConfig({
|
|
121
|
+
extends: [base, bun],
|
|
122
|
+
rules: {
|
|
123
|
+
// Keep a Node-compatible subprocess call where the application needs one.
|
|
124
|
+
'bun/prefer-bun-spawn': 'off'
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The rule set is reviewed and updated with this package; upstream updates may add new lint errors. For Node or browser projects, compose the other presets without `bun`.
|
|
130
|
+
|
|
108
131
|
## Enabled plugins
|
|
109
132
|
|
|
110
|
-
`typescript
|
|
133
|
+
- Core: `eslint`, `typescript`, `unicorn`, `oxc`, `import`, `promise`, `node`, `jsdoc`
|
|
134
|
+
- Add-ons: `vitest`, `bun` (both included in the default config)
|
|
111
135
|
|
|
112
136
|
The `vitest` stance: test suites deserve the same rigor as app code. The flagship rule is `no-focused-tests`: a committed `it.only` makes CI silently green while skipping every other test. The add-on's rules only fire on test-shaped syntax, so extending it is harmless for non-test files. **Not for `bun:test` suites:** oxlint recognizes test functions by import source (`vitest`, `@jest/globals`) or bare globals, and `import { it } from 'bun:test'` is invisible to it (verified empirically; see `src/vitest.ts`). Bun-native suites get no lint coverage until oxlint supports `bun:test` upstream.
|
|
113
137
|
|
|
114
|
-
The `jsdoc` stance: exported symbols should be documented; internal code doesn't have to be. Any JSDoc you _do_ write must be complete and descriptive (a partial `@param` list or a bare `@returns` errors), and types never go in JSDoc (TypeScript owns them). oxlint has no `require-jsdoc` rule yet, so _existence_ of docs on exports stays a review expectation until upstream ships one (this config will adopt it with `publicOnly` when it lands).
|
|
138
|
+
The `jsdoc` stance: exported symbols should be documented; internal code doesn't have to be. Any JSDoc you _do_ write must be complete and descriptive (a partial `@param` list or a bare `@returns` errors), and types never go in JSDoc (TypeScript owns them). [oxfmt](https://oxc.rs/docs/guide/usage/formatter.html) handles comment formatting. oxlint has no `require-jsdoc` rule yet, so _existence_ of docs on exports stays a review expectation until upstream ships one (this config will adopt it with `publicOnly` when it lands).
|
|
115
139
|
|
|
116
140
|
## Svelte support
|
|
117
141
|
|
|
@@ -150,7 +174,7 @@ export default defineConfig({
|
|
|
150
174
|
});
|
|
151
175
|
```
|
|
152
176
|
|
|
153
|
-
`eslint/no-unused-labels` is _not_ in that list: as of oxlint 1.
|
|
177
|
+
`eslint/no-unused-labels` is _not_ in that list: as of oxlint 1.85 it doesn't fire inside `.svelte` files at all (it does in `.ts`). Add it if a future oxlint starts flagging `$:`.
|
|
154
178
|
|
|
155
179
|
SvelteKit route files need no override. `unicorn/filename-case` skips the leading `+` and checks the rest, so `+page.svelte`, `+layout.server.ts` and friends all pass. Only genuinely bad casing after the `+` (`+Bad_Name.ts`) errors.
|
|
156
180
|
|
package/dist/base.d.ts
CHANGED
|
@@ -169,7 +169,7 @@ declare const _default: {
|
|
|
169
169
|
'eslint/no-ternary': "off";
|
|
170
170
|
'eslint/no-useless-computed-key': "error";
|
|
171
171
|
'eslint/object-shorthand': "error";
|
|
172
|
-
'eslint/one-var': ["error",
|
|
172
|
+
'eslint/one-var': ["error", "never"];
|
|
173
173
|
'eslint/operator-assignment': "error";
|
|
174
174
|
'eslint/prefer-arrow-callback': "error";
|
|
175
175
|
'eslint/prefer-const': "error";
|
package/dist/bun.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bun-targeted code: every rule in the pinned bunisms version is an error.
|
|
3
|
+
* Resolve from this package so consumers need no separate plugin installation.
|
|
4
|
+
*/
|
|
5
|
+
declare const _default: {
|
|
6
|
+
jsPlugins: {
|
|
7
|
+
name: string;
|
|
8
|
+
specifier: string;
|
|
9
|
+
}[];
|
|
10
|
+
rules: {
|
|
11
|
+
'bun/prefer-bun-file': "error";
|
|
12
|
+
'bun/prefer-bun-write': "error";
|
|
13
|
+
'bun/prefer-bun-spawn': "error";
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
package/dist/bun.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import { defineConfig } from 'oxlint';
|
|
3
|
+
/**
|
|
4
|
+
* Bun-targeted code: every rule in the pinned bunisms version is an error.
|
|
5
|
+
* Resolve from this package so consumers need no separate plugin installation.
|
|
6
|
+
*/
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
jsPlugins: [
|
|
9
|
+
{
|
|
10
|
+
name: 'bun',
|
|
11
|
+
specifier: fileURLToPath(import.meta.resolve('eslint-plugin-bunisms'))
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
rules: {
|
|
15
|
+
// Bun.file keeps file reads on Bun's native file API.
|
|
16
|
+
// https://github.com/himynameisdave/eslint-plugin-bunisms/blob/main/docs/rules/prefer-bun-file.md
|
|
17
|
+
'bun/prefer-bun-file': 'error',
|
|
18
|
+
// Bun.write provides the native write path for Bun-targeted applications.
|
|
19
|
+
// https://github.com/himynameisdave/eslint-plugin-bunisms/blob/main/docs/rules/prefer-bun-write.md
|
|
20
|
+
'bun/prefer-bun-write': 'error',
|
|
21
|
+
// Bun's subprocess APIs integrate directly with its runtime and streams.
|
|
22
|
+
// https://github.com/himynameisdave/eslint-plugin-bunisms/blob/main/docs/rules/prefer-bun-spawn.md
|
|
23
|
+
'bun/prefer-bun-spawn': 'error'
|
|
24
|
+
}
|
|
25
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { default as base } from './base.js';
|
|
2
|
+
export { default as bun } from './bun.js';
|
|
2
3
|
export { default as svelte } from './svelte.js';
|
|
3
4
|
export { default as typeAware } from './type-aware.js';
|
|
4
5
|
export { default as vitest } from './vitest.js';
|
|
5
6
|
/**
|
|
6
|
-
* Kitchen sink: base + svelte + vitest + type-aware, in override-safe order.
|
|
7
|
+
* Kitchen sink for Bun: base + bun + svelte + vitest + type-aware, in override-safe order.
|
|
7
8
|
* Requires `oxlint-tsgolint` installed (type-aware rules are on).
|
|
8
9
|
*
|
|
9
10
|
* For à la carte composition, extend the named exports instead:
|
|
@@ -172,7 +173,7 @@ declare const _default: {
|
|
|
172
173
|
'eslint/no-ternary': "off";
|
|
173
174
|
'eslint/no-useless-computed-key': "error";
|
|
174
175
|
'eslint/object-shorthand': "error";
|
|
175
|
-
'eslint/one-var': ["error",
|
|
176
|
+
'eslint/one-var': ["error", "never"];
|
|
176
177
|
'eslint/operator-assignment': "error";
|
|
177
178
|
'eslint/prefer-arrow-callback': "error";
|
|
178
179
|
'eslint/prefer-const': "error";
|
|
@@ -557,6 +558,16 @@ declare const _default: {
|
|
|
557
558
|
};
|
|
558
559
|
})[];
|
|
559
560
|
ignorePatterns: string[];
|
|
561
|
+
} | {
|
|
562
|
+
jsPlugins: {
|
|
563
|
+
name: string;
|
|
564
|
+
specifier: string;
|
|
565
|
+
}[];
|
|
566
|
+
rules: {
|
|
567
|
+
'bun/prefer-bun-file': "error";
|
|
568
|
+
'bun/prefer-bun-write': "error";
|
|
569
|
+
'bun/prefer-bun-spawn': "error";
|
|
570
|
+
};
|
|
560
571
|
} | {
|
|
561
572
|
overrides: {
|
|
562
573
|
files: string[];
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { defineConfig } from 'oxlint';
|
|
2
2
|
import base from './base.js';
|
|
3
|
+
import bun from './bun.js';
|
|
3
4
|
import svelte from './svelte.js';
|
|
4
5
|
import typeAware from './type-aware.js';
|
|
5
6
|
import vitest from './vitest.js';
|
|
6
7
|
export { default as base } from './base.js';
|
|
8
|
+
export { default as bun } from './bun.js';
|
|
7
9
|
export { default as svelte } from './svelte.js';
|
|
8
10
|
export { default as typeAware } from './type-aware.js';
|
|
9
11
|
export { default as vitest } from './vitest.js';
|
|
10
12
|
/**
|
|
11
|
-
* Kitchen sink: base + svelte + vitest + type-aware, in override-safe order.
|
|
13
|
+
* Kitchen sink for Bun: base + bun + svelte + vitest + type-aware, in override-safe order.
|
|
12
14
|
* Requires `oxlint-tsgolint` installed (type-aware rules are on).
|
|
13
15
|
*
|
|
14
16
|
* For à la carte composition, extend the named exports instead:
|
|
@@ -19,5 +21,5 @@ export { default as vitest } from './vitest.js';
|
|
|
19
21
|
* ```
|
|
20
22
|
*/
|
|
21
23
|
export default defineConfig({
|
|
22
|
-
extends: [base, svelte, vitest, typeAware]
|
|
24
|
+
extends: [base, bun, svelte, vitest, typeAware]
|
|
23
25
|
});
|
package/dist/type-aware.js
CHANGED
|
@@ -22,7 +22,7 @@ export default defineConfig({
|
|
|
22
22
|
// obj["key"] for a statically-known key is obj.key.
|
|
23
23
|
'typescript/dot-notation': 'error',
|
|
24
24
|
// NOTE: tsgolint also implements naming-convention and prefer-destructuring,
|
|
25
|
-
// but oxlint 1.
|
|
25
|
+
// but oxlint 1.85 doesn't register those rule names yet — add them here once
|
|
26
26
|
// they land upstream.
|
|
27
27
|
// delete arr[i] leaves a hole, not a shorter array — splice/filter instead.
|
|
28
28
|
'typescript/no-array-delete': 'error',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@himynameisdave/oxlint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "An opinionated oxlint config, by and for himynameisdave.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
"types": "./dist/base.d.ts",
|
|
37
37
|
"default": "./dist/base.js"
|
|
38
38
|
},
|
|
39
|
+
"./bun": {
|
|
40
|
+
"types": "./dist/bun.d.ts",
|
|
41
|
+
"default": "./dist/bun.js"
|
|
42
|
+
},
|
|
39
43
|
"./svelte": {
|
|
40
44
|
"types": "./dist/svelte.d.ts",
|
|
41
45
|
"default": "./dist/svelte.js"
|
|
@@ -63,15 +67,19 @@
|
|
|
63
67
|
"format:check": "oxfmt --check",
|
|
64
68
|
"test": "bun run lint && bun run format:check && bun run check-coverage && bun run test:consumer"
|
|
65
69
|
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"eslint-plugin-bunisms": "0.1.0"
|
|
72
|
+
},
|
|
66
73
|
"devDependencies": {
|
|
67
|
-
"@types/bun": "^1.
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"oxlint
|
|
74
|
+
"@types/bun": "^1.4.2",
|
|
75
|
+
"@types/node": "^26.1.1",
|
|
76
|
+
"oxfmt": "0.70.0",
|
|
77
|
+
"oxlint": "1.85.0",
|
|
78
|
+
"oxlint-tsgolint": "7.0.2003",
|
|
71
79
|
"typescript": "^7.0.0"
|
|
72
80
|
},
|
|
73
81
|
"peerDependencies": {
|
|
74
|
-
"oxlint": ">=1.
|
|
82
|
+
"oxlint": ">=1.85.0 <2",
|
|
75
83
|
"oxlint-tsgolint": ">=7.0.2001"
|
|
76
84
|
},
|
|
77
85
|
"peerDependenciesMeta": {
|
|
@@ -79,5 +87,5 @@
|
|
|
79
87
|
"optional": true
|
|
80
88
|
}
|
|
81
89
|
},
|
|
82
|
-
"packageManager": "bun@1.
|
|
90
|
+
"packageManager": "bun@1.4.2"
|
|
83
91
|
}
|