diff --git a/src/index.ts b/src/index.ts index d1c1ff01..2e989fa2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -87,15 +87,12 @@ const rules: Record>> = { 'prefer-while': preferWhile, }; -const plugin = { - configs: {}, - rules: {}, -}; - const recommendedLegacyConfig: TSESLint.Linter.ConfigType = { plugins: ['sonarjs'], rules: {} }; const recommendedConfig: FlatConfig.Config = { plugins: { - sonarjs: plugin, + sonarjs: { + rules, + }, }, rules: {}, }; @@ -113,6 +110,5 @@ const configs = { recommended: recommendedConfig, 'recommended-legacy': recommendedLegacyConfig, }; -plugin.configs = configs; export { rules, configs }; diff --git a/tests/index.test.ts b/tests/index.test.ts index fd532146..46a73886 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -30,6 +30,9 @@ it('should declare all rules in recommended config', () => { }); expect(Object.keys(configs.recommended.rules!)).toHaveLength(existingRules.length); expect(new Set(Object.values(configs.recommended.rules!))).toEqual(new Set(['off', 'error'])); + existingRules.forEach(rule => { + expect(configs.recommended.plugins!['sonarjs'].rules).toHaveProperty(rule); + }); }); it('should declare all rules', () => {