On creating a better method to extend the default ESLint configuration #32122
Unanswered
kelvindecosta
asked this question in
Ideas / Feature Requests
Replies: 1 comment 1 reply
-
Does eslint-plugin-gatsby currently maintained? Is it possible to request ownership for the package if it is not maintained? can it go to PS. I'm definitely overriding default |
Beta Was this translation helpful? Give feedback.
1 reply
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Overview
The experienced Gatsby user and React dev would have realized that extending Gatsby's default ESLint configuration is a bit tedious.
Creating a new
.eslintrc.js
file completely overwrites the default configuration.Moreover, Gatsby stops logging out linting warnings during the development phase.
To combat this, the official documentation recommends copying and pasting the entire configuration and installing a community plugin (which is not actively maintained).
This is not a scalable method, especially when these default rules change as new features are added to Gatsby.
I created
gatsby-plugin-eslint-config
that solves this issue.I describe how the plugin uses the default ESLint configuration provided by Gatsby and how users can extend it.
Features
This plugin recommends the default configuration and provides the definitions for Gatsby's custom rules.
This plugin can be added in
.eslintrc.js
along with the recommended configuration as follows:You can add your own rules to
.eslintrc.js
as usual.The
eslint-webpack-plugin
would be required to lint files during thedevelopment
state.This can be done using Gatsby's Node API.
This plugin should also be added in
gatsby-config.js
.Conclusion
In the installation instructions, I recommend using an alias
eslint-plugin-gatsby
.This will be an issue only if you use the unrelated
eslint-plugin-gatsby
(for which you can create another alias if needed).IMHO this plugin is no more a Gatsby plugin than it is an ESLint plugin.
It's more like a bridge between the two.
Any feedback would be appreciated!
Thank you for your time.
Beta Was this translation helpful? Give feedback.
All reactions