I want to lint ts file with Gatsby's native support. #29766
Unanswered
TatsuyaYamamoto
asked this question in
Ideas / Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
My idea is changing webpack config to support linting TypeScript with built-in ESLint setup.
https://github.com/gatsbyjs/gatsby/blob/gatsby%402.32.0/packages/gatsby/src/utils/webpack-utils.ts#L491
I read the following docs.
TypeScript and Gatsby
Using ESLint
As it's written, Gatsby transpiles ts file if I just change file to
.tsx
.It's very convenience.
On the other hand, Gatsby's built-in ESLint setup doesn't lint ts(x) file.
Maybe it's because webpack passes js files only to eslint-loader.
https://github.com/gatsbyjs/gatsby/blob/gatsby%402.32.0/packages/gatsby/src/utils/webpack-utils.ts#L491
I need create local
.eslintrc.js
to lint ts(x) file.It means to turn off Gatsby's built-in ESLint setup(loader and config).
Gatsby's built-in ESLint config extends
eslint-config-react-app
so it's can lint ts file.In addition, it pass GraphQLSchema to ESLint.
I think that for most users it's better to use built-in config than customizing to lint ts file: install plugin, write local
.eslintrc.js
, load graphql's schema, .......It seems to be the same policy in v3, so I created a discussion because I wanted to know Gatsby's policy.
Beta Was this translation helpful? Give feedback.
All reactions