@isentinel/eslint-config 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -11,7 +11,7 @@ import { execSync } from "node:child_process";
11
11
 
12
12
  //#region package.json
13
13
  var name = "@isentinel/eslint-config";
14
- var version = "3.4.0";
14
+ var version = "3.5.0";
15
15
  var description = "iSentinel's ESLint config";
16
16
  var keywords = [
17
17
  "eslint-config",
package/dist/index.d.ts CHANGED
@@ -15562,6 +15562,25 @@ declare function interopDefault<T>(dynamicImport: ModuleImport<T>): Promise<T>;
15562
15562
  declare function isInEditorEnvironment(): boolean;
15563
15563
  declare function isInGitHooksOrLintStaged(): boolean;
15564
15564
  declare function mergePrettierOptions(options: PrettierOptions, overrides?: PrettierRuleOptions): Record<string, any>;
15565
+ /**
15566
+ * Merge custom root glob patterns with the default GLOB_ROOT.
15567
+ *
15568
+ * - Patterns starting with "!" are used to remove matching patterns from the
15569
+ * default GLOB_ROOT
15570
+ * - Other patterns are added to the result.
15571
+ *
15572
+ * @example
15573
+ *
15574
+ * ```ts
15575
+ * const result = mergeRootGlobs(GLOB_ROOT, ["places/**", "!apps/**"]);
15576
+ * // Returns: ["*", "packages/**", "libs/**", "places/**"]
15577
+ * ```
15578
+ *
15579
+ * @param defaultRoot - The default root glob patterns.
15580
+ * @param customRoot - Custom root patterns to merge (optional).
15581
+ * @returns The merged array of glob patterns.
15582
+ */
15583
+ declare function mergeRootGlobs(defaultRoot: Array<string>, customRoot?: Array<string>): Array<string>;
15565
15584
  /**
15566
15585
  * Rename plugin names a flat configs array.
15567
15586
  *
@@ -15755,6 +15774,22 @@ interface OptionsConfig extends OptionsComponentExtensions, OptionsProjectType {
15755
15774
  * @default true
15756
15775
  */
15757
15776
  roblox?: boolean | OptionsOverridesTypeAware;
15777
+ /**
15778
+ * Customize root-level glob patterns.
15779
+ *
15780
+ * These patterns are merged with the default `GLOB_ROOT`. Use "!" prefix to
15781
+ * exclude patterns.
15782
+ *
15783
+ * @example
15784
+ *
15785
+ * ```ts
15786
+ * root: ["places/**", "!apps/**"];
15787
+ * // Results in: ["*", "packages/**", "libs/**", "places/**"]
15788
+ * ```
15789
+ *
15790
+ * @default undefined
15791
+ */
15792
+ root?: Array<string>;
15758
15793
  /**
15759
15794
  * Enable CSpell support.
15760
15795
  *
@@ -16116,7 +16151,9 @@ declare function toml(options?: OptionsFiles & OptionsOverrides & OptionsStylist
16116
16151
  declare function typescript(options?: OptionsComponentExtensions & OptionsFiles & OptionsOverridesTypeAware & OptionsStylistic & OptionsTypeScriptErasableOnly & OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes): Promise<Array<TypedFlatConfigItem>>;
16117
16152
  //#endregion
16118
16153
  //#region src/configs/unicorn.d.ts
16119
- declare function unicorn(options?: OptionsStylistic): Promise<Array<TypedFlatConfigItem>>;
16154
+ declare function unicorn(options?: OptionsStylistic & {
16155
+ root?: Array<string>;
16156
+ }): Promise<Array<TypedFlatConfigItem>>;
16120
16157
  //#endregion
16121
16158
  //#region src/configs/yaml.d.ts
16122
16159
  declare function yaml(options?: OptionsFiles & OptionsOverrides & OptionsStylistic): Promise<Array<TypedFlatConfigItem>>;
@@ -16145,6 +16182,7 @@ declare function isentinel(options?: OptionsConfig & TypedFlatConfigItem, ...use
16145
16182
  //#endregion
16146
16183
  //#region src/globs.d.ts
16147
16184
  declare const GLOB_ROOT: string[];
16185
+ declare const GLOB_ROOT_SRC: string[];
16148
16186
  declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
16149
16187
  declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
16150
16188
  declare const GLOB_LUA = "**/*.lua?(u)";
@@ -16176,4 +16214,4 @@ declare const GLOB_BUILD_TOOLS: string[];
16176
16214
  declare const GLOB_ALL_SRC: string[];
16177
16215
  declare const GLOB_EXCLUDE: string[];
16178
16216
  //#endregion
16179
- export { Awaitable, type ConfigNames, ExtractRuleOptions, GLOB_ALL_JSON, GLOB_ALL_SRC, GLOB_BUILD_TOOLS, GLOB_CSS, GLOB_DTS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LUA, GLOB_MARKDOWN, GLOB_MARKDOWN_BLOCKS, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_ROOT, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_XML, GLOB_YAML, GitignoreOptions, JsdocOptions, OptionsComponentExtensions, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsOverridesTypeAware, OptionsProjectType, OptionsRoblox, OptionsStylistic, OptionsTestFramework, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, PerfectionistConfig, type PrettierOptions, PrettierRuleOptions, ReactConfig, ResolvedOptions, Rules, SpellCheckConfig, StylisticConfig, StylisticConfigDefaults, TypedFlatConfigItem, combine, comments, createTsParser, isentinel as default, defaultPluginRenaming, disables, ensurePackages, eslintPlugin, flawless, getOverrides, getTsConfig, gitignore, ignores, imports, interopDefault, isInEditorEnvironment, isInGitHooksOrLintStaged, isentinel, javascript, jsdoc, jsonc, markdown, mergePrettierOptions, node, packageJson, parserPlain, perfectionist, pnpm, prettier, promise, react, renamePluginInConfigs, renameRules, require, resolvePrettierConfigOptions, resolveSubOptions, resolveWithDefaults, roblox, shopify, shouldEnableFeature, sonarjs, sortGithubAction, sortRojoProject, sortTsconfig, spelling, stylistic, toml, typescript, unicorn, yaml };
16217
+ export { Awaitable, type ConfigNames, ExtractRuleOptions, GLOB_ALL_JSON, GLOB_ALL_SRC, GLOB_BUILD_TOOLS, GLOB_CSS, GLOB_DTS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LUA, GLOB_MARKDOWN, GLOB_MARKDOWN_BLOCKS, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_ROOT, GLOB_ROOT_SRC, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_XML, GLOB_YAML, GitignoreOptions, JsdocOptions, OptionsComponentExtensions, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsOverridesTypeAware, OptionsProjectType, OptionsRoblox, OptionsStylistic, OptionsTestFramework, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, PerfectionistConfig, type PrettierOptions, PrettierRuleOptions, ReactConfig, ResolvedOptions, Rules, SpellCheckConfig, StylisticConfig, StylisticConfigDefaults, TypedFlatConfigItem, combine, comments, createTsParser, isentinel as default, defaultPluginRenaming, disables, ensurePackages, eslintPlugin, flawless, getOverrides, getTsConfig, gitignore, ignores, imports, interopDefault, isInEditorEnvironment, isInGitHooksOrLintStaged, isentinel, javascript, jsdoc, jsonc, markdown, mergePrettierOptions, mergeRootGlobs, node, packageJson, parserPlain, perfectionist, pnpm, prettier, promise, react, renamePluginInConfigs, renameRules, require, resolvePrettierConfigOptions, resolveSubOptions, resolveWithDefaults, roblox, shopify, shouldEnableFeature, sonarjs, sortGithubAction, sortRojoProject, sortTsconfig, spelling, stylistic, toml, typescript, unicorn, yaml };
package/dist/index.js CHANGED
@@ -12,6 +12,15 @@ import { fixupPluginRules } from "@eslint/compat";
12
12
 
13
13
  //#region src/globs.ts
14
14
  const GLOB_ROOT = [
15
+ "*",
16
+ "packages/*/*",
17
+ "apps/*/*",
18
+ "libs/*/*",
19
+ "packages/*/*/*",
20
+ "apps/*/*/*",
21
+ "libs/*/*/*"
22
+ ];
23
+ const GLOB_ROOT_SRC = [
15
24
  "*.?([cm])[jt]s?(x)",
16
25
  "packages/*/*.?([cm])[jt]s?(x)",
17
26
  "apps/*/*.?([cm])[jt]s?(x)",
@@ -223,6 +232,33 @@ function mergePrettierOptions(options, overrides = {}) {
223
232
  };
224
233
  }
225
234
  /**
235
+ * Merge custom root glob patterns with the default GLOB_ROOT.
236
+ *
237
+ * - Patterns starting with "!" are used to remove matching patterns from the
238
+ * default GLOB_ROOT
239
+ * - Other patterns are added to the result.
240
+ *
241
+ * @example
242
+ *
243
+ * ```ts
244
+ * const result = mergeRootGlobs(GLOB_ROOT, ["places/**", "!apps/**"]);
245
+ * // Returns: ["*", "packages/**", "libs/**", "places/**"]
246
+ * ```
247
+ *
248
+ * @param defaultRoot - The default root glob patterns.
249
+ * @param customRoot - Custom root patterns to merge (optional).
250
+ * @returns The merged array of glob patterns.
251
+ */
252
+ function mergeRootGlobs(defaultRoot, customRoot) {
253
+ if (!customRoot || customRoot.length === 0) return [...defaultRoot];
254
+ let result = [...defaultRoot];
255
+ for (const pattern of customRoot) if (pattern.startsWith("!")) {
256
+ const patternToRemove = pattern.slice(1);
257
+ result = result.filter((item) => item !== patternToRemove);
258
+ } else result.push(pattern);
259
+ return result;
260
+ }
261
+ /**
226
262
  * Rename plugin names a flat configs array.
227
263
  *
228
264
  * @example
@@ -4793,7 +4829,7 @@ const defaultPluginRenaming = {
4793
4829
  * @returns A promise that resolves to an array of user configuration items.
4794
4830
  */
4795
4831
  async function isentinel(options = {}, ...userConfigs) {
4796
- const { autoRenamePlugins = true, componentExts: componentExtensions = [], eslintPlugin: enableEslintPlugin = false, formatters, gitignore: enableGitignore = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, pnpm: enableCatalogs = false, react: enableReact = false, spellCheck: enableSpellCheck, typescript: enableTypeScript } = options;
4832
+ const { autoRenamePlugins = true, componentExts: componentExtensions = [], eslintPlugin: enableEslintPlugin = false, formatters, gitignore: enableGitignore = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, pnpm: enableCatalogs = false, react: enableReact = false, root: customRootGlobs, spellCheck: enableSpellCheck, typescript: enableTypeScript } = options;
4797
4833
  const enableRoblox = options.roblox !== false;
4798
4834
  let { isInEditor } = options;
4799
4835
  if (isInEditor === void 0) {
@@ -4851,7 +4887,10 @@ async function isentinel(options = {}, ...userConfigs) {
4851
4887
  ...getOverrides(options, "typescript"),
4852
4888
  componentExts: componentExtensions,
4853
4889
  stylistic: stylisticOptions
4854
- }), unicorn({ stylistic: stylisticOptions }));
4890
+ }), unicorn({
4891
+ root: customRootGlobs,
4892
+ stylistic: stylisticOptions
4893
+ }));
4855
4894
  if (options.flawless === true) configs.push(flawless({ ...getOverrides(options, "flawless") }));
4856
4895
  if (enableJsdoc !== false) configs.push(jsdoc({
4857
4896
  stylistic: stylisticOptions,
@@ -6269,10 +6308,12 @@ const abbreviations = {
6269
6308
  utils: false
6270
6309
  };
6271
6310
  async function unicorn(options = {}) {
6272
- const { stylistic: stylistic$1 = true } = options;
6311
+ const { root: customRootGlobs, stylistic: stylistic$1 = true } = options;
6312
+ const pluginUnicorn = await interopDefault(import("eslint-plugin-unicorn"));
6313
+ const rootGlobs = mergeRootGlobs(GLOB_ROOT, customRootGlobs);
6273
6314
  return [{
6274
6315
  name: "isentinel/unicorn",
6275
- plugins: { unicorn: await interopDefault(import("eslint-plugin-unicorn")) },
6316
+ plugins: { unicorn: pluginUnicorn },
6276
6317
  rules: {
6277
6318
  "unicorn/catch-error-name": ["error", { name: "err" }],
6278
6319
  "unicorn/consistent-destructuring": "error",
@@ -6318,7 +6359,7 @@ async function unicorn(options = {}) {
6318
6359
  ...stylistic$1 !== false ? { "unicorn/switch-case-braces": "error" } : {}
6319
6360
  }
6320
6361
  }, {
6321
- files: [GLOB_ROOT],
6362
+ files: rootGlobs,
6322
6363
  name: "isentinel/unicorn/root",
6323
6364
  rules: { "unicorn/prevent-abbreviations": ["error", {
6324
6365
  checkFilenames: false,
@@ -6375,4 +6416,4 @@ async function yaml(options = {}) {
6375
6416
  }
6376
6417
 
6377
6418
  //#endregion
6378
- export { GLOB_ALL_JSON, GLOB_ALL_SRC, GLOB_BUILD_TOOLS, GLOB_CSS, GLOB_DTS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LUA, GLOB_MARKDOWN, GLOB_MARKDOWN_BLOCKS, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_ROOT, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, combine, comments, createTsParser, isentinel as default, defaultPluginRenaming, disables, ensurePackages, eslintPlugin, flawless, getOverrides, getTsConfig, gitignore, ignores, imports, interopDefault, isInEditorEnvironment, isInGitHooksOrLintStaged, isentinel, javascript, jsdoc, jsonc, markdown, mergePrettierOptions, node, packageJson, parserPlain, perfectionist, pnpm, prettier, promise, react, renamePluginInConfigs, renameRules, require$1 as require, resolvePrettierConfigOptions, resolveSubOptions, resolveWithDefaults, roblox, shopify, shouldEnableFeature, sonarjs, sortGithubAction, sortRojoProject, sortTsconfig, spelling, stylistic, toml, typescript, unicorn, yaml };
6419
+ export { GLOB_ALL_JSON, GLOB_ALL_SRC, GLOB_BUILD_TOOLS, GLOB_CSS, GLOB_DTS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LUA, GLOB_MARKDOWN, GLOB_MARKDOWN_BLOCKS, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_ROOT, GLOB_ROOT_SRC, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, combine, comments, createTsParser, isentinel as default, defaultPluginRenaming, disables, ensurePackages, eslintPlugin, flawless, getOverrides, getTsConfig, gitignore, ignores, imports, interopDefault, isInEditorEnvironment, isInGitHooksOrLintStaged, isentinel, javascript, jsdoc, jsonc, markdown, mergePrettierOptions, mergeRootGlobs, node, packageJson, parserPlain, perfectionist, pnpm, prettier, promise, react, renamePluginInConfigs, renameRules, require$1 as require, resolvePrettierConfigOptions, resolveSubOptions, resolveWithDefaults, roblox, shopify, shouldEnableFeature, sonarjs, sortGithubAction, sortRojoProject, sortTsconfig, spelling, stylistic, toml, typescript, unicorn, yaml };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isentinel/eslint-config",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "iSentinel's ESLint config",
5
5
  "keywords": [
6
6
  "eslint-config",
@@ -119,7 +119,7 @@
119
119
  "tsdown": "0.14.2",
120
120
  "type-fest": "4.41.0",
121
121
  "typescript": "5.9.2",
122
- "@isentinel/eslint-config": "3.4.0"
122
+ "@isentinel/eslint-config": "3.5.0"
123
123
  },
124
124
  "peerDependencies": {
125
125
  "@eslint-react/eslint-plugin": "^1.45.0",