首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >类型记录和javascript混合项目的更漂亮的AutoFormatting错误

类型记录和javascript混合项目的更漂亮的AutoFormatting错误
EN

Stack Overflow用户
提问于 2020-01-16 07:15:22
回答 1查看 1.4K关注 0票数 1

我是,向现有的javascript项目添加类型记录。这是一个大规模的项目,所以我决定一步一步地将项目转换成类型记录。

这是我的eslintrc.js文件

代码语言:javascript
复制
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']
};

问题是保存,更漂亮的应该格式化我的代码。但事实并非如此

这是我更漂亮的日志的输出

代码语言:javascript
复制
["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。

EN

回答 1

Stack Overflow用户

发布于 2020-05-14 11:01:52

禁用vscode更漂亮的扩展解决了我的问题。那个扩展和我更漂亮的设置有冲突。希望扩展开发团队很快就能解决这个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59764621

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档