@fabdeh/eslint-config 0.2.2 → 0.2.3

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/index.d.mts CHANGED
@@ -283,6 +283,12 @@ interface FormattersOptions {
283
283
  files?: string[];
284
284
  };
285
285
  }
286
+ interface RegExpOptions {
287
+ /**
288
+ * Override rules level.
289
+ */
290
+ level?: 'error' | 'warn';
291
+ }
286
292
  /**
287
293
  * Options for creating an ESLint configuration.
288
294
  *
@@ -315,6 +321,13 @@ interface CreateConfigOptions {
315
321
  * @default true
316
322
  */
317
323
  stylistic?: boolean | (OverridesOptions & StylisticConfig);
324
+ /**
325
+ * Enable regexp rules.
326
+ *
327
+ * @see https://ota-meshi.github.io/eslint-plugin-regexp/
328
+ * @default true
329
+ */
330
+ regexp?: boolean | (OverridesOptions & RegExpOptions);
318
331
  /**
319
332
  * Options for eslint-plugin-unicorn.
320
333
  *
@@ -529,6 +542,12 @@ declare function ngrx(options?: NgrxOptions): Promise<ConfigArray>;
529
542
  */
530
543
  declare function perfectionist(): Promise<ConfigArray>;
531
544
 
545
+ /**
546
+ *
547
+ * @param options
548
+ */
549
+ declare function regexp(options?: OverridesOptions & RegExpOptions): ConfigArray;
550
+
532
551
  /**
533
552
  * Configures ESLint rules for sorting keys and array values in `package.json` files.
534
553
  *
@@ -739,4 +758,4 @@ type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
739
758
  */
740
759
  declare function resolveSubOptions<K extends keyof CreateConfigOptions>(options: CreateConfigOptions, key: K): ResolvedOptions<CreateConfigOptions[K]>;
741
760
 
742
- export { type AngularOptions, type Awaitable, type CreateConfigOptions, type FilesOptions, type FormattersOptions, GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, type NgrxOperators, type NgrxOptions, type OverridesOptions, type ResolvedOptions, STYLISTIC_CONFIG_DEFAULT, type StylisticConfig, type StylisticOptions, type TestingOptions, type TypeScriptParserOptions, type UnicornOptions, angular, comments, createConfig, ensurePackages, findNearestPackageJsonName, getWorkspaceRoot, ignores, imports, interopDefault, isPackageInScope, javascript, jsdoc, jsonc, markdown, ngrx, perfectionist, resolveSubOptions, sortPackageJson, sortTsConfig, stylistic, tailwindcss, toml, typescript, unicorn, vitest, yaml };
761
+ export { type AngularOptions, type Awaitable, type CreateConfigOptions, type FilesOptions, type FormattersOptions, GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, type NgrxOperators, type NgrxOptions, type OverridesOptions, type RegExpOptions, type ResolvedOptions, STYLISTIC_CONFIG_DEFAULT, type StylisticConfig, type StylisticOptions, type TestingOptions, type TypeScriptParserOptions, type UnicornOptions, angular, comments, createConfig, ensurePackages, findNearestPackageJsonName, getWorkspaceRoot, ignores, imports, interopDefault, isPackageInScope, javascript, jsdoc, jsonc, markdown, ngrx, perfectionist, regexp, resolveSubOptions, sortPackageJson, sortTsConfig, stylistic, tailwindcss, toml, typescript, unicorn, vitest, yaml };
package/dist/index.mjs CHANGED
@@ -14,6 +14,7 @@ import jsdocPlugin from 'eslint-plugin-jsdoc';
14
14
  import * as importX from 'eslint-plugin-import-x';
15
15
  import perfectionistPlugin from 'eslint-plugin-perfectionist';
16
16
  import unicornPlugin from 'eslint-plugin-unicorn';
17
+ import { configs } from 'eslint-plugin-regexp';
17
18
  import { mergeProcessors, processorPassThrough } from 'eslint-merge-processors';
18
19
 
19
20
  const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
@@ -934,6 +935,27 @@ async function perfectionist() {
934
935
  });
935
936
  }
936
937
 
938
+ function regexp(options = {}) {
939
+ const { level, overrides } = options;
940
+ const config = configs["flat/recommended"];
941
+ const rules = Object.fromEntries(
942
+ Object.entries(config.rules).map(([ruleName, ruleLevel]) => [ruleName, level === "warn" ? level : ruleLevel])
943
+ );
944
+ return tseslint.config(
945
+ {
946
+ name: "fabdeh/regexp/rules",
947
+ files: [GLOB_SRC],
948
+ plugins: {
949
+ ...config.plugins
950
+ },
951
+ rules: {
952
+ ...rules,
953
+ ...overrides
954
+ }
955
+ }
956
+ );
957
+ }
958
+
937
959
  function sortPackageJson() {
938
960
  return tseslint.config({
939
961
  name: "fabdeh/sort/package-json",
@@ -1828,6 +1850,7 @@ async function createConfig(options = {}, ...userConfigs) {
1828
1850
  angular: enableAngular = isPackageExists("@angular/core"),
1829
1851
  gitignore: enableGitignore = true,
1830
1852
  ngrx: enableNgrx = NGRX_PACKAGES.some((p) => isPackageExists(p)),
1853
+ regexp: enableRegexp = true,
1831
1854
  tailwindcss: enableTailwind = isPackageExists("tailwindcss"),
1832
1855
  typescript: enableTypescript = isPackageExists("typescript"),
1833
1856
  unicorn: enableUnicorn = true,
@@ -1873,6 +1896,10 @@ async function createConfig(options = {}, ...userConfigs) {
1873
1896
  if (stylisticOptions) {
1874
1897
  configs.push(stylistic({ stylistic: stylisticOptions }));
1875
1898
  }
1899
+ if (enableRegexp) {
1900
+ const regexpOptions = resolveSubOptions(options, "regexp");
1901
+ configs.push(regexp(regexpOptions));
1902
+ }
1876
1903
  if (enableAngular) {
1877
1904
  const angularOptions = resolveSubOptions(options, "angular");
1878
1905
  configs.push(angular(angularOptions));
@@ -1933,4 +1960,4 @@ async function createConfig(options = {}, ...userConfigs) {
1933
1960
  return tseslint.config(...await Promise.all(configs), ...await Promise.all(userConfigs));
1934
1961
  }
1935
1962
 
1936
- export { GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, STYLISTIC_CONFIG_DEFAULT, angular, comments, createConfig, ensurePackages, findNearestPackageJsonName, getWorkspaceRoot, ignores, imports, interopDefault, isPackageInScope, javascript, jsdoc, jsonc, markdown, ngrx, perfectionist, resolveSubOptions, sortPackageJson, sortTsConfig, stylistic, tailwindcss, toml, typescript, unicorn, vitest, yaml };
1963
+ export { GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, STYLISTIC_CONFIG_DEFAULT, angular, comments, createConfig, ensurePackages, findNearestPackageJsonName, getWorkspaceRoot, ignores, imports, interopDefault, isPackageInScope, javascript, jsdoc, jsonc, markdown, ngrx, perfectionist, regexp, resolveSubOptions, sortPackageJson, sortTsConfig, stylistic, tailwindcss, toml, typescript, unicorn, vitest, yaml };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fabdeh/eslint-config",
3
3
  "type": "module",
4
- "version": "0.2.2",
4
+ "version": "0.2.3",
5
5
  "packageManager": "pnpm@10.4.1",
6
6
  "description": "My personal eslint config preset",
7
7
  "author": {
@@ -91,6 +91,7 @@
91
91
  "eslint-plugin-jsonc": "^2.19.1",
92
92
  "eslint-plugin-perfectionist": "^4.9.0",
93
93
  "eslint-plugin-prefer-arrow-functions": "^3.6.2",
94
+ "eslint-plugin-regexp": "^2.7.0",
94
95
  "eslint-plugin-tailwindcss": "^3.18.0",
95
96
  "eslint-plugin-testing-library": "^7.1.1",
96
97
  "eslint-plugin-toml": "^0.12.0",
@@ -105,7 +106,7 @@
105
106
  "yaml-eslint-parser": "^1.2.3"
106
107
  },
107
108
  "devDependencies": {
108
- "@angular/core": "^19.1.6",
109
+ "@angular/core": "^19.1.7",
109
110
  "@commitlint/cli": "^19.7.1",
110
111
  "@commitlint/config-conventional": "^19.7.1",
111
112
  "@commitlint/cz-commitlint": "^19.6.1",
@@ -136,7 +137,7 @@
136
137
  "tailwindcss": "^3.4.17",
137
138
  "typescript": "^5.7.3",
138
139
  "unbuild": "^3.3.1",
139
- "vitest": "^3.0.5"
140
+ "vitest": "^3.0.6"
140
141
  },
141
142
  "pnpm": {
142
143
  "overrides": {