Skip to content

Commit 1b15889

Browse files
Replaced eslint and prettier with oxlint and oxfmt (#5)
* Replaced eslint and prettier with oxlint and oxfmt * Fixed tests
1 parent 21f46b7 commit 1b15889

39 files changed

Lines changed: 1918 additions & 3578 deletions

.oxfmtrc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"ignorePatterns": ["dist"],
4+
"tabWidth": 4,
5+
"printWidth": 80,
6+
"sortPackageJson": false,
7+
"sortImports": {
8+
"newlinesBetween": false,
9+
"partitionByNewline": true
10+
},
11+
12+
"overrides": [
13+
{
14+
"files": ["*.{yaml,md}"],
15+
"options": {
16+
"tabWidth": 2
17+
}
18+
}
19+
]
20+
}

.prettierignore

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

.prettierrc.json

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

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"editor.defaultFormatter": "esbenp.prettier-vscode"
2+
"editor.defaultFormatter": "oxc.oxc-vscode",
3+
"oxc.configPath": "./oxlint.config.mts"
34
}

eslint.config.ts

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

oxlint.config.mts

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
import { defineConfig } from "oxlint";
2+
3+
// These rules should probably be re-enabled eventually
4+
const temporarilyDisabled = ["no-await-in-loop"];
5+
6+
const disabledRules = [
7+
...temporarilyDisabled,
8+
"eslint/arrow-body-style",
9+
"eslint/capitalized-comments",
10+
"eslint/complexity",
11+
"eslint/id-length",
12+
"eslint/init-declarations",
13+
"eslint/max-lines-per-function",
14+
"eslint/max-lines",
15+
"eslint/max-params",
16+
"eslint/max-statements",
17+
"eslint/no-console",
18+
"eslint/no-continue",
19+
"eslint/no-eq-null",
20+
"eslint/no-magic-numbers",
21+
"eslint/no-negated-condition",
22+
"eslint/no-plusplus",
23+
"eslint/no-ternary",
24+
"eslint/no-undefined",
25+
"eslint/no-use-before-define",
26+
"eslint/no-void",
27+
"eslint/prefer-destructuring",
28+
"eslint/sort-imports",
29+
"eslint/sort-keys",
30+
"func-style",
31+
"import/exports-last",
32+
"import/group-exports",
33+
"import/max-dependencies",
34+
"import/no-named-export",
35+
"import/no-namespace",
36+
"import/no-relative-parent-imports",
37+
"import/prefer-default-export",
38+
"oxc/no-async-await",
39+
"oxc/no-optional-chaining",
40+
"oxc/no-rest-spread-properties",
41+
"promise/prefer-await-to-callbacks",
42+
"typescript/explicit-function-return-type",
43+
"typescript/parameter-properties",
44+
"typescript/prefer-readonly-parameter-types",
45+
"typescript/promise-function-async",
46+
"typescript/strict-void-return",
47+
"unicorn/filename-case",
48+
"unicorn/no-array-for-each",
49+
"unicorn/no-lonely-if",
50+
"unicorn/no-null",
51+
"unicorn/prefer-at",
52+
"unicorn/prefer-spread",
53+
"unicorn/switch-case-braces",
54+
];
55+
56+
// oxlint-disable-next-line import/no-default-export
57+
export default defineConfig({
58+
ignorePatterns: ["dist", "src/typings"],
59+
options: {
60+
typeAware: true,
61+
typeCheck: true,
62+
},
63+
env: {
64+
node: true,
65+
mocha: true,
66+
},
67+
plugins: [
68+
"eslint",
69+
"typescript",
70+
"unicorn",
71+
"oxc",
72+
"import",
73+
"node",
74+
"promise",
75+
],
76+
categories: {
77+
correctness: "warn",
78+
suspicious: "warn",
79+
pedantic: "warn",
80+
perf: "warn",
81+
style: "warn",
82+
restriction: "warn",
83+
nursery: "warn",
84+
},
85+
86+
rules: {
87+
...Object.fromEntries(disabledRules.map((r) => [r, "off"])),
88+
"eslint/no-duplicate-imports": [
89+
"warn",
90+
{
91+
allowSeparateTypeImports: true,
92+
},
93+
],
94+
"eslint/no-restricted-imports": [
95+
"warn",
96+
{
97+
paths: [
98+
{
99+
name: "node:assert",
100+
message: "Use node:assert/strict instead",
101+
},
102+
],
103+
},
104+
],
105+
"eslint/no-unused-vars": [
106+
"warn",
107+
{
108+
argsIgnorePattern: "^_",
109+
destructuredArrayIgnorePattern: "^_",
110+
},
111+
],
112+
"no-restricted-imports": [
113+
"error",
114+
{
115+
patterns: [
116+
{
117+
group: ["**/node/**"],
118+
message:
119+
"Only files in src/node may import from src/node.",
120+
},
121+
],
122+
},
123+
],
124+
"typescript/strict-boolean-expressions": [
125+
"warn",
126+
{
127+
allowNullableBoolean: true,
128+
},
129+
],
130+
eqeqeq: [
131+
"warn",
132+
"always",
133+
{
134+
null: "never",
135+
},
136+
],
137+
},
138+
139+
overrides: [
140+
{
141+
files: ["src/node/**/*.ts", "src/test/**/*.ts", "src/build.ts"],
142+
rules: {
143+
"import/no-nodejs-modules": "off",
144+
"no-restricted-imports": "off",
145+
},
146+
},
147+
],
148+
});

0 commit comments

Comments
 (0)