Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 0 additions & 145 deletions eslint.config.js

This file was deleted.

113 changes: 113 additions & 0 deletions oxlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import regexp from 'eslint-plugin-regexp'
import { defineConfig } from 'oxlint'

export default defineConfig({
options: {
typeAware: true,
},
plugins: ['typescript', 'node', 'import', 'unicorn'],
jsPlugins: ['eslint-plugin-n', 'eslint-plugin-regexp'],
categories: {
correctness: 'error',
},
env: {
builtin: true,
es2024: true,
node: true,
},
ignorePatterns: [
'**/dist/**',
'**/playground-temp/**',
'**/temp/**',
'packages/plugin-rsc/**',
],
rules: {
eqeqeq: [
'warn',
'always',
{
null: 'never',
},
],
'no-empty': [
'warn',
{
allowEmptyCatch: true,
},
],
'prefer-const': [
'warn',
{
destructuring: 'all',
},
],
'no-restricted-globals': ['error', 'require', '__dirname', '__filename'],
'no-empty-function': [
'error',
{
allow: ['arrowFunctions'],
},
],
'no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'no-case-declarations': 'error',
'no-fallthrough': 'error',
'typescript/explicit-module-boundary-types': [
'error',
{
allowArgumentsExplicitlyTypedAsAny: true,
},
],
'typescript/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
disallowTypeAnnotations: false,
},
],
'unicorn/prefer-node-protocol': 'error',
'import/no-duplicates': 'error',
'import/default': 'off',

'n/no-extraneous-import': 'error',
'n/no-extraneous-require': 'error',
'n/no-unsupported-features/es-builtins': 'error',
'n/no-unsupported-features/node-builtins': 'error',
...regexp.configs['flat/recommended'].rules,
'regexp/prefer-regexp-exec': 'error',
'regexp/prefer-regexp-test': 'error',
// in some cases using explicit letter-casing is more performant than the `i` flag
'regexp/use-ignore-case': 'off',
},
overrides: [
{
files: [
'packages/**/*.test.{,c,m}[jt]s{,x}',
'playground/**/*.{,c,m}[jt]s{,x}',
'packages/plugin-react-swc/playground/**/*.{,c,m}[jt]s{,x}',
],
rules: {
'n/no-extraneous-import': 'off',
'n/no-extraneous-require': 'off',
'n/no-unsupported-features/es-builtins': 'off',
'n/no-unsupported-features/node-builtins': 'off',
'no-empty': 'off',
'no-constant-condition': 'off',
'no-unused-expressions': 'off',
'no-unused-vars': 'off',
'no-empty-function': 'off',
'typescript/explicit-module-boundary-types': 'off',
},
},
],
})
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"preinstall": "npx only-allow pnpm",
"postinstall": "simple-git-hooks",
"format": "oxfmt",
"lint": "eslint --cache .",
"lint": "oxlint .",
"typecheck": "tsc -p scripts && tsc -p playground && tsc -p packages/plugin-react",
"test": "pnpm run test-unit && pnpm run test-serve && pnpm run test-build && pnpm --filter ./packages/plugin-react-swc run test",
"test-unit": "pnpm -r --filter='./packages/*' run test-unit",
Expand All @@ -30,22 +30,21 @@
"override-vite7": "yq -i '.overrides.vite = \"^7\"' pnpm-workspace.yaml && yq -i '.overrides.\"@vitejs/plugin-react\" = \"^5\"' pnpm-workspace.yaml && yq -i '.packages += [\"!packages/plugin-react\"]' pnpm-workspace.yaml"
},
"devDependencies": {
"@eslint/js": "^9.39.5",
"@types/fs-extra": "^11.0.4",
"@types/node": "^24.19.1",
"@vitejs/release-scripts": "^1.10.0",
"eslint": "^9.39.5",
"eslint-plugin-import-x": "^4.17.1",
"eslint-plugin-n": "^18.4.1",
"eslint-plugin-regexp": "^3.3.1",
"fs-extra": "^11.4.1",
"globals": "^17.13.0",
"lint-staged": "^17.6.0",
"oxfmt": "^0.71.0",
"oxlint": "^1.87.0",
"oxlint-tsgolint": "^7.0.2003",
"playwright-chromium": "^1.63.0",
"simple-git-hooks": "^2.14.0",
"typescript": "^6.0.3",
"typescript-eslint": "^8.71.0",
"vite": "^8.3.2",
"vite-plugin-inspect": "^12.0.2",
"vitest": "^5.0.3"
Expand All @@ -58,13 +57,13 @@
"oxfmt --no-error-on-unmatched-pattern"
],
"packages/*/{src,types}/**/*.ts": [
"eslint --cache --fix"
"oxlint --fix"
],
"packages/**/*.d.ts": [
"eslint --cache --fix"
"oxlint --fix"
],
"playground/**/__tests__/**/*.ts": [
"eslint --cache --fix"
"oxlint --fix"
]
},
"engines": {
Expand Down
5 changes: 4 additions & 1 deletion packages/common/refresh-runtime.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global window */
/* eslint-disable eqeqeq, prefer-const, @typescript-eslint/no-empty-function */
/* oxlint-disable eqeqeq, prefer-const, no-empty-function, no-unused-vars, typescript/no-implied-eval */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point we should split the React part and have linting disabled, and have our own part in TS and bundle that (but maybe not that simple given how it's written to be a single module)


/*! Copyright (c) Meta Platforms, Inc. and affiliates. **/
/**
Expand Down Expand Up @@ -372,6 +372,7 @@ export function injectIntoGlobalHook(globalObject) {
// Here, we just want to get a reference to scheduleRefresh.
const oldInject = hook.inject
hook.inject = function (injected) {
// oxlint-disable-next-line prefer-rest-params
const id = oldInject.apply(this, arguments)
if (
typeof injected.scheduleRefresh === 'function' &&
Expand Down Expand Up @@ -408,6 +409,7 @@ export function injectIntoGlobalHook(globalObject) {
rootElements.set(root, children)
}
}
// oxlint-disable-next-line prefer-rest-params
return oldOnScheduleFiberRoot.apply(this, arguments)
}
hook.onCommitFiberRoot = function (id, root, maybePriorityLevel, didError) {
Expand Down Expand Up @@ -460,6 +462,7 @@ export function injectIntoGlobalHook(globalObject) {
}

// Always call the decorated DevTools hook.
// oxlint-disable-next-line prefer-rest-params
return oldOnCommitFiberRoot.apply(this, arguments)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test('Decorators build', async ({ page }) => {

await expect(page.locator('body')).toHaveText('Hello World')

await server.httpServer.close()
await server.close()
})

test('Decorators dev', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test('Emotion plugin build', async ({ page }) => {
const code = page.locator('code')
await expectColor(code, 'color', '#646cff')

await server.httpServer.close()
await server.close()
})

test('Emotion plugin HMR', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test('Emotion build', async ({ page }) => {
const code = page.locator('code')
await expectColor(code, 'color', '#646cff')

await server.httpServer.close()
await server.close()
})

test('Emotion HMR', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('Default build', async ({ page }) => {
await page.click('button')
await expect(page.locator('button')).toHaveText('count is 1')

await server.httpServer.close()
await server.close()
})

test('HMR invalidate', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test('MDX build', async ({ page }) => {
const { testUrl, server } = await setupBuildAndPreview('mdx')
await page.goto(testUrl)
await expect(page.getByRole('heading', { name: 'Hello' })).toBeVisible()
await server.httpServer.close()
await server.close()
})

test('MDX HMR', async ({ page }) => {
Expand All @@ -22,7 +22,7 @@ test('MDX HMR', async ({ page }) => {

editFile('src/Counter.tsx', ['{count}', '{count}!'])
await waitForLogs('[vite] hot updated: /src/Counter.tsx')
const button = await page.locator('button')
const button = page.locator('button')
await button.click()
await expect(button).toHaveText('count is 1!')

Expand Down
Loading
Loading