Neomake: Error gutter doesn't show up when local eslintrc file exists.

Created on 6 Oct 2015  路  5Comments  路  Source: neomake/neomake

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.

Most helpful comment

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', '')

All 5 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ManiacalAce picture ManiacalAce  路  7Comments

iwyg picture iwyg  路  6Comments

sakhnik picture sakhnik  路  5Comments

pengowen123 picture pengowen123  路  6Comments

nhooyr picture nhooyr  路  6Comments