Updating eslint to 9 causes dev server errors.
Opened this issue · 5 comments
Preliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
- This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
Description
I've tried to update eslint to 9, with new flat config.VSCode and cli works good, but then I'm trying to run dev, it fails with error.
Looking at documentation, disabling eslint with empty .eslintrc doesn't help.
Error:
ERROR #98123 WEBPACK.DEVELOP
Generating development JavaScript bundle failed
Invalid Options:
- Unknown options: extensions, rulePaths, useEslintrc
- 'extensions' has been removed.
- 'rulePaths' has been removed. Please define your rules using plugins.
failed Building development bundle - 3.210s
ERROR in Invalid Options:
- Unknown options: extensions, rulePaths, useEslintrc
- 'extensions' has been removed.
- 'rulePaths' has been removed. Please define your rules using plugins.
develop compiled with 1 error
Reproduction Link
don't have a repro
Steps to Reproduce
- Update eslint and plugins to latest
- Run migration eslintrc to mjs https://eslint.org/docs/latest/use/configure/migration-guide
- Run eslint in cli, to check if config is correct.
- Run gatsby develop - you will get an error
Expected Result
Dev server should be decoupled from eslint version.
Gatsby should support eslint@9 and flat config.
Actual Result
Error:
ERROR #98123 WEBPACK.DEVELOP
Generating development JavaScript bundle failed
Invalid Options:
- Unknown options: extensions, rulePaths, useEslintrc
- 'extensions' has been removed.
- 'rulePaths' has been removed. Please define your rules using plugins.
failed Building development bundle - 3.210s
ERROR in Invalid Options:
- Unknown options: extensions, rulePaths, useEslintrc
- 'extensions' has been removed.
- 'rulePaths' has been removed. Please define your rules using plugins.
develop compiled with 1 error
Environment
System:
OS: macOS 14.5
CPU: (10) arm64 Apple M1 Max
Shell: 3.2.57 - /bin/sh
Binaries:
Node: 22.4.0 - /tmp/yarn--1720005845909-0.247377011876049/node
Yarn: 1.22.22 - /tmp/yarn--1720005845909-0.247377011876049/yarn
npm: 10.8.1 - ~/.nvm/versions/node/v22.4.0/bin/npm
Browsers:
Chrome: 126.0.6478.127
Safari: 17.5
npmPackages:
gatsby: 5.13.6 => 5.13.6
gatsby-link: 5.13.1 => 5.13.1
gatsby-plugin-catch-links: 5.13.1 => 5.13.1
gatsby-plugin-dts-css-modules: 3.0.0 => 3.0.0
gatsby-plugin-minify-classnames: 5.0.0 => 5.0.0
gatsby-plugin-postcss: 6.13.1 => 6.13.1
gatsby-plugin-purgecss: 6.2.1 => 6.2.1
gatsby-plugin-root-import: 2.0.9 => 2.0.9
gatsby-plugin-sass: 6.13.1 => 6.13.1
gatsby-plugin-sitemap: 6.13.1 => 6.13.1
gatsby-plugin-typescript: 5.13.1 => 5.13.1
gatsby-react-router-scroll: 6.13.1 => 6.13.1
gatsby-script: 2.13.0 => 2.13.0
Config Flags
No response
As a workaround, you can create a empty .eslintrc to disable eslint-loader. A proper fix is possible, but with the current status of gatsby, it would take some time.
I've tried the workaround, gatsby still crashes
i resolved this issue by the following:
npm install --save-dev gatsby-plugin-eslint eslint eslint-webpack-plugin eslint-config-react-app
- create an empty .eslintrc.js file in the root dir
linting still works using the cli but may not appear in the running gatsby process .
alternatively if the above doesnt fix your dev server you can just build and serve the app (not ideal but was a workaround for me)
Could not figure this one out. Already had .eslintrc.js
in place.
Rolled eslint back to v.8.57.1
.