如何修复eslintrc文件与您的项目配置不匹配? [英] How to fix eslintrc The file does not match your project config?

查看:25
本文介绍了如何修复eslintrc文件与您的项目配置不匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的打字项目中,我使用eslint。下面的文件在根目录下,我还有子文件夹/dist/src

eslintrc.js

module.exports = {
  root: true,
  parser: '@typescript-eslint/parser',
  parserOptions: {
    tsconfigRootDir: __dirname,
    project: ['./tsconfig.json'],
  },
  rules: {
    strict: 'error',
    semi: ['error', 'always'],
    'no-cond-assign': ['error', 'always'],
  },
  plugins: ['@typescript-eslint'],
  extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:@typescript-eslint/recommended-requiring-type-checking',
  ],
}

tsconfig.json

{
  "compilerOptions": {
    "outDir": "dist",
    "noImplicitAny": true,
    "moduleResolution": "Node",
    "resolveJsonModule": true,
    "module": "ES2020",
    "target": "ES2020",
    "lib": ["ES2020"],
    "allowJs": false,
    "alwaysStrict": true
  },
  "include": ["src"]
}

顶部的module有一条红线,上面有此错误

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: .eslintrc.js.
The file must be included in at least one of the projects provided. eslint

我如何修复此问题?

推荐答案

更新您的eslintrc.js以包括:

忽略模式:[‘.eslintrc.js’]

这篇关于如何修复eslintrc文件与您的项目配置不匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆