Add oxlint, the faster eslint alternative
Features
- 50 - 100 times faster than ESLint, and scales with the number of CPU cores (benchmark).
- Over 200 rules with a growing list from eslint, typescript, eslint-plugin-react, eslint-plugin-jest, eslint-plugin-unicorn, and eslint-plugin-jsx-a11y.
- Supports
.eslintignore. - Supports ESLint comment disabling.
- Lint
<script>content of.vue,.astro,.sveltefiles by default.
For easier implementation I'm waiting for 1462 with this.
Happy to contribute toward this when the time comes.
The time has come!
https://github.com/oxc-project/oxc/issues/1462 has been merged.
Here is how I set up with my neovim. Just leave here if anyone want to take a try.
return {
{
"mfussenegger/nvim-lint",
opts = {
linters_by_ft = {
javascript = { "oxlint" },
typescript = { "oxlint" },
javascriptreact = { "oxlint" },
typescriptreact = { "oxlint" },
},
},
init = function()
-- Register oxlint, based on `lua/lint/linters/jshint.lua`
require("lint").linters.oxlint = {
name = "oxlint",
-- cargo install --features allocator --git https://github.com/oxc-project/oxc oxc_cli
cmd = "oxlint", // NOTE: this is using oxlint bin from cargo
stdin = false,
args = { "--format", "unix" },
stream = "stdout",
ignore_exitcode = true,
parser = require("lint.parser").from_errorformat("%f:%l:%c: %m", {
source = "oxlint",
severity = vim.diagnostic.severity.WARN,
}),
}
end,
},
}
Here is how I set up with my neovim. Just leave here if anyone want to take a try.
return { { "mfussenegger/nvim-lint", opts = { linters_by_ft = { javascript = { "oxlint" }, typescript = { "oxlint" }, javascriptreact = { "oxlint" }, typescriptreact = { "oxlint" }, }, }, init = function() -- Register oxlint, based on `lua/lint/linters/jshint.lua` require("lint").linters.oxlint = { name = "oxlint", -- cargo install --features allocator --git https://github.com/oxc-project/oxc oxc_cli cmd = "oxlint", // NOTE: this is using oxlint bin from cargo stdin = false, args = { "--format", "unix" }, stream = "stdout", ignore_exitcode = true, parser = require("lint.parser").from_errorformat("%f:%l:%c: %m", { source = "oxlint", severity = vim.diagnostic.severity.WARN, }), } end, }, }
What is interesting is if you try this in a vue SFC with the template tags before the script tags, oxlint is reporting the position of the warning offset from the top of the file in the template relative to where the setup tags start:
I guess this finally solves the debate of whether to put setup at the beginning or end of the file :rofl: