diff --git a/configs/js/src/index.d.ts b/configs/js/src/index.d.ts index 309442a..6482724 100644 --- a/configs/js/src/index.d.ts +++ b/configs/js/src/index.d.ts @@ -1,2 +1,22 @@ +/** + * @file + * Types entrypoint of the package. + * @license MIT + * @author Guz013 (https://guz.one) + */ + +import type { Linter } from 'eslint'; + export { default as presets } from './presets/index.d.ts'; export { default as configs } from './configs/index.d.ts'; + +/** + * Helper function to provide type-checking when defining + * ESLint's configuration. + * + * @param config - The configuration array to be returned. + * @returns The configuration array passed on the first parameter. + */ +export function defineConfig( + config: Linter.FlatConfig[], +): Linter.FlatConfig[]; diff --git a/configs/js/src/index.js b/configs/js/src/index.js index 1231562..0c94145 100644 --- a/configs/js/src/index.js +++ b/configs/js/src/index.js @@ -1,2 +1,27 @@ -export { default as presets } from './presets/index.js'; +/** + * @file + * Main file entrypoint of the package. + * @license MIT + * @author Guz013 (https://guz.one) + */ + +import presets from './presets/index.js'; +import configs from './configs/index.js'; + +/** + * Helper function to provide type-checking when defining + * ESLint's configuration. + * + * @param {import('eslint').Linter.FlatConfig[]} config + * - The configuration array to be returned. + * @returns {import('eslint').Linter.FlatConfig[]} + */ +function defineConfig(config) { + return config; +} + +const eslegant = { configs, presets }; + +export { defineConfig, eslegant as default }; export { default as configs } from './configs/index.js'; +export { default as presets } from './presets/index.js'; diff --git a/eslint.config.js b/eslint.config.js index 0f87f6a..a69c70f 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,5 +1,16 @@ -import { presets } from '@eslegant/js'; +import { configs, defineConfig, presets } from '@eslegant/js'; -export default [ +export default defineConfig([ ...presets.strict, -]; + configs.environments.node.strict.error, + { + ...configs.documentation.strict.error, + files: ['configs/**/*.js', 'configs/**/*.ts'], + }, + { + files: ['**/*.{js,ts,cjs,tjs,mjs,mts,jsx,tsx}'], + rules: { + 'jsdoc/check-values': ['error', { allowedLicenses: ['MIT'] }], + }, + }, +]); diff --git a/tsconfig.json b/tsconfig.json index e8b28d3..54a0062 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,6 +13,6 @@ "alwaysStrict": true, "outDir": "./dir" }, - "include": ["eslint.config.js", "commitlint.config.cjs"], + "include": ["./eslint.config.js", "./commitlint.config.cjs"], "exclude": ["./node_modules/**", "./dist/**"] }