Giter VIP home page Giter VIP logo

Comments (9)

blueyed avatar blueyed commented on May 25, 2024

It appears to process some output according to the log file.
Check with :lopen if it is maybe only not recognized properly etc.
(sorry, I've only skimmed this quickly, thanks for the info so far regardless)

from neomake.

gingerlime avatar gingerlime commented on May 25, 2024

Thanks @blueyed !

:lopen does show something, but I also noticed that it points to a different path (spec/javascripts/) than the actual file (app/javascript) so perhaps that's related?

CleanShot 2021-09-11 at 15 45 35

from neomake.

blueyed avatar blueyed commented on May 25, 2024

Yes, certainly.

I suggest looking at the log and the code: the output has "filePath":"<text>", which gets uses as filename (

\ 'filename': file_data.filePath,
), which is certainly strange already.

This results in a new buffer (check :ls!), named <text> then.

This is likely triggered by using --stdin, which you've configured manually probably.
This should get handled by supports_stdin (

function! maker.supports_stdin(_jobinfo) abort
let self.args += ['--stdin', '--stdin-filename=%:p']
let self.tempfile_name = ''
return 1
endfunction
) - try to figure out why this is not used/working.

from neomake.

blueyed avatar blueyed commented on May 25, 2024

Are you re-defining/copying g:neomake_javascript_eslint_maker?
Check that its supports_stdin uses/adds --stdin-filename also.

from neomake.

gingerlime avatar gingerlime commented on May 25, 2024

Thanks a bunch @blueyed. I changed my config to

let g:neomake_javascript_eslint_args = ['exec', '-T', 'webpacker', 'npx', 'eslint', '--stdin', '--stdin-filename=%:p'] + neomake#makers#ft#javascript#eslint().args

And it works... but somehow on another file, I'm not sure it's picking up my .eslintrc.yaml file? because I get an error that I don't normally get ...

I tried to add --config ./.eslintrc.yaml, e.g. let g:neomake_javascript_eslint_args = ['exec', '-T', 'webpacker', 'npx', 'eslint', '--stdin', '--stdin-filename=%:p', '--config ./.eslintrc.yaml'] + neomake#makers#ft#javascript#eslint().args but then I get a strange error:

14:47:51 12601 [V      ] [37.42:1:1] Starting async job: docker-compose exec -T webpacker npx eslint --stdin --stdin-filename=/path/to/my_file.js '--config eslintrc.yaml' --format=json.
14:47:51 12601 [D      ] [37.42:1:1] cwd: /var/local/kenhub/kenhub/spec/javascripts (changed).
14:47:51 12601 [D      ] [-.-:1:1] automake: started jobs: [42].
14:47:52 12601 [D +1.10] [37.42:1:1] output on stderr: ['Value for ''config'' of type ''path::String'' required.', ''].
14:47:52 12601 [D      ] [37.42:1:1] exit: eslint: 2.

(somehow the --config part of the params are quoted when executing eslint?? I'm really confused about what's happening here...)

from neomake.

gingerlime avatar gingerlime commented on May 25, 2024

Okay, problem solved eventually. I had to use --config=<path>. Here's my eslint config :)

let g:neomake_javascript_eslint_exe = 'docker-compose'
let g:neomake_javascript_eslint_args = ['exec', '-T', 'webpacker', 'npx', 'eslint', '--stdin', '--stdin-filename=%:p', '--config=./.eslintrc.yaml'] + neomake#makers#ft#javascript#eslint().args
let g:neomake_javascript_eslint_uses_stdin = 1
let g:neomake_javascript_eslint_uses_filename = 1
let g:neomake_javascript_eslint_append_file = 0

Thank you so much for your help!!

from neomake.

blueyed avatar blueyed commented on May 25, 2024

I'm glad we could solve it.
However I recommend trying to not override makers in general, if not necessary, which also includes its args etc, if not necessary.
It looks like you are doing this to prefix / wrap it with docker-compose, for what you could use a wrapper script (see #2411 (comment), where we had that topic already).. :)

Alternatively check :h neomake-makers-InitForJob, where it has an example to wrap/adjust/prefix the exe - which is meant to happen after any default supports-stdin handling etc.

from neomake.

gingerlime avatar gingerlime commented on May 25, 2024

Thanks again @blueyed ...

I tried to read the help doc you pointed to, but I have to admit (as I commented on #2411 (comment)), I don't really understand what to do instead. I can create a wrapper script, sure, but I think the main problem is that the paths inside the docker container and outside it are different, right? which means using stdin and somehow feeding the outside paths?

Are there any concrete canonical examples of how to configure things the right way? (ideally with eslint / rubocop if possible).

from neomake.

gingerlime avatar gingerlime commented on May 25, 2024

I played around with ALE, and in terms of configuration it seems to be a bit simpler to set up with docker? it relies on path mapping between where vim runs and where the linter does, so it looks like this

let b:ale_linters = ['rubocop', 'eslint']
let b:ale_ruby_rubocop_use_global = 1
let b:ale_javascript_eslint_use_global = 1
let b:ale_ruby_rubocop_executable = 'docker-compose -T web bundle exec rubocop'
let b:ale_javascript_eslint_executable = 'docker-compose -T webpacker npx eslint'
let b:ale_filename_mappings = {
     \  '*': [
     \    ['/local/vim/path', '/docker/path'],
     \  ],
     \ }

(the file mapping can be set on a per-linter basis as well)

from neomake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.