feat: ✨ default variant for the configs
This commit is contained in:
5
.changeset/shy-steaks-report.md
Normal file
5
.changeset/shy-steaks-report.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@eslegant/js": minor
|
||||
---
|
||||
|
||||
Configs now export a `default` variation, where rule leves aren't overriden.
|
||||
13
configs/js/src/configs/index.d.ts
vendored
13
configs/js/src/configs/index.d.ts
vendored
@@ -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.
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user