File tree 2 files changed +74
-0
lines changed
2 files changed +74
-0
lines changed Original file line number Diff line number Diff line change
1
+ # ESLint
2
+
3
+ [ ESLint] ( https://eslint.org/ ) ESLint is a tool for identifying and reporting on
4
+ patterns found in ECMAScript/JavaScript code, with the goal of making code more
5
+ consistent and avoiding bugs.
6
+
7
+ ESLint is completely pluggable. Every single rule is a plugin and you can add
8
+ more at runtime. You can also add community plugins, configurations, and
9
+ parsers to extend the functionality of ESLint.
10
+
11
+ ## Prerequisites
12
+
13
+ To use ESLint, you must have [ Node.js] ( https://nodejs.org/en/ ) (^18.18.0, ^20.9.0, or >=21.1.0) installed
14
+ and built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.)
15
+
16
+ ## How do I disable Eslint format on save?
17
+
18
+ To opt out of the Eslint format on save behaviour, you can disable the autocmd setup with the pack with this:
19
+
20
+ ``` lua
21
+ return {
22
+ " AstroNvim/astrolsp" ,
23
+ optional = true ,
24
+ opts = {
25
+ autocmds = {
26
+ eslint_fix_on_save = false ,
27
+ },
28
+ },
29
+ }
30
+ ```
Original file line number Diff line number Diff line change
1
+ return {
2
+ {
3
+ " AstroNvim/astrolsp" ,
4
+ optional = true ,
5
+ --- @type AstroLSPOpts
6
+ opts = {
7
+ autocmds = {
8
+ eslint_fix_on_save = {
9
+ cond = function (client ) return client .name == " eslint" and vim .fn .exists " :EslintFixAll" > 0 end ,
10
+ {
11
+ event = " BufWritePost" ,
12
+ desc = " Fix all eslint errors" ,
13
+ callback = function (args )
14
+ if vim .F .if_nil (vim .b [args .buf ].autoformat , vim .g .autoformat , true ) then vim .cmd .EslintFixAll () end
15
+ end ,
16
+ },
17
+ },
18
+ },
19
+ },
20
+ },
21
+ {
22
+ " williamboman/mason-lspconfig.nvim" ,
23
+ optional = true ,
24
+ opts = function (_ , opts )
25
+ opts .ensure_installed = require (" astrocore" ).list_insert_unique (opts .ensure_installed or {}, { " eslint" })
26
+ end ,
27
+ },
28
+ {
29
+ " WhoIsSethDaniel/mason-tool-installer.nvim" ,
30
+ optional = true ,
31
+ opts = function (_ , opts )
32
+ opts .ensure_installed = require (" astrocore" ).list_insert_unique (opts .ensure_installed or {}, { " eslint-lsp" })
33
+ end ,
34
+ },
35
+ {
36
+ " echasnovski/mini.icons" ,
37
+ optional = true ,
38
+ opts = function (_ , opts )
39
+ if not opts .file then opts .file = {} end
40
+ opts .file [" .eslintrc.js" ] = { glyph = " " , hl = " MiniIconsYellow" }
41
+ opts .file [" eslint.config.js" ] = { glyph = " " , hl = " MiniIconsYellow" }
42
+ end ,
43
+ },
44
+ }
You can’t perform that action at this time.
0 commit comments