Combine with a project already using typescript linting
See original GitHub issueI’m using .ts
files with gql
template strings to create my schema. But after adding the configuration for the .eslintrc
provided in the README
I start getting conflicts in my linting process on any .ts
file.
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src/index.ts/0_/Users/aj/Developer/apollo-base/src/index.ts.
The file must be included in at least one of the projects provided.
On the files part of the schema, instead the error message is:
Parsing error: Unable to find any GraphQL type definitions for the following pointers:
- src/server/schema/**/type-defs.ts
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: src/server/schema/user/type-defs.ts/1_/Users/aj/Developer/apollo-base/src/server/schema/user/type-defs.ts.
The file must be included in at least one of the projects provided.eslint
How do I incorporate graphql-eslint
in these cases in this type of project?
My complete .eslintrc
file is:
---
root: true
env:
es2020: true
node: true
extends:
- standard-with-typescript
- plugin:@typescript-eslint/recommended-requiring-type-checking
- prettier
- prettier/standard
- prettier/@typescript-eslint
- plugin:prettier/recommended
parser: '@typescript-eslint/parser'
parserOptions:
ecmaVersion: 11
sourceType: module
project: ./tsconfig.json
plugins:
- '@typescript-eslint'
rules: {}
overrides:
- files:
- "*.tsx"
- "*.ts"
- "*.jsx"
- "*.js"
processor: "@graphql-eslint/graphql"
- files:
- "*.graphql"
parser: "@graphql-eslint/eslint-plugin"
plugins:
- "@graphql-eslint"
rules:
eol-last: 'off'
prettier/prettier: 'off'
The tsconfig.json
file:
{
"extends": "@tsconfig/node14/tsconfig.json",
"compilerOptions": {
"incremental": true,
"rootDir": "src",
"outDir": "dist",
"declaration": true,
"declarationMap": true,
"sourceMap": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Typescript Eslint - How to Combine Them Together - YouTube
Learn how to combine Typescript Eslint in order to get best from both tools. It makes a lot of sense to combine Prettier...
Read more >Linting in TypeScript using ESLint and Prettier - LogRocket Blog
Integrate Prettier with ESLint to automate type-checking in your TypeScript code and ensure that the code has no bugs.
Read more >Typescript Eslint - How to Combine Them Together
In this post you will learn how you can configure Eslint together with Typescript. ... Here I already generated with a project with...
Read more >Advanced linting with Create React App, Typescript, and ESLint
This article explores setting up advanced linting in a Create React App using Typescript and ESLint.
Read more >Using ESLint and Prettier in a TypeScript Project
When it comes to linting TypeScript code, there are two major linting options to choose from: TSLint and ESLint. TSLint is a linter...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dotansimha thanks for looking into that. We are using
babel-eslint
parser. So had to follow the same configuration pattern you suggested to parse both ‘.js’ and ‘.graphql’ files.One more rule I had to turn off (that current graphql parser does not seem to play nice with in addition to
prettier
) isimport/no-unresolved
. So our config looks like:I think it works… though I provide you some more use cases…
Thanks, Diana
Sure thing, let me cook something minimal for this.