Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eslint 9 support #543

Open
jafar-jabr opened this issue Aug 10, 2024 · 2 comments
Open

Eslint 9 support #543

jafar-jabr opened this issue Aug 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@jafar-jabr
Copy link

What's happening
I recently updated my React.js app to use ESLint 9, and I encountered a strange error. After spending considerable effort troubleshooting, I discovered that the issue was related to Craco.

ERROR in [eslint] Invalid Options:
- Unknown options: extensions, resolvePluginsRelativeTo
- 'extensions' has been removed.
- 'resolvePluginsRelativeTo' has been removed.

What should happen
expected to work with eslint 9

To reproduce
update eslint in your react.js app to v9.X.X

CRACO version
7.1.0

CRACO config

module.exports = {
 ...nothing_special
}

package.json

 ...nothing_special

Additional information
if I add

 eslint: {
    enable: false,
  },

to CRACO config it works.

@jafar-jabr jafar-jabr added the bug Something isn't working label Aug 10, 2024
@cullylarson
Copy link

cullylarson commented Dec 12, 2024

My solution has been to just disable it ({eslint: {enable: false}}) and run the lint check separately, before build.

@SolidZORO
Copy link

SolidZORO commented Feb 7, 2025

It’s working fine.

// craco-plugin--eslint.js
const path = require('path');

const ESLintPlugin = require('eslint-webpack-plugin');
const { removePlugins, pluginByName, addPlugins } = require('@craco/craco');

module.exports = {
  plugin: {
    overrideWebpackConfig: ({ webpackConfig }) => {
      // remove cra eslint v8
      removePlugins(webpackConfig, pluginByName('ESLintWebpackPlugin'));

      // add eslint v9 support
      addPlugins(webpackConfig, [
        new ESLintPlugin({
          eslintPath: require.resolve('eslint'),
          extensions: ['tsx', 'ts'], // file exts to check
          configType: 'flat',
          emitWarning: true,
          emitError: true,
          failOnError: true, // show ERROR devServer.overlay.client (craco.config.js)
        }),
      ]);

      return webpackConfig;
    },
  },
};
// craco.config.js

const cracoPluginEslint = require('./craco-plugin--eslint');

module.exports = {
  eslint: {
    enable: false,
  },
  plugins: [
 
    cracoPluginEslint, // <----------------- 
  
  ],
...
...
...

Alputer added a commit to Alputer/reana-ui that referenced this issue Feb 7, 2025
Craco has build issues with eslint v9, therefore eslint
is disabled for builds at the moment.
See dilanx/craco#543

Closes reanahub#346

hey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants