Skip to content

Commit 11571ea

Browse files
committed
chore: replace ESLint & Prettier with oxlint & oxfmt
1 parent 3dd3b8b commit 11571ea

File tree

11 files changed

+910
-1341
lines changed

11 files changed

+910
-1341
lines changed

.changeset/dry-kiwis-float.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@badrap/libapp": patch
3+
---
4+
5+
Switch from ESLint + Prettier to oxlint + oxfmt

.devcontainer/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ RUN apk add --no-cache \
55
ripgrep
66
RUN mkdir -p /workspace && chown node:node /workspace
77
USER node
8-
RUN mkdir -p /workspace/node_modules /workspace/dist

.devcontainer/devcontainer.json

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,11 @@
55
},
66
"postCreateCommand": "npm ci",
77
"remoteUser": "node",
8-
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",
8+
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind",
99
"workspaceFolder": "/workspace",
10-
"mounts": [
11-
"type=volume,target=/workspace/node_modules",
12-
"type=volume,target=/workspace/dist"
13-
],
1410
"customizations": {
1511
"vscode": {
16-
"extensions": [
17-
"dbaeumer.vscode-eslint",
18-
"esbenp.prettier-vscode",
19-
"ms-azuretools.vscode-docker"
20-
]
12+
"extensions": ["oxc.oxc-vscode"]
2113
}
2214
}
2315
}

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,4 @@ jobs:
2323
node-version: 24
2424
cache: npm
2525
- run: npm ci
26-
- run: npm run lint
27-
- run: npm run typecheck
26+
- run: npm run check

.github/workflows/version-or-publish.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ jobs:
2525
# Allow caching, as this job can't write and doesn't produce any artifacts.
2626
cache: npm
2727
- run: npm ci
28-
- run: npm run lint
29-
- run: npm run typecheck
28+
- run: npm run check
3029

3130
changesets:
3231
needs: check

.oxfmtrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"printWidth": 80,
4+
"sortImports": {
5+
"newlinesBetween": false
6+
}
7+
}

.oxlintrc.json

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["typescript"],
4+
"categories": {
5+
"correctness": "error",
6+
"suspicious": "error",
7+
"pedantic": "error"
8+
},
9+
"options": {
10+
"denyWarnings": true,
11+
"reportUnusedDisableDirectives": "warn",
12+
"typeAware": true,
13+
"typeCheck": true
14+
},
15+
"rules": {
16+
// category: "correctness" (overrides, enabled in categories)
17+
"@typescript-eslint/restrict-template-expressions": [
18+
"error",
19+
{
20+
"allowAny": false,
21+
"allowArray": false,
22+
"allowBoolean": false,
23+
"allowNever": false,
24+
"allowNullish": false,
25+
"allowNumber": true,
26+
"allowRegExp": false
27+
}
28+
],
29+
30+
// category: "suspicious" (overrides, enabled in categories)
31+
"no-shadow": "off",
32+
"@typescript-eslint/no-unsafe-type-assertion": "off",
33+
34+
// category: "pedantic" (overrides, enabled in categories)
35+
"array-callback-return": "off",
36+
"eqeqeq": ["error", "smart"],
37+
"max-classes-per-file": "off",
38+
"max-depth": "off",
39+
"max-lines": "off",
40+
"max-lines-per-function": "off",
41+
"no-else-return": "off",
42+
"no-inline-comments": "off",
43+
"no-negated-condition": "off",
44+
"require-await": "off",
45+
"@typescript-eslint/ban-types": "off",
46+
"@typescript-eslint/no-confusing-void-expression": "off",
47+
"@typescript-eslint/restrict-plus-operands": [
48+
"error",
49+
{
50+
"allowAny": false,
51+
"allowBoolean": false,
52+
"allowNullish": false,
53+
"allowNumberAndString": false,
54+
"allowRegExp": false
55+
}
56+
],
57+
"@typescript-eslint/return-await": [
58+
"error",
59+
"error-handling-correctness-only"
60+
],
61+
"@typescript-eslint/strict-boolean-expressions": "off",
62+
63+
// category: "restriction" (not enabled via categories)
64+
"no-empty": "error",
65+
"no-empty-function": "error",
66+
"no-regex-spaces": "error",
67+
"no-var": "error",
68+
"no-console": "warn",
69+
"@typescript-eslint/no-empty-object-type": "error",
70+
"@typescript-eslint/no-explicit-any": "error",
71+
"@typescript-eslint/no-invalid-void-type": "error",
72+
"@typescript-eslint/no-namespace": ["error", { "allowDeclarations": true }],
73+
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
74+
"@typescript-eslint/no-require-imports": "error",
75+
"@typescript-eslint/non-nullable-type-assertion-style": "error",
76+
"@typescript-eslint/prefer-literal-enum-member": "error",
77+
"@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
78+
79+
// category: "style" (not enabled via categories)
80+
"no-multi-assign": "error",
81+
"no-return-assign": "error",
82+
"prefer-const": "error",
83+
"prefer-rest-params": "error",
84+
"prefer-spread": "error",
85+
"@typescript-eslint/adjacent-overload-signatures": "error",
86+
"@typescript-eslint/array-type": "error",
87+
"@typescript-eslint/class-literal-property-style": "error",
88+
"@typescript-eslint/consistent-generic-constructors": "error",
89+
"@typescript-eslint/consistent-type-assertions": "error",
90+
"@typescript-eslint/no-inferrable-types": "error",
91+
"@typescript-eslint/prefer-function-type": "error",
92+
"@typescript-eslint/prefer-reduce-type-parameter": "error",
93+
94+
// category: "nursery" (not enabled via categories)
95+
"no-unreachable": "error",
96+
"@typescript-eslint/dot-notation": "error",
97+
"@typescript-eslint/no-unnecessary-condition": "error",
98+
"@typescript-eslint/no-unnecessary-type-parameters": "error",
99+
"@typescript-eslint/no-useless-default-assignment": "error",
100+
"@typescript-eslint/prefer-find": "error",
101+
"@typescript-eslint/prefer-optional-chain": "error",
102+
"@typescript-eslint/prefer-regexp-exec": "error",
103+
"@typescript-eslint/prefer-string-starts-ends-with": "error"
104+
}
105+
}

.vscode/settings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"editor.codeActionsOnSave": {
3-
"source.fixAll.eslint": "explicit"
3+
"source.fixAll.oxc": "always"
44
},
5-
"editor.defaultFormatter": "esbenp.prettier-vscode",
5+
"editor.defaultFormatter": "oxc.oxc-vscode",
66
"editor.formatOnSave": true,
7-
"editor.tabSize": 2,
7+
"editor.formatOnSaveMode": "file",
88
"files.exclude": {
99
"node_modules": true,
1010
"dist": true,
1111
".cache": true
1212
},
13-
"typescript.tsdk": "node_modules/typescript/lib"
13+
"js/ts.tsdk.path": "node_modules/typescript/lib"
1414
}

eslint.config.mjs

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)