the local eslintrc file is:
{
"extends": "eslint-config-airbnb",
"env": {
"es6": true,
"jasmine": true
},
"plugins": [
"react"
],
"rules": {
"no-unused-vars": 1,
"jsx-quotes": [1, "prefer-double"],
"react/jsx-no-undef": 2,
"react/jsx-uses-react": 2,
}
}
When I run Neomake in this workplace, the error gutter doesn't show up on neovim, it works fine if i rename the eslintrc file.
What's the raw eslint output with and without the eslintrc?
@benekastah
It says can not found the module eslint-config-airbnb. So, I have to run the locally installed version of eslint, not the globally installed one. If I run ./node_modules/.bin/eslint ., the output is good. but if I run eslint ., there will be a module not found error. Can I make Neomake run the eslint from the locally one?
Update: eslint needs some plugins to work, but the global eslint can't found the locally installed plugins. See: https://github.com/eslint/eslint/issues/1238#issuecomment-55027684
Yes you can. This should do it:
let g:neomake_javascript_eslint_exe = './node_modules/.bin/eslint'
You probably not always call nvim in the project root, so directly calling to ./node_modules/.bin/eslint may fail, here is the solution
let g:neomake_javascript_enabled_makers= ['eslint']
" load local eslint in the project root
" modified from https://github.com/mtscout6/syntastic-local-eslint.vim
let s:eslint_path = system('PATH=$(npm bin):$PATH && which eslint')
let g:neomake_javascript_eslint_exe = substitute(s:eslint_path, '^\n*\s*\(.\{-}\)\n*\s*$', '\1', '')
@foray1010 Brilliant! Thanks.
Most helpful comment
You probably not always call
nvimin the project root, so directly calling to./node_modules/.bin/eslintmay fail, here is the solution