@graphql-eslint/eslint-plugin does not work with frolint cli
Why
In the following .eslintrc, use yarn eslint . /src will work, but yarn frolint -branch master -bail will raise an error.
.eslintrc
{
"overrides": [
{
"files": [
"*.tsx",
"*.ts"
],
"extends": "wantedly-typescript",
"parserOptions": {
"project": [
"./tsconfig.json",
"./tsconfig.eslint.json"
]
}
},
{
"files": [
"*.tsx",
"*.ts"
],
"processor": "@graphql-eslint/graphql"
},
{
"files": [
"./src/profile/components/profile/Sidebar/RelatedUsers/**/*.graphql"
],
"parser": "@graphql-eslint/eslint-plugin",
"parserOptions": {
"schema": "./graphql-gateway-schema.json"
},
"plugins": [
"@graphql-eslint"
],
"rules": {
"@graphql-eslint/fields-on-correct-type": [
"error"
]
}
}
]
}
Internal Error: Error while loading rule '@typescript-eslint/no-floating-promises': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.
Occurred while linting /path/to/project/src/path/to/Component.tsx/0_document.graphql
What
cc @prsdta @tkeiyama
So we may need an option to turn off rules that require type-aware linting?
So we may need an option to turn off rules that require type-aware linting?
Indeed, just changing the rules to
"rules": {
"@graphql-eslint/fields-on-correct-type": ["error"],
"@typescript-eslint/no-floating-promises": "off"
}
seems to fix the error. But I would like something more future-proof that does not require to disable manually all rules 🤔
@graphql-eslint also seems to use typescript-eslint internally, so we shouldn't need to disable it all.
It seems to be more an issue with applying our default rules with the graphql-eslint parser.
See this comment in a related issue: https://github.com/dotansimha /graphql-eslint/issues/544#issuecomment-891948697
Nope, it's important that you don't have any rules configured at top level config, and to move all configurations into overrides section. Since JavaScript rules can't run on GraphQL files and vice versa, if you have rules configured at the top level, they will try to also execute for all overrides, as ESLint's configs cascade.