'Why is eslint giving this parse error in .eslintrc.js
I'm getting this strange error when trying to run eslint ./src --cache --fix. In my project:
0:0 error Parsing error: '{' expected
This is the contents of .eslintrc.js
module.exports = {
settings: {
react: {
version: 'detect'
}
},
env: {
browser: true,
es2021: true,
node: true
},
extends: [
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'prettier'
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 12,
sourceType: 'module'
},
plugins: ['react', '@typescript-eslint', 'prettier'],
rules: {
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-unnecessary-condition': 'warn'
},
parserOptions: {
project: ['./tsconfig.json', './.eslintrc.js']
}
}
It's almost as if eslint is expecting a json file but this is the file for a while so I don't understand what's wrong.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
