Skip to content

feat(pack): add eslint #1503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
14 changes: 14 additions & 0 deletions lua/astrocommunity/pack/eslint/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ESLint

[ESLint](https://eslint.org/) is a tool for identifying and reporting on
patterns found in ECMAScript/JavaScript code, with the goal of making code more
consistent and avoiding bugs.

ESLint is completely pluggable. Every single rule is a plugin and you can add
more at runtime. You can also add community plugins, configurations, and
parsers to extend the functionality of ESLint.

## Prerequisites

To use ESLint, you must have [Node.js](https://nodejs.org/en/) (^18.18.0, ^20.9.0, or >=21.1.0) installed
and built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.)
44 changes: 44 additions & 0 deletions lua/astrocommunity/pack/eslint/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---@type LazySpec
return {
{
"williamboman/mason-lspconfig.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed or {}, { "eslint" })
end,
},
{
"WhoIsSethDaniel/mason-tool-installer.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed or {}, { "eslint-lsp" })
end,
},
{
"echasnovski/mini.icons",
optional = true,
opts = function(_, opts)
opts.file = opts.file or {}
local eslint_files = {
-- ESLint <=8 (Deprecated)
".eslintignore",
".eslintrc",
".eslintrc.cjs",
".eslintrc.js",
".eslintrc.json",
".eslintrc.yaml",
".eslintrc.yml",
-- ESLint >=9
"eslint.config.cjs",
"eslint.config.cts",
"eslint.config.js",
"eslint.config.mjs",
"eslint.config.mts",
"eslint.config.ts",
}
for _, filename in ipairs(eslint_files) do
opts.file[filename] = { glyph = "󰱺", hl = "MiniIconsYellow" }
end
end,
},
}