Spacevim: neomake not use local eslint or other local node_module

Created on 31 May 2018  路  10Comments  路  Source: SpaceVim/SpaceVim

Expected behavior, english is required

local eslint can be used defined in package.json

The reproduce ways from Vim starting (Required!)

Debug info

Please press SPC h I, debug info will be put into clipboard, then paste all content below.

Screenshots

If you have any screenshots for this issue, please upload here. BTW you can use https://asciinema.org/ for recording video in terminal.

image

I tried

this issue is the same as https://github.com/neomake/neomake/issues/247
I has add nrun in init.toml , it works well

init.toml

...
[options]
    bootstrap_after =  "myspacevim#after"
...

[[custom_plugins]]
  name = 'jaawerth/nrun.vim'

myspacevim.vim

function! myspacevim#after() abort
  let g:neomake_javascript_eslint_exe = nrun#Which('eslint')
endfunction

image

discussion

Most helpful comment

@aizigao @wsdjeg
There're 4 kind of eslint executables:

  1. eslint-cli installed globally
  2. eslint installed globally
  3. eslint-cliinstalled to a project
  4. eslint installed to a project

All of them includes eslint executable, and the one with eslint-cli internally invokes eslint installed to a project. So when you use ESLint, it is recommended to do:

  1. Install eslint-cli globally
  2. Install eslint and other presets to the project

All 10 comments

  1. Use eslint-cli instead of eslint
    npm i -g eslint-cli
    eslint-cli will create a global eslint preferring the local eslint.

  2. There is a bug when ../bin/eslint.js exists, but that only happens when you are trying to contribute in eslint/eslint

@zhujinxuan Is this issue a bug, any change need to be done in spacevim?

We need to update the document to let user to install eslint-cli globally.

not only eslint, I think neomake should support local libs, not all users want to install these libs globally.

Oh, I misunderstood your mention of bug. I mean there exists a bug when you develop with repo eslint/eslint, which does not have the node_modules/.bin./eslint (because this package provides eslint)

I think eslint-cli works well in most other cases. I think perhaps we can ask neomake about whether they will accept a PR to support local linter by an option.

@zhujinxuan @sei40kr I am really confused about the eslint config in js layer.

in https://github.com/SpaceVim/SpaceVim/pull/1257 we add local eslint support, but in https://github.com/SpaceVim/SpaceVim/pull/1437 we remove this feature.

@aizigao @wsdjeg
There're 4 kind of eslint executables:

  1. eslint-cli installed globally
  2. eslint installed globally
  3. eslint-cliinstalled to a project
  4. eslint installed to a project

All of them includes eslint executable, and the one with eslint-cli internally invokes eslint installed to a project. So when you use ESLint, it is recommended to do:

  1. Install eslint-cli globally
  2. Install eslint and other presets to the project

I agree with @aizigao . #1257 is un-necessary if we suggest users to install eslint-cli globally. eslint-cli is maintained by the eslint officially, so I think it is a reliable option.

Ok, got it.

install eslint-plugin-html needed to your project for your vue layer

Was this page helpful?
0 / 5 - 0 ratings