-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
eslint_d unable to recognize the 9.x version of the configuration file #610
Comments
I was having the same issue ! I realised when reading the README of the
I guess a fix would be to add the option to add this environment variable when running the linter. I'm just arriving here to this repo, I'll try to understand how it works and make a PR if it could help ! |
Ok some discoveries about the issue and how to solve it ! As described on the repo of For that you need to run
Then after restarting Neovim, you should probably run into some errors about not finding the config file for your project. You can solve it by configuring the Here is my configuration that works : return {
'mfussenegger/nvim-lint',
event = { 'BufReadPre', 'BufNewFile' },
config = function()
local lint = require 'lint'
lint.linters_by_ft = {
javascript = { 'eslint_d' },
javascriptreact = { 'eslint_d' },
typescript = { 'eslint_d' },
typescriptreact = { 'eslint_d' },
}
local eslint_d = require 'lint.linters.eslint_d'
eslint_d.args = vim.tbl_extend('force', {
'--config',
function()
return vim.fn.getcwd() .. '/eslint.config.js'
end,
}, eslint_d.args)
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
end,
} Let me know if it works for you, and if it doesn't I'll be happy to help ! If someone reads this and has a solution to avoid restarting the process by hand I would really like to hear about it ! |
Thank you for your contribution, but it doesn't seem to work for my project. The error message still exists. |
When you work on your project, do you open neovim in the directory that is the root of your project, and that contains your |
worked for me! But of course if you are switching projects then it wont work for < 9. Thanks!!! |
Hello! Well I have same problem, and I have project mono repo type, so my eslint.config.js is in vim.fn.getcwd() .. '/app-frontend/eslint.config.js' |
For anyone still fighting with this issue, it may not be an This is useful in monorepos where the file structure of vim.env.ESLINT_D_PPID = vim.fn.getpid()
vim.env.ESLINT_D_ROOT = "/path/to/my/monorepo/root"
require("lint").linters_by_ft = {
typescript = { "eslint_d" },
javascript = { "eslint_d" },
typescriptreact = { "eslint_d" },
javascriptreact = { "eslint_d" },
}
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function()
require("lint").try_lint()
end,
}) |
Uh, somebody could've @-mentioned me here 😉. With the rewrite of There is also a new Please upgrade and let me know if this is still an issue. 🙏 |
Could not parse linter output due to: Expected value but found invalid token at character 1
output: Error: No ESLint configuration found in /Users/dccd/Desktop/item/front/vauch/src.
it's ok to use .eslintrc.json, but i do not want to use the legacy cofiguration file. 😭
The text was updated successfully, but these errors were encountered: