Closed AndrewLeedham closed 4 years ago
@AndrewLeedham Hi, I have been facing the same issue. Possible solutions I have found out so far are:
https://www.gatsbyjs.org/docs/eslint/#disabling-eslint - add an empty eslintrc
file (which is something I don't really want - spamming with empty eslint config files in my monorepo)
I came to another, a little bit hacky solution (maybe probably written more elegant way, but I just made it working few mins ago). In gatsby webpack.config.js
is being added eslint-loader
so I decided to try to remove it from webpack config (https://www.gatsbyjs.org/docs/add-custom-webpack-config/) by doing:
const onCreateWebpackConfig = ({ actions, getConfig }) => {
const config = getConfig()
const newRules = config.module.rules.map((rule) => {
if (
rule.use &&
rule.use[0] &&
rule.use[0].options &&
rule.use[0].options.useEslintrc !== undefined
) {
return {}
}
return rule
})
config.module.rules = newRules
actions.replaceWebpackConfig(config)
}
I basically replace rule
using eslint-loader
by empty object and seems so far it works. (Don't forget delete .docz
folder before. Seems caching has some issues, at least in my case)
Feel free to try out and share your experience.
Thanks @vitbokisch this is great. Option 2 looks like a good option for now. I feel like there should be a config option for this long-term though, as this relies on the webpack implementation details which could change between versions?
Glad it helps and definitely agree with you. Unfortunately, seems it's a default Gatsby behaviour. I tried to find an issue about it on their Issue tracker but couldn't find any, so feel free to take a look there (https://github.com/gatsbyjs/gatsby/issues) and open an issue as it seems it's not related to docz
itself :)
Unfortunately, seems it's a default Gatsby behaviour.
Is it not enabled by docz when adding the gatsby-plugin-eslint
here?: https://github.com/doczjs/docz/blob/f22208322cc0ab3b264ddc0c98413ca5f1f2110e/core/docz-core/templates/gatsby-config.tpl.js#L39-L50
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Question
Is it possible to disable ESLint?
Context
I am writing a build process that uses rollup to build the templates, then using docz to display them. So, docz is using compiled code, therefore ESLint complains about stuff I don't particularly care about because it is not source code. It would be nice if I could disable ESLint to prevent the warnings and perhaps get a small performance boost.
I have looked through the gatsby docs and don't see a way to hook in and remove a plugin?