levibuzolic / eslint-plugin-no-only-tests

ESLint rule for catching focused/only test blocks
https://www.npmjs.com/package/eslint-plugin-no-only-tests
MIT License
87 stars 19 forks source link

ESLint flat configurations? #43

Closed jeremymeng closed 1 month ago

jeremymeng commented 4 months ago

eslint v9 will only support flat config format.

andyasberry commented 4 months ago

+1

Love this eslint plugin! ❤️ It has saved me many times 😅

Until the flat configuration is supported, something like this worked for me, thanks to fixupPluginRules from ESLint:

// ...imports
import { fixupPluginRules } from '@eslint/compat';
import noOnlyTests from 'eslint-plugin-no-only-tests';
// ...more imports

export default [
  // ...bunch of configs, rules, etc.
  {
    files: ['**/*.test.ts'],
    plugins: {
      'no-only-tests': fixupPluginRules(noOnlyTests),
    },
    rules: {
      // ...other rules for test files
      'no-only-tests/no-only-tests': 'error',
    }
  }
];

Hope this helps! I'm sure there is a better way, or other ways, to do this for now, but the above kept me moving as we migrate from ESLint v8 to v9.

levibuzolic commented 1 month ago

Thanks for rasing this @jeremymeng, v3.3.0 has been released which I beleive should fix the issue, but please let me know if you have any problems.