问题描述
nest,按照官方文档走的, 刚搭好得的框架,每个文件开头报错了,但是能运行起来,只不过有个爆红看着属实不舒服
Parsing error: Cannot read file 'c:\users\xxx\desktop\demo\tsconfig.json'
解决方法
.eslintrc.js
文件下新增
parserOptions: {
tsconfigRootDir: __dirname,
}
这是我的.eslintrc.js
文件
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};