typescript 项目中 Cannot read file 'tsconfig.json' .eslint
当项目不在vscode打开的根目录时,eslint可能会报这个错误: Cannot read file 'tsconfig.json' .eslint
因为eslint默认在根目录寻找 tsconfig.json
可配置 .eslint.js 解决问题
module.exports = {
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
tsconfigRootDir: __dirname,
createDefaultProgram: true,
},
};