我是,向现有的javascript项目添加类型记录。这是一个大规模的项目,所以我决定一步一步地将项目转换成类型记录。
这是我的eslintrc.js文件
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'airbnb-typescript/base', // Airbnb style guide
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
'prettier/@typescript-eslint' // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
],
parserOptions: {
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module' // Allows for the use of imports
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
}
},
rules: {
// some rules here
},
plugins: ['prettier']
};问题是保存,更漂亮的应该格式化我的代码。但事实并非如此
这是我更漂亮的日志的输出
["ERROR" - 12:34:20 PM] Error formatting document.
Failed to load plugin '@typescript-eslint' declared in 'CLIOptions': Cannot find module '@typescript-eslint/eslint-plugin'我试着运行npm install @typescript-eslint --save-dev。但没有运气
如何优化我的eslintrc以解决这个问题。提醒:我应该能够使用这种配置与类型记录和javascript。
发布于 2020-05-14 11:01:52
禁用vscode更漂亮的扩展解决了我的问题。那个扩展和我更漂亮的设置有冲突。希望扩展开发团队很快就能解决这个问题。
https://stackoverflow.com/questions/59764621
复制相似问题