Bad types in eslint-plugin-sonarjs@2.0.2

After upgrading from 2.0.1 I get the following errors:

node_modules/eslint-plugin-sonarjs/lib/plugin.d.ts:4:18 - error TS2315: Type 'FlatConfig' is not generic.

4     recommended: Linter.FlatConfig<Linter.RulesRecord> & {
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/eslint-plugin-sonarjs/lib/plugin.d.ts:7:27 - error TS2707: Generic type 'Config<Rules>' requires between 0 and 1 type arguments.

7     'recommended-legacy': Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/eslint-plugin-sonarjs/lib/plugin.d.ts:16:22 - error TS2315: Type 'FlatConfig' is not generic.

16         recommended: Linter.FlatConfig<Linter.RulesRecord> & {
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/eslint-plugin-sonarjs/lib/plugin.d.ts:19:31 - error TS2707: Generic type 'Config<Rules>' requires between 0 and 1 type arguments.

19         'recommended-legacy': Linter.Config<Linter.RulesRecord, Linter.RulesRecord>;
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Looking at @types/eslint (in our case it’s 9.6.1), the errors appear to be correct.

Hello @alecmev,

Thanks for the report. You are correct, the error is legit when using ESLint 9 types. The plugin is not compatible with ESLint 9 yet (we are actively working on it), which is something we failed to communicate successfully. Please accept our apologies. The README has been updated accordingly in 2.0.2.

To solve your issue, we recommend using the plugin only with ESLint 8 - and the belonging @types/eslint types if you depend on its API.

Eric.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.