Skip to content

Commit ac5ab50

Browse files
authored
Configure oxlint, address some lint warnings (#1690)
1 parent 02d85ec commit ac5ab50

12 files changed

Lines changed: 302 additions & 14 deletions

File tree

.oxlintrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"ignorePatterns": ["packages/webpack-plugin/extracted.js"]
4+
}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ pnpm-lock.yaml
1313
test-results
1414
examples/remix/build
1515
.pnpm-store
16+
next-env.d.ts

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
"test:playwright": "pnpm test:clean-next && pnpm test:build-next && playwright test",
2020
"test:clean-next": "pnpm --filter=@fixtures/next-* run '/^clean.*/'",
2121
"test:build-next": "node scripts/copy-next-plugin.ts && pnpm --filter=@fixtures/next-* run '/^build.*/'",
22-
"format": "prettier --write .",
23-
"lint": "pnpm run '/^lint:.*/'",
22+
"format": "oxlint --fix && prettier --write .",
23+
"lint": "pnpm run --no-bail '/^lint:.*/'",
2424
"lint:manypkg": "manypkg check",
2525
"lint:prettier": "prettier --cache --check .",
2626
"lint:tsc": "tsc",
27+
"lint:oxlint": "oxlint",
2728
"copy-readme-to-packages": "node scripts/copy-readme-to-packages.ts",
2829
"version": "changeset version && pnpm install --lockfile-only",
2930
"prepare-release": "pnpm copy-readme-to-packages && pnpm build",
@@ -47,6 +48,7 @@
4748
"cross-env": "^7.0.3",
4849
"jest": "^29.7.0",
4950
"jest-environment-jsdom": "^29.7.0",
51+
"oxlint": "^1.55.0",
5052
"prettier": "^3.8.1",
5153
"tsx": "^4.20.6",
5254
"typescript": "^5.8.3",
@@ -63,5 +65,5 @@
6365
"manypkg": {
6466
"workspaceProtocol": "require"
6567
},
66-
"packageManager": "pnpm@10.24.0"
68+
"packageManager": "pnpm@10.32.0"
6769
}

packages/css/src/conditionalRulesets.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export class ConditionalRuleset {
4646
}
4747

4848
getConditionalRulesetByPath(conditionPath: Array<Query>): ConditionalRuleset {
49+
// Couldn't fine a way around this
50+
// oxlint-disable-next-line typescript/no-this-alias
4951
let currRuleset: ConditionalRuleset = this;
5052

5153
for (const query of conditionPath) {

packages/next-plugin/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function getSupportedBrowsers(dir: string, isDevelopment: boolean) {
4040
path: dir,
4141
env: isDevelopment ? 'development' : 'production',
4242
});
43-
} catch (_) {
43+
} catch {
4444
return undefined;
4545
}
4646
}
@@ -184,7 +184,7 @@ export const createVanillaExtractPlugin = (
184184

185185
let turbopack: typeof nextConfig.turbopack;
186186
if (enableTurbopack) {
187-
turbopack = { ...(nextConfig.turbopack || {}) };
187+
turbopack = { ...nextConfig.turbopack };
188188

189189
if (turbopackGlob.some((glob) => turbopack.rules?.[glob])) {
190190
throw new Error(
@@ -212,7 +212,7 @@ export const createVanillaExtractPlugin = (
212212
} as const;
213213

214214
turbopack.rules = {
215-
...(turbopack.rules || {}),
215+
...turbopack.rules,
216216
...Object.fromEntries(
217217
turbopackGlob.map((glob) => [glob, vanillaExtractRule]),
218218
),

packages/turbopack-plugin/src/next-font/transform.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const GENERIC_FAMILIES = new Set([
2828
// --- Helpers ---
2929

3030
function formatFontFamily(name: string): string {
31-
const clean = name.replace(/['\"]/g, '');
31+
const clean = name.replace(/['"]/g, '');
3232
return GENERIC_FAMILIES.has(clean.toLowerCase()) ? clean : `'${clean}'`;
3333
}
3434

@@ -213,8 +213,8 @@ export async function transformNextFont(
213213
): Promise<NextFontTransformResult> {
214214
// 1. Parse
215215
const isTs = /\.(?:[cm]?ts|tsx)$/.test(filename);
216-
const isTsx = /\.tsx$/.test(filename);
217-
const isJsx = /\.jsx$/.test(filename);
216+
const isTsx = filename.endsWith('.tsx');
217+
const isJsx = filename.endsWith('.jsx');
218218

219219
const module = await swc.parse(code, {
220220
syntax: isTs ? 'typescript' : 'ecmascript',

0 commit comments

Comments
 (0)