Problem
I have a bunch of "Problems" in my VS Code PROBLEMS pane from eslint complaining about various JSON issues with my .eslintrc. Linting the directory outside of VS Code does not show me .eslintrc issues. My .eslintrc and .eslintignore files are in my workspace directory (same location as my .vscode directory.
Things I have tried
I tried adding the following entries to my .eslintignore file:
**/.***/.eslintrc.eslintrc./.eslintrc
But none of them keep VS Code from showing errors both in the file editor as well as the PROBLEMS pane.
I have added the .eslintrc to the exclude files setting in VS Code and then activated the excluded files filter in the PROBLEMS pane but I don't want to hide the file from the EXPLORER pane.
Question
How can I force VS Code/ESLint/vscode-eslint/the culprit to ignore my .eslintrc while linting inside VS Code?
.eslintrc
{
extends: 'airbnb',
parser: 'babel-eslint',
plugins: [
'react',
'jest',
],
env: {
browser: true,
node: true,
es6: true,
jest/globals: true,
},
globals: {
LOGGING_ENDPOINT: false,
$: false,
beautify: false,
testContext: false,
page: false,
},
settings: {
react: {
pragma: 'h',
},
},
rules: {
import/no-extraneous-dependencies: 'off',
import/no-unresolved: ['error', { ignore: ['^react$', '^react-dom$'] }],
import/extensions: 'off',
react/react-in-jsx-scope: 'off',
no-underscore-dangle: 'off',
react/no-danger: 'off',
no-unused-vars: ['error', { varsIgnorePattern: 'React' }],
react/require-default-props: 'off',
function-paren-newline: 'off',
import/no-named-as-default: 'off',
object-curly-newline: 'off',
jest/no-focused-tests: 'error',
},
}
Thanks!
Solution
The issue was that my .eslintrc was in a weird JSON-esque format and, while ESLint was reading it fine, VS Code was telling me about all of the issues. Once I properly formatted it as JSON, VS Code stopped complaining.
.eslintignorefile? - A. Lamansky**/.*) works for me in my dev environment. Is your.eslintignorelocated in your root directory? If it's in a subfolder, eslint may not be able to find it. - A. Lamansky.eslintrc). I also just tried adding a code directory to the ignore and introducing a linter error. With the code dir entry, I don't see the error. Directly after saving the ignore file without the exclusion entry for the code dir with the linter error, I see the error show up without requiring a restart. So the ignore is working but for some reason not ignoring the.eslintrc. - Eric H., likes.eslintrc) by default, at least according to this github issue from 2018: github.com/eslint/eslint/issues/10341 . I then realized that the reason your.eslintignoreconfig "worked" for me is because my eslint install was already ignoring my dot files anyway. Which makes me wonder...is there some setting in your config that is explicitly overriding this apparent "default," even inadvertently? - A. Lamansky