@fabdeh/eslint-config 0.2.1 → 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 +20 -1
- package/dist/index.mjs +35 -1
- package/package.json +4 -3
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)";
|
|
@@ -252,6 +253,7 @@ async function angular(options = {}) {
|
|
|
252
253
|
function comments() {
|
|
253
254
|
return tseslint.config({
|
|
254
255
|
name: "fabdeh/comments/rules",
|
|
256
|
+
files: [GLOB_SRC],
|
|
255
257
|
plugins: {
|
|
256
258
|
"@eslint-community/eslint-comments": eslintComments
|
|
257
259
|
},
|
|
@@ -278,6 +280,7 @@ function imports(options = {}) {
|
|
|
278
280
|
return tseslint.config(
|
|
279
281
|
{
|
|
280
282
|
name: "fabdeh/imports/rules",
|
|
283
|
+
files: [GLOB_SRC],
|
|
281
284
|
plugins: {
|
|
282
285
|
"import-x": importX
|
|
283
286
|
},
|
|
@@ -345,6 +348,7 @@ function javascript(options = {}) {
|
|
|
345
348
|
},
|
|
346
349
|
{
|
|
347
350
|
name: "fabdeh/javascript/rules",
|
|
351
|
+
files: [GLOB_SRC],
|
|
348
352
|
plugins: {
|
|
349
353
|
"@typescript-eslint": tseslint.plugin,
|
|
350
354
|
"prefer-arrow-functions": preferArrowFunctions,
|
|
@@ -471,6 +475,7 @@ function jsdoc(options = {}) {
|
|
|
471
475
|
return tseslint.config(
|
|
472
476
|
{
|
|
473
477
|
name: "fabdeh/jsdoc/rules",
|
|
478
|
+
files: [GLOB_SRC],
|
|
474
479
|
plugins: { jsdoc: jsdocPlugin },
|
|
475
480
|
rules: {
|
|
476
481
|
"jsdoc/check-access": "warn",
|
|
@@ -891,6 +896,7 @@ async function perfectionist() {
|
|
|
891
896
|
const tsconfigRootDir = await findNearestPackageJsonName() === "@fabdeh/eslint-config" ? void 0 : getWorkspaceRoot(process.cwd(), process.cwd());
|
|
892
897
|
return tseslint.config({
|
|
893
898
|
name: "fabdeh/perfectionist/rules",
|
|
899
|
+
files: [GLOB_SRC],
|
|
894
900
|
plugins: {
|
|
895
901
|
perfectionist: perfectionistPlugin
|
|
896
902
|
},
|
|
@@ -929,6 +935,27 @@ async function perfectionist() {
|
|
|
929
935
|
});
|
|
930
936
|
}
|
|
931
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
|
+
|
|
932
959
|
function sortPackageJson() {
|
|
933
960
|
return tseslint.config({
|
|
934
961
|
name: "fabdeh/sort/package-json",
|
|
@@ -1168,6 +1195,7 @@ async function stylistic(options = {}) {
|
|
|
1168
1195
|
const config = stylisticPlugin.configs.customize({ ...stylisticOptions, flat: true });
|
|
1169
1196
|
return tseslint.config({
|
|
1170
1197
|
name: "fabdeh/stylistic/rules",
|
|
1198
|
+
files: [GLOB_SRC],
|
|
1171
1199
|
plugins: {
|
|
1172
1200
|
"@stylistic": stylisticPlugin
|
|
1173
1201
|
},
|
|
@@ -1374,6 +1402,7 @@ function typescript(options = {}) {
|
|
|
1374
1402
|
function unicorn(options = {}) {
|
|
1375
1403
|
return tseslint.config({
|
|
1376
1404
|
name: "fabdeh/unicorn/rules",
|
|
1405
|
+
files: [GLOB_SRC],
|
|
1377
1406
|
plugins: { unicorn: unicornPlugin },
|
|
1378
1407
|
rules: {
|
|
1379
1408
|
...options.allRecommended ? unicornPlugin.configs.recommended.rules : {
|
|
@@ -1821,6 +1850,7 @@ async function createConfig(options = {}, ...userConfigs) {
|
|
|
1821
1850
|
angular: enableAngular = isPackageExists("@angular/core"),
|
|
1822
1851
|
gitignore: enableGitignore = true,
|
|
1823
1852
|
ngrx: enableNgrx = NGRX_PACKAGES.some((p) => isPackageExists(p)),
|
|
1853
|
+
regexp: enableRegexp = true,
|
|
1824
1854
|
tailwindcss: enableTailwind = isPackageExists("tailwindcss"),
|
|
1825
1855
|
typescript: enableTypescript = isPackageExists("typescript"),
|
|
1826
1856
|
unicorn: enableUnicorn = true,
|
|
@@ -1866,6 +1896,10 @@ async function createConfig(options = {}, ...userConfigs) {
|
|
|
1866
1896
|
if (stylisticOptions) {
|
|
1867
1897
|
configs.push(stylistic({ stylistic: stylisticOptions }));
|
|
1868
1898
|
}
|
|
1899
|
+
if (enableRegexp) {
|
|
1900
|
+
const regexpOptions = resolveSubOptions(options, "regexp");
|
|
1901
|
+
configs.push(regexp(regexpOptions));
|
|
1902
|
+
}
|
|
1869
1903
|
if (enableAngular) {
|
|
1870
1904
|
const angularOptions = resolveSubOptions(options, "angular");
|
|
1871
1905
|
configs.push(angular(angularOptions));
|
|
@@ -1926,4 +1960,4 @@ async function createConfig(options = {}, ...userConfigs) {
|
|
|
1926
1960
|
return tseslint.config(...await Promise.all(configs), ...await Promise.all(userConfigs));
|
|
1927
1961
|
}
|
|
1928
1962
|
|
|
1929
|
-
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.
|
|
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.
|
|
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.
|
|
140
|
+
"vitest": "^3.0.6"
|
|
140
141
|
},
|
|
141
142
|
"pnpm": {
|
|
142
143
|
"overrides": {
|