-
Notifications
You must be signed in to change notification settings - Fork 69
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
Solved switching between projects with and without flat config #288
Comments
wish I knew how to do a manual install on nvim. using mason for now, still a lot to learn, gonna upvote your PR, hopefully I can get it to work soon |
I am just manually downloading my repo with the fix if it doesn't exist when local eslint_d_repo_path = vim.fn.stdpath 'data' .. '/eslint_d_patched'
if not vim.loop.fs_stat(eslint_d_repo_path) then
local eslint_d_repo = 'https://github.com/kommander/eslint_d.js'
vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=override-core-d-options', eslint_d_repo, eslint_d_repo_path }
vim.fn.system { 'npm', 'install', '--prefix', eslint_d_repo_path }
end (Note: This is synchronous, so it blocks everything the first time, didn't bother making it async for now) Then I just override the command and env in the setup (same thing can be done for the builtins in local cmd_name = vim.fn.fnamemodify(eslint_d_repo_path .. '/bin/eslint_d.js', ':p')
null_ls.setup {
sources = {
require('none-ls.code_actions.eslint_d').with {
command = cmd_name,
env = env,
},
require('none-ls.diagnostics.eslint_d').with {
command = cmd_name,
env = env,
},
...
},
} The repo does not have to be downloaded automatically in the config like this, you can also just manually clone the repo somewhere locally and point |
This is probably obsolete with the new major |
I use nvim btw. Just though I'd share this here, as this was really annoying me and I spent quite some time getting it to work. I have to switch between projects with different setups and some are using the flat config already, some are not. Here's how I solved that:
In my
lint.lua
config I manually download and setup my fork branch with these two lines changes in/bin/eslint_d.js
:> Branch is here <
To setup
nvim-lint
, at startup I then check for existence ofeslint.config.js
in cwd and override the env that eslint_d is called in, to get a separate daemon starting up with ESLINT_USE_FLAT_CONFIG enabled.nvim-lint
overrides the whole env and the additional variables are needed, otherwise it just does nothing and returns nothing.Not the prettiest solution, but easiest and works wonders for my setup and blood pressure.
Anyway this option could go into a release so I can use the toolchain without manual installs again? @mantoni
Disclaimer: I didn't look into core_d yet and what the effect of using different daemons is here, but it works well for me and I only have the
eslint_d
andeslint_d_flat
daemons running at all times and so far nothing got stuck on quite large projects.The text was updated successfully, but these errors were encountered: