@gusnips/oxlint 0.0.0-stage → 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 +74 -2
- package/base.json +23 -0
- package/package.json +55 -4
- package/react.json +22 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Gustavo Salomé
|
|
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
CHANGED
|
@@ -1,3 +1,75 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @gusnips/oxlint
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Two oxlint configs: `base.json` for a TypeScript repo and `react.json` for a React one. They hold
|
|
4
|
+
the lint core our repos each wrote for ESLint, so a repo keeps only its own rules.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
bun add -d @gusnips/oxlint oxlint
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
`.oxlintrc.json`:
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{ "extends": ["./node_modules/@gusnips/oxlint/react.json"] }
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`package.json`:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{ "scripts": { "lint": "oxlint" } }
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## What is in them
|
|
23
|
+
|
|
24
|
+
`base.json` turns on oxlint's `typescript` plugin and its `correctness` rules, as errors. On top of
|
|
25
|
+
that:
|
|
26
|
+
|
|
27
|
+
- `no-explicit-any` is an error.
|
|
28
|
+
- An unused variable or argument is an error, unless its name starts with `_`.
|
|
29
|
+
- `no-undef` is off. TypeScript already reports names that do not exist.
|
|
30
|
+
- The rules that ESLint's `recommended` and typescript-eslint's `recommended` switch on, and that
|
|
31
|
+
oxlint keeps outside `correctness`: `ban-ts-comment`, `no-array-constructor`,
|
|
32
|
+
`no-case-declarations`, `no-empty`, `no-empty-object-type`, `no-fallthrough`, `no-namespace`,
|
|
33
|
+
`no-prototype-builtins`, `no-regex-spaces`, `no-require-imports`, `no-unexpected-multiline`,
|
|
34
|
+
`no-unnecessary-type-constraint` and `no-unsafe-function-type`.
|
|
35
|
+
|
|
36
|
+
`react.json` extends `base.json`, turns on the `react` plugin, and sets what
|
|
37
|
+
`eslint-plugin-react-hooks` 7 sets in `recommended`, at the same level:
|
|
38
|
+
|
|
39
|
+
- `rules-of-hooks` (error) and `exhaustive-deps` (warning).
|
|
40
|
+
- The React Compiler rules: `static-components`, `use-memo`, `preserve-manual-memoization`,
|
|
41
|
+
`immutability`, `globals`, `refs`, `set-state-in-effect`, `error-boundaries` and
|
|
42
|
+
`set-state-in-render` (errors), and `incompatible-library` (warning).
|
|
43
|
+
|
|
44
|
+
Not there:
|
|
45
|
+
|
|
46
|
+
- `unsupported-syntax`, `config` and `gating`. oxlint does not have them yet.
|
|
47
|
+
- `react/purity` is off. It reports `new Date()` in a component, and the ESLint plugin does not. The
|
|
48
|
+
plugin still reports `Date.now()` and `Math.random()`.
|
|
49
|
+
- `react/jsx-key` is off. It reports the `components={[<b />, <i />]}` array that react-i18next's
|
|
50
|
+
`Trans` takes.
|
|
51
|
+
- `react/react-in-jsx-scope` is off. The JSX transform does not need `React` in scope.
|
|
52
|
+
- A refresh rule. Most of our repos turn `only-export-components` off.
|
|
53
|
+
|
|
54
|
+
Turn any of them on in your own file.
|
|
55
|
+
|
|
56
|
+
## Your own rules
|
|
57
|
+
|
|
58
|
+
Write them in your `.oxlintrc.json`, next to `extends`. Yours win.
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"extends": ["./node_modules/@gusnips/oxlint/react.json"],
|
|
63
|
+
"rules": { "no-console": "error" },
|
|
64
|
+
"overrides": [{ "files": ["**/*.test.ts"], "rules": { "typescript/no-explicit-any": "off" } }]
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Good to know
|
|
69
|
+
|
|
70
|
+
- `ignorePatterns` does not come through `extends`. oxlint skips what `.gitignore` lists, which
|
|
71
|
+
covers `dist` and `.turbo`. Anything else goes in your own file.
|
|
72
|
+
- `plugins` add up. A repo that sets none also gets oxlint's `unicorn` and `oxc` plugins, which the
|
|
73
|
+
ESLint core did not have. Write `"plugins": []` to keep only the ones the preset names.
|
|
74
|
+
- Rules that need types, like `no-floating-promises`, stay off until you run `oxlint --type-aware`.
|
|
75
|
+
- It needs oxlint 1.93 or newer.
|
package/base.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"plugins": ["typescript"],
|
|
3
|
+
"categories": { "correctness": "error" },
|
|
4
|
+
"rules": {
|
|
5
|
+
"no-undef": "off",
|
|
6
|
+
"no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }],
|
|
7
|
+
"typescript/no-explicit-any": "error",
|
|
8
|
+
|
|
9
|
+
"no-array-constructor": "error",
|
|
10
|
+
"no-case-declarations": "error",
|
|
11
|
+
"no-empty": "error",
|
|
12
|
+
"no-fallthrough": "error",
|
|
13
|
+
"no-prototype-builtins": "error",
|
|
14
|
+
"no-regex-spaces": "error",
|
|
15
|
+
"no-unexpected-multiline": "error",
|
|
16
|
+
"typescript/ban-ts-comment": "error",
|
|
17
|
+
"typescript/no-empty-object-type": "error",
|
|
18
|
+
"typescript/no-namespace": "error",
|
|
19
|
+
"typescript/no-require-imports": "error",
|
|
20
|
+
"typescript/no-unnecessary-type-constraint": "error",
|
|
21
|
+
"typescript/no-unsafe-function-type": "error"
|
|
22
|
+
}
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gusnips/oxlint",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "One oxlint config for a TypeScript repo, and one for a React repo. Rules go on top of it in the repo's own .oxlintrc.json.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Gustavo Salomé",
|
|
8
|
+
"homepage": "https://github.com/gusnips/kit/tree/main/oxlint#readme",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/gusnips/kit/issues"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
"./base.json": "./base.json",
|
|
14
|
+
"./react.json": "./react.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"base.json",
|
|
18
|
+
"react.json",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"oxlint",
|
|
27
|
+
"lint",
|
|
28
|
+
"typescript",
|
|
29
|
+
"react",
|
|
30
|
+
"react-hooks",
|
|
31
|
+
"config"
|
|
32
|
+
],
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"oxlint": "^1.93.0"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "bun run scripts/check-preset.ts",
|
|
38
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
39
|
+
"test": "bun run scripts/check-preset.ts",
|
|
40
|
+
"lint": "eslint scripts",
|
|
41
|
+
"sync:docs": "cp ../LICENSE .",
|
|
42
|
+
"prepublishOnly": "bun run lint && bun run typecheck && bun run test && bun run sync:docs",
|
|
43
|
+
"release:patch": "bun pm version patch && bun publish --access public",
|
|
44
|
+
"release:minor": "bun pm version minor && bun publish --access public",
|
|
45
|
+
"release:major": "bun pm version major && bun publish --access public"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^24.12.0",
|
|
49
|
+
"oxlint": "1.93.0",
|
|
50
|
+
"typescript": "^5.9.3"
|
|
51
|
+
},
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "git+https://github.com/gusnips/kit.git",
|
|
55
|
+
"directory": "oxlint"
|
|
56
|
+
}
|
|
57
|
+
}
|
package/react.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["./base.json"],
|
|
3
|
+
"plugins": ["react"],
|
|
4
|
+
"rules": {
|
|
5
|
+
"react/react-in-jsx-scope": "off",
|
|
6
|
+
"react/jsx-key": "off",
|
|
7
|
+
"react/purity": "off",
|
|
8
|
+
|
|
9
|
+
"react/rules-of-hooks": "error",
|
|
10
|
+
"react/exhaustive-deps": "warn",
|
|
11
|
+
"react/static-components": "error",
|
|
12
|
+
"react/use-memo": "error",
|
|
13
|
+
"react/preserve-manual-memoization": "error",
|
|
14
|
+
"react/incompatible-library": "warn",
|
|
15
|
+
"react/immutability": "error",
|
|
16
|
+
"react/globals": "error",
|
|
17
|
+
"react/refs": "error",
|
|
18
|
+
"react/set-state-in-effect": "error",
|
|
19
|
+
"react/error-boundaries": "error",
|
|
20
|
+
"react/set-state-in-render": "error"
|
|
21
|
+
}
|
|
22
|
+
}
|