ecoCode-javascript icon indicating copy to clipboard operation
ecoCode-javascript copied to clipboard

Make the ESLint plugin compatible with the last ESLint versions with flat configurations

Open AMorgaut opened this issue 1 year ago • 3 comments
trafficstars

Current Behavior

The plugin ESLint plugin is not compatible with the latest ESLint versions which requires flat configuration

Expected Behavior

It should be possible to integrate the Ecocode ESLint config into projects using recent ESLint versions which don't support .eslintrc config file anymore but require an eslint.config.json file with flat configurations

Steps to Reproduce

  1. update a project to ESLint 8.23
  2. run ESLint

Failure Logs

No response

ecoCode-javascript Version

1.15

SonarQube Version

N/A

Additional Information

The plugin should follow the ESLint migration guide https://eslint.org/docs/latest/extend/plugin-migration-flat-config

AMorgaut avatar Aug 21 '24 12:08 AMorgaut

A working patch was made in ecocode dashboard

// patch ecocode plugin for flat config support
// see https://eslint.org/docs/latest/extend/plugin-migration-flat-config
if (!ecocode.configs['flat/recommended'])  {
    ecocode.meta = {
      name: "@ecocode/eslint-plugin",
      version: "1.5.0"
    }
    ecocode.configs['flat/recommended'] = {
      plugins: {
        '@ecocode': ecocode
      },
      rules: ecocode.configs.recommended.rules,
    };
}

https://github.com/green-code-initiative/ecoCode-dashboard/blob/bb845d5bc36f4ab8f12506fd998ba9720ed0a9df/eslint.config.js#L23

AMorgaut avatar Aug 21 '24 12:08 AMorgaut

Created the pull request #51 which will need to be tested

AMorgaut avatar Aug 21 '24 13:08 AMorgaut

Hello @utarwyn. Is this PR will be merged soon?

hrenaud avatar Oct 09 '24 15:10 hrenaud

@hrenaud Hello utarwyn. Is this PR will be merged soon?

Hello! Sorry for my lack of responsiveness on this topic, I've been really busy lately. I have left comments on the associated PR 👀

utarwyn avatar Oct 14 '24 18:10 utarwyn