Welcome to @jellydn/eslint-fixer 👋
Prerequisites
- Node.js >= 18.20.0 or later
Motivation
We will continue to use @typescript-eslint/parser
and @typescript-eslint/eslint-plugin
to lint TypeScript files until this issue ☂️ Type-aware linter · Issue #3187 · biomejs/biome is resolved.
Enabled rules
The following rules are enabled to effectively lint TypeScript files:
{
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-redundant-type-constituents": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/require-await": "error"
}
Usage
npm install -g @jellydn/eslint-fixer
npx @jellydn/eslint-fixer "examples/**/*.ts,examples/**/*.tsx"
How to use with Neovim
To use eslint-fixer with lazy.nvim and nvim-lint, you should define as a custom linter:
return {
{
"mfussenegger/nvim-lint",
event = "VeryLazy",
opts = {
linters_by_ft = {
typescript = { "oxlint", "eslint_fixer" },
},
},
init = function()
require("lint").linters.eslint_fixer = {
name = "eslint_fixer",
cmd = "eslint-fixer",
stdin = false,
stream = "stdout",
ignore_exitcode = true,
parser = function(output, bufnr)
local trimmed_output = vim.trim(output)
if trimmed_output == "" then
return {}
end
if string.match(trimmed_output, "Parsing error") then
return {}
end
local diagnostic = require("lint.parser").from_errorformat("%f %l:%c %m", {
error = vim.diagnostic.severity.ERROR,
})(trimmed_output, bufnr)
return diagnostic
end,
}
end,
config = function(_, opts)
end,
},
}
GitHub Actions
To use eslint-fixer in GitHub Actions, follow these steps:
name: ESLint Fixer
on:
push:
branches:
- main
jobs:
eslint-fixer:
name: ESLint Fixer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npx --yes @jellydn/eslint-fixer@0.0.0 "examples/**/*.ts"
oxlint:
name: Lint JS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npx --yes oxlint@0.0.0 --deny-warnings
quality:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
version: latest
- name: Run Biome
run: biome ci .
How to publish
make release
Resources
Author
👤 Dung Huynh
Show your support
Give a ⭐️ if this project helped you!