@addmargins/oxlint-config 0.1.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/LICENSE +21 -0
- package/README.md +48 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +69 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 addmargins
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @addmargins/oxlint-config
|
|
2
|
+
|
|
3
|
+
Oxlint preset that keeps agent-written code reviewable. Builds on [@nkzw/oxlint-config](https://github.com/nkzw-tech/oxlint-config) and adds type-checked rules and complexity limits.
|
|
4
|
+
|
|
5
|
+
## Error, never warn
|
|
6
|
+
|
|
7
|
+
Warnings get ignored. Every rule is an error: fix it or disable it inline.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
Requires Node 24+, Oxlint 1.94+, and `tsrs` (Oxlint's type-aware backend).
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pnpm add -D @addmargins/oxlint-config oxlint tsrs
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`oxlint.config.ts`:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import addmargins from "@addmargins/oxlint-config";
|
|
21
|
+
import { defineConfig } from "oxlint";
|
|
22
|
+
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
extends: [addmargins],
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Run `pnpm oxlint`.
|
|
29
|
+
|
|
30
|
+
## Based on nkzw
|
|
31
|
+
|
|
32
|
+
Everything in [@nkzw/oxlint-config](https://github.com/nkzw-tech/oxlint-config): correctness, unicorn, import, React, React Hooks, no-instanceof, no-only-tests, and its `quality/` rules. Type-aware linting on. Unused disable comments are errors.
|
|
33
|
+
|
|
34
|
+
## Rules
|
|
35
|
+
|
|
36
|
+
Added on top of nkzw. All `error`.
|
|
37
|
+
|
|
38
|
+
| Rule | Why |
|
|
39
|
+
| -------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
|
|
40
|
+
| `typescript/no-unsafe-*` (`argument`, `assignment`, `call`, `member-access`, `return`, `enum-comparison`) | No `any` leaking through. |
|
|
41
|
+
| `typescript/no-base-to-string`, `restrict-plus-operands`, `restrict-template-expressions` | No `[object Object]` in strings. |
|
|
42
|
+
| `typescript/require-await` | No `async` without `await`. |
|
|
43
|
+
| `typescript/await-thenable`, `no-misused-promises` | No mixed promise arrays. Async JSX handlers allowed. |
|
|
44
|
+
| `typescript/only-throw-error`, `prefer-promise-reject-errors` | Throw and reject `Error`s only. |
|
|
45
|
+
| `typescript/no-implied-eval`, `no-namespace`, `no-this-alias`, `no-redundant-type-constituents`, `no-unnecessary-type-assertion`, `unbound-method` | Rest of typescript-eslint `recommended-type-checked` that nkzw skips. |
|
|
46
|
+
| `no-unused-vars` | Prefix `_` to keep. `--fix` removes unused imports. |
|
|
47
|
+
| `complexity` | **Max 13** per function. |
|
|
48
|
+
| `max-depth` | **Max 3** nested blocks. |
|
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import nkzw from "@nkzw/oxlint-config";
|
|
2
|
+
// src/index.ts
|
|
3
|
+
const allFiles = ["**/*"];
|
|
4
|
+
const typeScriptFiles = ["**/*.{ts,tsx,mts,cts}"];
|
|
5
|
+
const javaScriptFiles = ["**/*.{js,jsx,mjs,cjs}"];
|
|
6
|
+
const missingRecommendedRules = {
|
|
7
|
+
syntactic: ["typescript/no-namespace", "typescript/no-this-alias"],
|
|
8
|
+
typeAware: [
|
|
9
|
+
"typescript/no-base-to-string",
|
|
10
|
+
"typescript/no-implied-eval",
|
|
11
|
+
"typescript/no-redundant-type-constituents",
|
|
12
|
+
"typescript/no-unnecessary-type-assertion",
|
|
13
|
+
"typescript/no-unsafe-argument",
|
|
14
|
+
"typescript/no-unsafe-assignment",
|
|
15
|
+
"typescript/no-unsafe-call",
|
|
16
|
+
"typescript/no-unsafe-enum-comparison",
|
|
17
|
+
"typescript/no-unsafe-member-access",
|
|
18
|
+
"typescript/no-unsafe-return",
|
|
19
|
+
"typescript/only-throw-error",
|
|
20
|
+
"typescript/prefer-promise-reject-errors",
|
|
21
|
+
"typescript/require-await",
|
|
22
|
+
"typescript/restrict-plus-operands",
|
|
23
|
+
"typescript/restrict-template-expressions",
|
|
24
|
+
"typescript/unbound-method"
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
const setAll = (names, value) => Object.fromEntries(names.map((name) => [name, value]));
|
|
28
|
+
const normalizeRules = (rules = {}) => Object.fromEntries(Object.entries(rules).map(([name, value]) => [name.replace(/^@typescript-eslint\//, "typescript/"), value]));
|
|
29
|
+
const { env, overrides: nkzwOverrides = [], rules: nkzwRules, ...nkzwBase } = nkzw;
|
|
30
|
+
const config = {
|
|
31
|
+
...nkzwBase,
|
|
32
|
+
overrides: [
|
|
33
|
+
{
|
|
34
|
+
files: allFiles,
|
|
35
|
+
env
|
|
36
|
+
},
|
|
37
|
+
...nkzwOverrides.filter(({ files }) => files.every((glob) => glob.startsWith("**/"))),
|
|
38
|
+
{
|
|
39
|
+
files: typeScriptFiles,
|
|
40
|
+
rules: setAll([
|
|
41
|
+
"no-implied-eval",
|
|
42
|
+
"no-throw-literal",
|
|
43
|
+
"prefer-promise-reject-errors"
|
|
44
|
+
], "off")
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
files: javaScriptFiles,
|
|
48
|
+
rules: setAll(missingRecommendedRules.typeAware, "off")
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
rules: {
|
|
52
|
+
...normalizeRules(nkzwRules),
|
|
53
|
+
...setAll([...missingRecommendedRules.syntactic, ...missingRecommendedRules.typeAware], "error"),
|
|
54
|
+
"typescript/await-thenable": "error",
|
|
55
|
+
"no-unused-vars": ["error", {
|
|
56
|
+
args: "after-used",
|
|
57
|
+
argsIgnorePattern: "^_",
|
|
58
|
+
fix: {
|
|
59
|
+
imports: "safe-fix",
|
|
60
|
+
variables: "off"
|
|
61
|
+
},
|
|
62
|
+
varsIgnorePattern: "^_"
|
|
63
|
+
}],
|
|
64
|
+
"typescript/no-misused-promises": ["error", { checksVoidReturn: { attributes: false } }],
|
|
65
|
+
complexity: ["error", { max: 13 }],
|
|
66
|
+
"max-depth": ["error", { max: 3 }]
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
export { config as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@addmargins/oxlint-config",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Oxlint preset that keeps agent-written code reviewable.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"config",
|
|
7
|
+
"javascript",
|
|
8
|
+
"oxlint",
|
|
9
|
+
"typescript"
|
|
10
|
+
],
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/addmargins/oxlint-config/issues"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/addmargins/oxlint-config.git"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": "./dist/index.mjs",
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@nkzw/oxlint-config": "3.0.1"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^26.6.5",
|
|
35
|
+
"oxlint": "^1.94.0",
|
|
36
|
+
"tsrs": "7.1.0-beta.tsrs2",
|
|
37
|
+
"typescript": "^7.0.2",
|
|
38
|
+
"vite-plus": "1.7.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"oxlint": ">=1.94.0",
|
|
42
|
+
"tsrs": ">=0.25.0-ts7.1.0-beta || ^7.1.0-beta.tsrs2"
|
|
43
|
+
},
|
|
44
|
+
"devEngines": {
|
|
45
|
+
"packageManager": {
|
|
46
|
+
"name": "pnpm",
|
|
47
|
+
"version": "12.21.0",
|
|
48
|
+
"onFail": "download"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=24"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "vp pack",
|
|
56
|
+
"dev": "vp pack --watch",
|
|
57
|
+
"test": "vp test",
|
|
58
|
+
"check": "vp check"
|
|
59
|
+
}
|
|
60
|
+
}
|