Improve custom eslint integration #23666
Replies: 3 comments 4 replies
-
@askibinski , I've also found this confusing, however, I haven't had even as much success as you. |
Beta Was this translation helpful? Give feedback.
-
@askibinski, I completely agree with this. Extending the base configuration can be extremely frustrating. Firstly, Gatsby updates the base configuration quite often. Even if you did copy their config, it would get outdated soon. It would be really convenient if Gatsby could extend the |
Beta Was this translation helpful? Give feedback.
-
OverviewHello @askibinski, @KyleAMathews, @daledesilva I think I might have figured out how to properly extend most of Gatsby's default ESLint configuration. Configuration
|
Beta Was this translation helpful? Give feedback.
-
I had some trouble with a custom eslint configuration. @KyleAMathews helped me out on Slack and asked me to file an issue to make this easier.
Summary
Gatsby supports using a custom eslint config. The steps are described in the documentation page. However, when you use your own configuration
.eslintrc.js
file you will lose the build integration witheslint-loader
. This will prevent any warnings from apearing in the terminal.To be fair, this is described in the manual page with a note, and there is a link to a plugin you can use to get the integration back using webpack, but even then it is quite a hassle to get the same rules Gatsby uses back in your own config (in addition to your own config).
Basic example
gatsby develop
. (for me it was avideo
tag without a subtitlestrack
which will trigger a warning fromjsx-a11y/media-has-caption
..eslintrc
and add back the rules from gatsby.Motivation
It would be nice if you could more easily extend Gatsby's eslint config instead of throwing it away and build your own for scratch which leads to unexpected behavior. This is especially cumbersome if you just need one rule added or changed.
Beta Was this translation helpful? Give feedback.
All reactions