当我在盖茨比项目中运行eslint时,我得到了跟踪。
Oops! Something went wrong! :(
ESLint: 7.32.0
[ProjectNotFoundError: File '/home/path_to_project/somefile.ts' doesn't match any project] {
name: 'ProjectNotFoundError',
message: "File '/home/path_to_project/somefile.ts' doesn't match any project"
}我的.eslintrc
{
"extends": [
"react-app",
"plugin:jsx-a11y/recommended",
"prettier",
"plugin:tailwindcss/recommended"
// "airbnb"
],
"plugins": ["jsx-a11y"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": ["@/features/*/*"]
}
],
"tailwindcss/classnames-order": "error",
"tailwindcss/no-custom-classname": "error"
},
"settings": {
"tailwindcss": {
"groupByResponsive": true
}
},
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"processor": "@graphql-eslint/graphql",
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"env": {
"es6": true
}
},
{
"files": ["*.graphql"],
"parser": "@graphql-eslint/eslint-plugin",
"plugins": ["@graphql-eslint"],
"rules": {
"@graphql-eslint/no-anonymous-operations": "error",
"@graphql-eslint/naming-convention": [
"error",
{
"OperationDefinition": {
"style": "PascalCase",
"forbiddenPrefixes": ["Query", "Mutation", "Subscription", "Get"],
"forbiddenSuffixes": ["Query", "Mutation", "Subscription"]
}
}
]
}
}
]
}.eslintignore
node_modules/
.cache/
public/
.idea/
yarn-error.log
.yarn/在.eslintrc中注释掉下面的部分修复了这个问题,但是我希望保留这个部分,以前该部分的工作情况很好。不知道出了什么问题,因为ESLint提供的错误消息非常模糊。
{
"files": ["*.ts", "*.tsx"],
"processor": "@graphql-eslint/graphql",
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"env": {
"es6": true
}
},更新
问题似乎是由以下原因造成的,因为注释它修正了错误。
"processor": "@graphql-eslint/graphql",发布于 2022-10-02 06:49:53
我之前使用了盖茨比的GraphQL型,因为它的特性(重新生成循环和.cache错误)禁用了它,方法是注释掉graphql.config.js并从gatsby-config.ts中删除graphqlTypegen: true,
根据石墨eslint
如果要在代码文件中定义GraphQL模式或GraphQL操作,则需要定义额外的覆盖,以将此插件的功能扩展到这些文件中的模式和操作。 {“重写”:[+{+“文件”:"*.js",+“处理器”:"@graphql-eslint/graphql“+ }
禁用GraphQL Typegen似乎会导致"processor": "@graphql-eslint/graphql" of eslint override中提到的错误。
https://stackoverflow.com/questions/73923734
复制相似问题