Help with ESLint diagnostics #75
-
Doesn't work in a TypeScript project. Once I comment out the commented lines, it works. {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"airbnb",
// "airbnb-typescript"
],
// "parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"project": "./tsconfig.json",
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint"
],
"rules": {
"no-param-reassign": "off",
"react/react-in-jsx-scope": "off",
"react/jsx-props-no-spreading": "off",
"react/require-default-props": "off"
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
If modifying your ESLint config fixes the issue, it's most likely related to ESLint itself. Does everything work when you run |
Beta Was this translation helpful? Give feedback.
-
Below is my directory tree, and my null-ls.log. It seems the error has to do with null-ls not being able to find Directory tree:
null-ls.log:
|
Beta Was this translation helpful? Give feedback.
-
Your guess is correct. null-ls uses I tried setting up a similar structure locally, and I think we can solve this with the new on_attach = function(client, bufnr)
require("nvim-lsp-ts-utils").setup({
eslint_opts = {
cwd = function(params)
return require("lspconfig.util").root_pattern("tsconfig.json")(params.bufname)
end,
},
})
end Can you update to the latest version of null-ls and see if that works? |
Beta Was this translation helpful? Give feedback.
Your guess is correct. null-ls uses
.git
as a root pattern marker and uses that as itscwd
when spawning processes. In this case ESLint isn't smart enough to search fortsconfig.json
upwards from the current file's path, so it errors out when it can't find one at the root.I tried setting up a similar structure locally, and I think we can solve this with the new
cwd
option that was just added to null-ls:Can you update to t…