I have .eslintignore right next to eslintrc.js
The ignore is simply this:
.eslintrc.js
dist/*
node_modules/*
out-tsc/*
However when I go into eslintrc.js I get this error:
Parsing error: ESLint was configured to run on `<tsconfigRootDir>/.eslintrc.js` using `parserOptions.project`: <tsconfigRootDir>/../../../../../../users/dstein/repositories/social-experiment/packages/site/tsconfig.json
However, that TSConfig does not include this file. Either:
- Change ESLint's list of included files to not include this file
- Change that TSConfig to include this file
- Create a new TSConfig that includes this file and include it in your parserOptions.project
See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file
The article it links to unsurprisingly says to use .eslintignore if you don't want to lint the file the error is on. Meanwhile, my TS config does not say to include any js files.
{
"compilerOptions": {
"target": "es2018",
"module": "esnext",
"moduleResolution": "node",
"noEmitOnError": true,
"lib": ["es2017", "dom"],
"strict": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"importHelpers": true,
"outDir": "out-tsc",
"sourceMap": true,
"inlineSources": true,
"rootDir": "./",
"incremental": true
},
"include": ["**/*.ts"],
}
Really bewildered why TS Config saying to only include ts files would have ESLint it was configured to run using parserOptions.project
The ESLint config is fairly straightforward (I will remove all the rules to save some reading here):
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
plugins: ['@typescript-eslint'],
env: {
es6: true,
browser: true,
},
extends: [
'@open-wc',
'eslint:recommended',
'plugin:import/recommended',
'prettier',
],
rules: {},
};
Add your eslint config file to the list of files to be ignored in the config itself.
Something like this:
ignorePatterns: ['dist', '.eslintrc.js', 'postcss.config.js'],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With