Skip to content

Commit

Permalink
feat: add experimental oxlint support
Browse files Browse the repository at this point in the history
Pending oxc-project/eslint-plugin-oxlint#196
for correct rule overrides.
  • Loading branch information
haoqunjiang committed Oct 23, 2024
1 parent d1fe363 commit eeb25ea
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bin/create-eslint-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,19 @@ const { needsPrettier } = await prompt({
message: 'Do you need Prettier to format your code?'
})

const { needsOxlint } = await prompt({
type: 'toggle',
disabled: 'No',
enabled: 'Yes',
name: 'needsOxlint',
message: 'Would you like to supplement ESLint with Oxlint for faster linting (experimental)?'
})

const { pkg: pkgToExtend, files } = createConfig({
hasTypeScript,
supportedScriptLangs,
needsPrettier,
needsOxlint,
})

// TODO:
Expand Down
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default function createConfig({

hasTypeScript = false,
needsPrettier = false,
needsOxlint = false,

additionalConfigs = [],
}) {
Expand Down Expand Up @@ -51,6 +52,18 @@ export default function createConfig({
})
}

if (needsOxlint) {
additionalConfigs.push({
devDependencies: pickDependencies(['oxlint', 'eslint-plugin-oxlint']),
afterVuePlugin: [
{
importer: "import oxlint from 'eslint-plugin-oxlint'",
content: "oxlint.configs['flat/recommended'],",
},
],
})
}

if (needsPrettier) {
additionalConfigs.push({
devDependencies: pickDependencies([
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
"@vue/eslint-config-prettier": "^10.0.0",
"@vue/eslint-config-typescript": "^14.1.3",
"eslint": "^9.13.0",
"eslint-plugin-oxlint": "^0.10.1",
"eslint-plugin-vue": "^9.29.1",
"oxlint": "^0.10.2",
"prettier": "^3.3.3",
"typescript": "~5.6.0"
}
Expand Down
91 changes: 91 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eeb25ea

Please sign in to comment.