eslint-plugin-ember icon indicating copy to clipboard operation
eslint-plugin-ember copied to clipboard

Issues with the "flat" config exports

Open Windvis opened this issue 1 year ago • 2 comments

I was trying out the new eslint v9 setup (https://github.com/ember-cli/ember-cli/pull/10516) in our app, but I ran into some issues and one of the issues is related to the "flat" recommended config exports.

Since they are exported as arrays, they don't work as expected when used as in that PR. The example in the readme also doesn't work as intended.

I've been able to work around the issues by flattening the exported array and then spreading the .rules prop where needed.

(I'll try to add more details later, just creating a new issue before I forget)

Windvis avatar Oct 17 '24 20:10 Windvis

I think we should add a `import { gjs, gts } from 'eslint-plugin-ember/configs';

where gjs is this object:

{
    plugins: { ember: plugin },
    files: ['**/*.gjs'],
    languageOptions: {
      parser: emberEslintParser,
    },
    processor: 'ember/noop',
    rules: gjsRules,
}

and gts is this object:

{
    plugins: { ember: plugin },
    files: ['**/*.gts'],
    languageOptions: {
      parser: emberEslintParser,
    },
    processor: 'ember/noop',
    rules: gtsRules,
}

that way folks can chose to do something like:

import { gjs, gts } from 'eslint-plugin-ember/configs';

export default [
  gjs,
  gts,
  {
    files: ['**/*.{js,gjs}'],
    /* ... */
    rules: {
      ...etc,
      ...gjs.rules,
    }
  },
  {
    files: ['**/*.{js,gjs}'],
    /* ... */
    rules: {
      ...etc,
      ...gts.rules,
    }
  }
]

NullVoxPopuli avatar Oct 17 '24 20:10 NullVoxPopuli

I opened #2191 to help out here

NullVoxPopuli avatar Oct 19 '24 03:10 NullVoxPopuli