feat: default variant for the configs

This commit is contained in:
Guz013
2023-09-04 17:12:43 -03:00
parent 15765c8e73
commit f4e52b991c
5 changed files with 36 additions and 13 deletions

View File

@@ -0,0 +1,5 @@
---
"@eslegant/js": minor
---
Configs now export a `default` variation, where rule leves aren't overriden.

View File

@@ -9,6 +9,19 @@
import type { Linter } from 'eslint';
interface ConfigVariations {
/**
* @summary
* Enable rules with the predefined levels of the package.
* @description
* Most of the rules in ESLegant are on `error` level. This
* was preferred so it is harder to ignore them. But it has
* some small exceptions where rules will be at `warn` level,
* being more as a "reminder" than a actual rule.
*
* If you want to **every** rule in the config to have an
* `error` or `warn` level, you can use the other variants.
*/
default: Linter.FlatConfig,
/**
* @description
* Enable all rules with `error` level.

View File

@@ -91,7 +91,12 @@ function createVariations(config) {
),
};
return { error: configError, off: configDisabled, warn: configWarning };
return {
default: config,
error: configError,
off: configDisabled,
warn: configWarning,
};
}
export { createVariations, iterateRules };

View File

@@ -12,11 +12,11 @@ import configs from '../configs/index.js';
/** @type {import('eslint').Linter.FlatConfig[]} */
const recommended = [
configs.core,
configs.problems.recommended.error,
configs.suggestions.recommended.error,
configs['suggestions-typescript'].recommended.error,
configs.formatting.recommended.error,
configs.naming.recommended.error,
configs.documentation.recommended.error,
configs.problems.recommended.default,
configs.suggestions.recommended.default,
configs['suggestions-typescript'].recommended.default,
configs.formatting.recommended.default,
configs.naming.recommended.default,
configs.documentation.recommended.default,
];
export default recommended;

View File

@@ -12,11 +12,11 @@ import configs from '../configs/index.js';
/** @type {import('eslint').Linter.FlatConfig[]} */
const strict = [
configs.core,
configs.problems.strict.error,
configs.suggestions.strict.error,
configs['suggestions-typescript'].strict.error,
configs.formatting.strict.error,
configs.naming.strict.error,
configs.documentation.recommended.error,
configs.problems.strict.default,
configs.suggestions.strict.default,
configs['suggestions-typescript'].strict.default,
configs.formatting.strict.default,
configs.naming.strict.default,
configs.documentation.recommended.default,
];
export default strict;