Skip to content

Commit

Permalink
Add name to flat configs
Browse files Browse the repository at this point in the history
  • Loading branch information
voxpelli committed Jun 13, 2024
1 parent 1490bb6 commit 66295a3
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ const allRules = Object.fromEntries(
]),
);

const createConfig = (rules, isLegacyConfig = false) => ({
...(isLegacyConfig ? legacyConfigBase : flatConfigBase),
plugins: isLegacyConfig ? ['unicorn'] : {unicorn},
const createConfig = (rules, flatConfigName = false) => ({
...(flatConfigName ? flatConfigBase : legacyConfigBase),
...flatConfigName && { name: flatConfigName },

Check failure on line 52 in index.js

View workflow job for this annotation

GitHub Actions / lint-test (ubuntu-latest)

There should be no space after '{'.

Check failure on line 52 in index.js

View workflow job for this annotation

GitHub Actions / lint-test (ubuntu-latest)

There should be no space before '}'.
plugins: flatConfigName ? {unicorn} : ['unicorn'],
rules: {...externalRules, ...rules},
});

Expand All @@ -65,10 +66,10 @@ const unicorn = {
};

const configs = {
recommended: createConfig(recommendedRules, /* isLegacyConfig */ true),
all: createConfig(allRules, /* isLegacyConfig */ true),
'flat/recommended': createConfig(recommendedRules),
'flat/all': createConfig(allRules),
recommended: createConfig(recommendedRules),
all: createConfig(allRules),
'flat/recommended': createConfig(recommendedRules, 'unicorn/flat/recommended'),
'flat/all': createConfig(allRules, 'unicorn/flat/all'),
};

module.exports = {...unicorn, configs};

0 comments on commit 66295a3

Please sign in to comment.