Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
Resolve ESLINTJS-37 (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmorand-sonarsource authored Apr 30, 2024
1 parent a857635 commit 33869d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,12 @@ const rules: Record<string, TSESLint.RuleModule<string, Array<unknown>>> = {
'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: {},
};
Expand All @@ -113,6 +110,5 @@ const configs = {
recommended: recommendedConfig,
'recommended-legacy': recommendedLegacyConfig,
};
plugin.configs = configs;

export { rules, configs };
3 changes: 3 additions & 0 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 33869d1

Please sign in to comment.