Skip to content

Commit 5894ffe

Browse files
feat: Oxlint configuration setup (#46)
* Add oxlint configuration Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com> * Fix import/no-duplicates option casing * Consolidate no-unused-vars override * Align FIXME term casing in oxlint --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent bc5e08d commit 5894ffe

3 files changed

Lines changed: 155 additions & 2 deletions

File tree

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div>
22
<h1 align="center"><a href="https://npm.im/@epic-web/config">👮 @epic-web/config</a></h1>
33
<strong>
4-
Reasonable ESLint, Prettier, and TypeScript configs for epic web devs
4+
Reasonable ESLint, Oxlint, Prettier, and TypeScript configs for epic web devs
55
</strong>
66
<p>
77
This makes assumptions about the way you prefer to develop software and gives you configurations that will actually help you in your development.
@@ -139,6 +139,34 @@ configurations minimal and only enable rules that catch real problems (the kind
139139
that are likely to happen). This keeps our linting faster and reduces the number
140140
of false positives.
141141

142+
### Oxlint
143+
144+
Create a `.oxlintrc.json` file in your project root with the following content:
145+
146+
```json
147+
{
148+
"extends": ["./node_modules/@epic-web/config/oxlint-config.json"]
149+
}
150+
```
151+
152+
Note: `typescript/no-misused-promises` and `typescript/no-floating-promises` are
153+
type-aware in Oxlint and require the type-aware setup described in the Oxlint
154+
docs.
155+
156+
#### Unsupported rules
157+
158+
The following ESLint rules/plugins from this config are not yet available in
159+
Oxlint, so they are intentionally omitted:
160+
161+
- `import/order`
162+
- `react-hooks/rules-of-hooks`
163+
- `react-hooks/exhaustive-deps`
164+
- `@typescript-eslint/no-unused-vars` (falls back to `eslint/no-unused-vars`)
165+
- `testing-library/*`
166+
- `jest-dom/*`
167+
- `vitest/*` (except `vitest/no-import-node-test`)
168+
- `playwright/*`
169+
142170
## License
143171

144172
MIT

oxlint-config.json

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"env": {
4+
"browser": true,
5+
"node": true
6+
},
7+
"plugins": ["import", "react", "typescript", "vitest"],
8+
"ignorePatterns": [
9+
"**/.cache/**",
10+
"**/node_modules/**",
11+
"**/build/**",
12+
"**/public/**",
13+
"**/*.json",
14+
"**/playwright-report/**",
15+
"**/server-build/**",
16+
"**/dist/**",
17+
"**/coverage/**",
18+
"**/*.tsbuildinfo",
19+
"**/.react-router/**",
20+
"**/.wrangler/**",
21+
"**/worker-configuration.d.ts"
22+
],
23+
"rules": {
24+
"eslint/no-unexpected-multiline": "error",
25+
"eslint/no-warning-comments": [
26+
"error",
27+
{
28+
"terms": ["FIXME"],
29+
"location": "anywhere"
30+
}
31+
],
32+
"import/no-duplicates": [
33+
"warn",
34+
{
35+
"prefer-inline": true
36+
}
37+
]
38+
},
39+
"overrides": [
40+
{
41+
"files": ["**/*.tsx", "**/*.jsx"],
42+
"rules": {
43+
"react/jsx-key": "warn"
44+
}
45+
},
46+
{
47+
"files": ["**/*.js", "**/*.jsx"],
48+
"rules": {
49+
"eslint/no-undef": "error"
50+
}
51+
},
52+
{
53+
"files": ["**/*.ts", "**/*.tsx"],
54+
"rules": {
55+
"import/consistent-type-specifier-style": ["warn", "prefer-inline"],
56+
"typescript/consistent-type-imports": [
57+
"warn",
58+
{
59+
"prefer": "type-imports",
60+
"disallowTypeAnnotations": true,
61+
"fixStyle": "inline-type-imports"
62+
}
63+
],
64+
"typescript/no-misused-promises": [
65+
"error",
66+
{
67+
"checksVoidReturn": false
68+
}
69+
],
70+
"typescript/no-floating-promises": "error"
71+
}
72+
},
73+
{
74+
"files": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
75+
"rules": {
76+
"eslint/no-unused-vars": [
77+
"warn",
78+
{
79+
"args": "after-used",
80+
"argsIgnorePattern": "^_",
81+
"ignoreRestSiblings": true,
82+
"varsIgnorePattern": "^ignored"
83+
}
84+
],
85+
"eslint/no-restricted-imports": [
86+
"error",
87+
{
88+
"patterns": [
89+
{
90+
"group": [
91+
"**/tests/**",
92+
"**/#tests/**",
93+
"**/__tests__/**/*",
94+
"**/*.test.*",
95+
"**/*.spec.*"
96+
],
97+
"message": "Do not import test files in source files"
98+
}
99+
]
100+
}
101+
]
102+
}
103+
},
104+
{
105+
"files": [
106+
"**/tests/**",
107+
"**/#tests/**",
108+
"**/__tests__/**/*",
109+
"**/*.test.*",
110+
"**/*.spec.*"
111+
],
112+
"rules": {
113+
"eslint/no-restricted-imports": "off",
114+
"vitest/no-import-node-test": "error"
115+
}
116+
},
117+
{
118+
"files": ["**/tests/e2e/**"],
119+
"rules": {
120+
"vitest/no-import-node-test": "off"
121+
}
122+
}
123+
]
124+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"./prettier": "./prettier.js",
1717
"./typescript": "./typescript.json",
1818
"./reset.d.ts": "./reset.d.ts",
19-
"./eslint": "./eslint.js"
19+
"./eslint": "./eslint.js",
20+
"./oxlint": "./oxlint-config.json"
2021
},
2122
"prettier": "./prettier.js",
2223
"scripts": {

0 commit comments

Comments
 (0)