【问题标题】:Eslint - File ignored because of a matching ignore patternEslint - 由于匹配的忽略模式而忽略了文件
【发布时间】:2022-12-07 13:48:29
【问题描述】:

当我跑eslint package/**/*.ts **/*.ts

得到这个警告:

  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override

/home/njfamirm/One/package/util/index.d.ts
  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override

/home/njfamirm/One/package/util/persian-number.d.ts
  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override

我的猜测是 *.ts 包含 *.d.ts 文件,因为我忽略了 .eslintignore 中的 *.d.ts 格式

.eslintignore

*.js
*.mjs
*.map
*.d.ts
node_modules/

ts-lint.json

{
  "compilerOptions": {
    "incremental": true,
    "target": "ESNEXT",
    "module": "ESNEXT",
    "lib": ["ESNEXT", "DOM", "DOM.Iterable"],
    "declaration": true,
    "composite": true,
    "importHelpers": true,
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "skipLibCheck": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  },
  "include": ["demo/**/*.ts", "package/**/*.ts"],
  "exclude": [],
  "compileOnSave": false
}

.eslintrc.yml

my Project

提前致谢

【问题讨论】:

    标签: typescript eslint tslint


    【解决方案1】:

    在 eslint 命令中使用引号启用 glob 模式搜索:

    例如:

    eslint "package/**/*.ts" "**/*.ts"
    

    【讨论】:

      猜你喜欢
      • 2020-01-16
      • 1970-01-01
      • 2021-10-20
      • 2016-06-04
      • 2020-05-28
      • 2011-12-18
      • 2012-07-10
      • 1970-01-01
      • 2015-09-04
      相关资源
      最近更新 更多