Eslint language server extension for coc.nvim.
Forked from vscode-eslint.
In your vim/neovim run the following command:
:CocInstall coc-eslint
- Lint
javascript
files using eslint. - Provide
codeActions
for fixing lint issues. - Provide eslint commands:
eslint.createConfig
create eslint config file.eslint.executeAutofix
fix all fixable issues of current buffer.
Notice these configuration settings allow you to configure the behaviour of the coc-eslint extension.
eslint.enable
: enable/disable ESLint. This is enabled by default.eslint.quiet
- ignore warnings.eslint.runtime
- use this setting to set the path of the node runtime to run ESLint under.eslint.packageManager
: controls the package manager to be used to resolve the ESLint library. This has only an influence if the ESLint library is resolved globally. Valid values are"npm"
or"yarn"
.eslint.options
: options to configure how ESLint is started using the ESLint CLI Engine API. Defaults to an empty option bag. An example to point to a custom.eslintrc.json
file is:{ "eslint.options": { "configFile": "C:/mydirectory/.eslintrc.json" } }
eslint.run
- run the linteronSave
oronType
. The Default isonType
.eslint.nodeEnv
- use this setting if an ESLint plugin or configuration needsprocess.env.NODE_ENV
to be defined.eslint.autoFixOnSave
- enables auto fix on save.eslint.autoFixSkipRules
- rules that shouldn't be autofixed.eslint.eslintBin
- if you want to use eslint_d set this config to eslint_deslint.nodePath
- use this setting if an installed ESLint package can't be detected. For example/myGlobalNodePackages/node_modules
.eslint.filetypes
- an array of language identifiers specifying the files to be validated.eslint.codeAction.disableRuleComment
- object with properties:enable
- show disable lint rule in the quick fix menu.true
by default.location
- choose to either add theeslint-disable
comment on theseparateLine
orsameLine
.separateLine
is the default. Example:
{ "enable": true, "location": "sameLine" }
eslint.codeAction.showDocumentation
- object with properties:enable
- show open lint rule documentation web page in the quick fix menu.true
by default.
The extension supports automatic fixing of warnings to the extent that it is supported by eslint. For warnings which support an auto-fix. You can apply the quick fix by either:
- Set
eslint.autoFixOnSave
totrue
and save your file (recommended). - Trigger
<Plug>(coc-codeaction)
with mapped keys, and select a fix action in the input list. - Run command
:CocCommand eslint.executeAutofix
. - Trigger command
eslint.executeAutofix
from:Denite coc-command
.
MIT