Skip to content

Commit c57799d

Browse files
authored
tools: upgrade oxlint and make it do more eslint stuff (#2931)
make oxlint do more of the eslint stuff
1 parent 690bde0 commit c57799d

File tree

7 files changed

+181
-43
lines changed

7 files changed

+181
-43
lines changed

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# use path directly instead of npx or npm run because it's way faster
2-
node_modules/.bin/oxlint --deny-warnings
2+
node_modules/.bin/oxlint --type-aware --deny-warnings

.oxlintrc.json

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,29 @@
3131
"react-hooks/exhaustive-deps": "error",
3232
"react-hooks/rules-of-hooks": "error",
3333
"import/no-default-export": "error",
34-
"consistent-type-imports": "error"
34+
"consistent-type-imports": "error",
35+
36+
// Missing ESLint core rules
37+
"eqeqeq": ["error", "always", { "null": "ignore" }],
38+
"no-param-reassign": "error",
39+
"no-return-assign": "error",
40+
"no-restricted-imports": [
41+
"error",
42+
{
43+
// prevent confusion due to auto-imports and barrel files
44+
"paths": ["."],
45+
"patterns": [
46+
// import all CSS except index.css at top level through CSS @import statements
47+
// to avoid bad ordering situations. See https://github.com/oxidecomputer/console/pull/2035
48+
"*.css"
49+
]
50+
}
51+
],
52+
"radix": "error",
53+
54+
// TypeScript rules (currently disabled but available)
55+
"@typescript-eslint/no-floating-promises": "off",
56+
"@typescript-eslint/unbound-method": "off"
3557
},
3658
"overrides": [
3759
{

.prettierrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Copyright Oxide Computer Company
77
*/
88

9+
// eslint-disable-next-line no-default-export
910
export default {
1011
// note: it seems like tailwind has to be last for it to work
1112
plugins: ['@ianvs/prettier-plugin-sort-imports', 'prettier-plugin-tailwindcss'],

app/forms/firewall-rules-common.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ import { type FirewallRuleValues } from './firewall-rules-util'
6868

6969
type TargetAndHostFilterType =
7070
| VpcFirewallRuleTarget['type']
71+
// eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents
7172
| VpcFirewallRuleHostFilter['type']
7273

7374
type TargetAndHostFormValues = {

mock-api/json-type.type-spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import type { Json } from './json-type'
1515
// are not equal. There's no point in wrapping this in a real test because it
1616
// will always pass.
1717

18-
let val: any // eslint-disable-line @typescript-eslint/no-explicit-any
18+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
19+
const val: any = undefined
1920

2021
// just checking :)
2122
assertType<1>(val as 1)

package-lock.json

Lines changed: 149 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"e2ec": "playwright test --project=chrome",
2525
"visual:baseline": "./tools/generate-visual-baseline.sh",
2626
"visual:compare": "./tools/compare-visual-changes.sh",
27-
"lint": "oxlint && eslint --ext .js,.ts,.tsx app test mock-api",
28-
"oxlint": "oxlint",
27+
"lint": "oxlint --type-aware && eslint --ext .js,.ts,.tsx app test mock-api",
28+
"oxlint": "oxlint --type-aware",
2929
"fmt": "prettier --cache --write . && npm run lint -- --fix",
3030
"openapi-gen-ts": "openapi-gen-ts",
3131
"prettier": "prettier",
@@ -114,7 +114,8 @@
114114
"ip-num": "^1.5.1",
115115
"jsdom": "^25.0.1",
116116
"msw": "^2.7.5",
117-
"oxlint": "^1.6.0",
117+
"oxlint": "^1.23.0",
118+
"oxlint-tsgolint": "^0.2.0",
118119
"patch-package": "^8.0.0",
119120
"postcss": "^8.4.49",
120121
"postcss-import": "^16.1.0",

0 commit comments

Comments
 (0)