Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error gutter doesn't show up when local eslintrc file exists. #194

Closed
towry opened this issue Oct 6, 2015 · 5 comments
Closed

Error gutter doesn't show up when local eslintrc file exists. #194

towry opened this issue Oct 6, 2015 · 5 comments

Comments

@towry
Copy link

towry commented Oct 6, 2015

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.

@benekastah
Copy link
Collaborator

What's the raw eslint output with and without the eslintrc?

@towry
Copy link
Author

towry commented Oct 7, 2015

@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: eslint/eslint#1238 (comment)

@benekastah
Copy link
Collaborator

Yes you can. This should do it:

let g:neomake_javascript_eslint_exe = './node_modules/.bin/eslint'

@foray1010
Copy link

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

@towry
Copy link
Author

towry commented Nov 2, 2015

@foray1010 Brilliant! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants