fix(lsp): readd eslint condition
This commit is contained in:
parent
cb27724cc7
commit
2f6ddcce43
1 changed files with 12 additions and 1 deletions
|
@ -4,17 +4,28 @@ local config = require('cosmic.config')
|
|||
local null_ls = require('null-ls')
|
||||
|
||||
local config_opts = config.lsp.servers.null_ls or {}
|
||||
local has_eslint_config = function(u)
|
||||
return u.root_has_file('.eslintrc')
|
||||
or u.root_has_file('.eslintrc.json')
|
||||
or u.root_has_file('.eslintrc.js')
|
||||
or u.root_has_file('package.json')
|
||||
or u.root_has_file('.eslintrc.cjs')
|
||||
or u.root_has_file('.eslintrc.yaml')
|
||||
or u.root_has_file('.eslintrc.yml')
|
||||
end
|
||||
|
||||
require('null-ls').setup(utils.merge({
|
||||
-- you must define at least one source for the plugin to work
|
||||
sources = {
|
||||
null_ls.builtins.code_actions.eslint_d.with({
|
||||
condition = has_eslint_config,
|
||||
prefer_local = 'node_modules/.bin',
|
||||
}),
|
||||
null_ls.builtins.diagnostics.eslint_d.with({
|
||||
condition = has_eslint_config,
|
||||
prefer_local = 'node_modules/.bin',
|
||||
}),
|
||||
null_ls.builtins.formatting.eslint_d.with({
|
||||
condition = has_eslint_config,
|
||||
prefer_local = 'node_modules/.bin',
|
||||
}),
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
|
|
Loading…
Add table
Reference in a new issue