@fabdeh/eslint-config 0.12.2 → 0.13.1
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 +2615 -1481
- package/dist/index.mjs +75 -22
- package/package.json +51 -50
package/dist/index.mjs
CHANGED
|
@@ -349,7 +349,8 @@ function getPlaywrightDirectory() {
|
|
|
349
349
|
const match = /testDir:\s*["'](.+)["'],?/.exec(configContent);
|
|
350
350
|
if (match) {
|
|
351
351
|
const testDir = match[1];
|
|
352
|
-
const
|
|
352
|
+
const configDir = dirname(config);
|
|
353
|
+
const resolvedTestDir = resolve(configDir, testDir);
|
|
353
354
|
if (isDirectory(resolvedTestDir)) return resolvedTestDir;
|
|
354
355
|
}
|
|
355
356
|
} catch {}
|
|
@@ -396,6 +397,7 @@ async function angular(options = {}) {
|
|
|
396
397
|
"Output",
|
|
397
398
|
"Pipe",
|
|
398
399
|
"Self",
|
|
400
|
+
"Service",
|
|
399
401
|
"SkipSelf",
|
|
400
402
|
"ViewChild",
|
|
401
403
|
"ViewChildren"
|
|
@@ -1283,10 +1285,16 @@ async function ngrx(options = {}) {
|
|
|
1283
1285
|
...ngrxPlugin.configs.signals.find((c) => c.name === "ngrx/signals")?.rules,
|
|
1284
1286
|
"@typescript-eslint/naming-convention": [
|
|
1285
1287
|
"error",
|
|
1286
|
-
...namingConvention(!useRelaxedNamingConventionForCamelAndPascalCases),
|
|
1288
|
+
...namingConvention(!useRelaxedNamingConventionForCamelAndPascalCases, false),
|
|
1287
1289
|
{
|
|
1288
1290
|
selector: ["objectLiteralProperty", "objectLiteralMethod"],
|
|
1289
|
-
format: ["camelCase"],
|
|
1291
|
+
format: [useRelaxedNamingConventionForCamelAndPascalCases ? "camelCase" : "strictCamelCase"],
|
|
1292
|
+
leadingUnderscore: "allow"
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
selector: "parameter",
|
|
1296
|
+
modifiers: ["destructured"],
|
|
1297
|
+
format: [useRelaxedNamingConventionForCamelAndPascalCases ? "camelCase" : "strictCamelCase"],
|
|
1290
1298
|
leadingUnderscore: "allow"
|
|
1291
1299
|
},
|
|
1292
1300
|
{
|
|
@@ -1296,7 +1304,7 @@ async function ngrx(options = {}) {
|
|
|
1296
1304
|
"global",
|
|
1297
1305
|
"exported"
|
|
1298
1306
|
],
|
|
1299
|
-
format: ["PascalCase"],
|
|
1307
|
+
format: [useRelaxedNamingConventionForCamelAndPascalCases ? "PascalCase" : "StrictPascalCase"],
|
|
1300
1308
|
leadingUnderscore: "forbid",
|
|
1301
1309
|
trailingUnderscore: "forbid",
|
|
1302
1310
|
suffix: ["Store"]
|
|
@@ -2160,7 +2168,7 @@ async function typescript(options = {}, isWorkspaceProject = false) {
|
|
|
2160
2168
|
fixStyle: "separate-type-imports",
|
|
2161
2169
|
prefer: "type-imports"
|
|
2162
2170
|
}],
|
|
2163
|
-
"@typescript-eslint/dot-notation": "error",
|
|
2171
|
+
"@typescript-eslint/dot-notation": ["error", { allowIndexSignaturePropertyAccess: true }],
|
|
2164
2172
|
...type === "lib" ? { "@typescript-eslint/explicit-function-return-type": ["error", {
|
|
2165
2173
|
allowExpressions: true,
|
|
2166
2174
|
allowIIFEs: true
|
|
@@ -2462,6 +2470,47 @@ const NGRX_PACKAGES = [
|
|
|
2462
2470
|
const PLAYWRIGHT_PACKAGES = ["@playwright/test", "playwright"];
|
|
2463
2471
|
const OPTIONS_SYMBOL = Symbol("options");
|
|
2464
2472
|
//#endregion
|
|
2473
|
+
//#region src/factories/playwright-config.ts
|
|
2474
|
+
/**
|
|
2475
|
+
* Creates an ESLint configuration array for Playwright projects based on the provided base configuration,
|
|
2476
|
+
* options and user configurations.
|
|
2477
|
+
* This function is designed for use in an end-to-end project of a workspace environment and extends a base configuration
|
|
2478
|
+
* that is already defined in the root of the workspace.
|
|
2479
|
+
*
|
|
2480
|
+
* @param baseConfig - The base configuration to extend from.
|
|
2481
|
+
* @param options - Playwright-specific configuration options.
|
|
2482
|
+
* @param userConfigs - Additional user configurations that can be awaited.
|
|
2483
|
+
* @returns The merged ESLint configurations.
|
|
2484
|
+
* @example
|
|
2485
|
+
* ```typescript
|
|
2486
|
+
* import { definePlaywrightConfig } from '@fabdeh/eslint-config';
|
|
2487
|
+
*
|
|
2488
|
+
* import baseConfig from '../../eslint.base.js';
|
|
2489
|
+
*
|
|
2490
|
+
* export default definePlaywrightConfig(baseConfig, { ignores: ['playwright-report/**'] });
|
|
2491
|
+
*/
|
|
2492
|
+
function definePlaywrightConfig(baseConfig, options = {}, ...userConfigs) {
|
|
2493
|
+
if (PLAYWRIGHT_PACKAGES.every((p) => !isPackageExists(p))) throw new Error("Playwright rules require the \"playwright\" package to be installed.");
|
|
2494
|
+
let isInEditor = options.isInEditor;
|
|
2495
|
+
if (isInEditor === void 0) {
|
|
2496
|
+
isInEditor = isInEditorEnv();
|
|
2497
|
+
if (isInEditor) console.log("[@fabdeh/eslint-config] Detected running in editor, some rules are disabled.");
|
|
2498
|
+
}
|
|
2499
|
+
const workspaceOptions = baseConfig[OPTIONS_SYMBOL];
|
|
2500
|
+
const configs = [];
|
|
2501
|
+
if (options.ignores && options.ignores.length > 0) configs.push(ignores(options.ignores, "project"));
|
|
2502
|
+
if (workspaceOptions.typescript) configs.push(typescript({
|
|
2503
|
+
overrides: {},
|
|
2504
|
+
parserOptions: {},
|
|
2505
|
+
type: "app"
|
|
2506
|
+
}, true));
|
|
2507
|
+
configs.push(playwright(options));
|
|
2508
|
+
let composer = new FlatConfigComposer();
|
|
2509
|
+
composer = composer.append(baseConfig, ...configs, ...userConfigs);
|
|
2510
|
+
if (isInEditor) composer = composer.disableRulesFix(["prefer-const", "unused-imports/no-unused-imports"], { builtinRules: () => import("eslint/use-at-your-own-risk").then((m) => m.builtinRules) });
|
|
2511
|
+
return composer;
|
|
2512
|
+
}
|
|
2513
|
+
//#endregion
|
|
2465
2514
|
//#region src/factories/project-config.ts
|
|
2466
2515
|
/**
|
|
2467
2516
|
* Creates an ESLint configuration array based on the provided base configuration, options and user configurations.
|
|
@@ -2555,14 +2604,16 @@ function defineConfig(options = {}, ...userConfigs) {
|
|
|
2555
2604
|
if (enableNgrx && !enableAngular) throw new Error("NgRx rules can only be enabled if Angular rules are also enabled.");
|
|
2556
2605
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2557
2606
|
const configs = [];
|
|
2558
|
-
if (enableGitignore)
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2607
|
+
if (enableGitignore) {
|
|
2608
|
+
if (typeof enableGitignore === "object") configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2609
|
+
name: "fabdeh/gitignore",
|
|
2610
|
+
...enableGitignore
|
|
2611
|
+
})]));
|
|
2612
|
+
else configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2613
|
+
name: "fabdeh/gitignore",
|
|
2614
|
+
strict: true
|
|
2615
|
+
})]));
|
|
2616
|
+
}
|
|
2566
2617
|
configs.push(ignores(options.ignores), javascript({
|
|
2567
2618
|
isInEditor,
|
|
2568
2619
|
overrides: options.javascript?.overrides
|
|
@@ -2685,14 +2736,16 @@ function defineWorkspaceConfig(options = {}, ...userConfigs) {
|
|
|
2685
2736
|
}
|
|
2686
2737
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2687
2738
|
const configs = [];
|
|
2688
|
-
if (enableGitignore)
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2739
|
+
if (enableGitignore) {
|
|
2740
|
+
if (typeof enableGitignore === "object") configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2741
|
+
name: "fabdeh/gitignore",
|
|
2742
|
+
...enableGitignore
|
|
2743
|
+
})]));
|
|
2744
|
+
else configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2745
|
+
name: "fabdeh/gitignore",
|
|
2746
|
+
strict: true
|
|
2747
|
+
})]));
|
|
2748
|
+
}
|
|
2696
2749
|
configs.push(ignores(options.ignores, "workspace"), javascript({
|
|
2697
2750
|
isInEditor,
|
|
2698
2751
|
overrides: options.javascript?.overrides
|
|
@@ -2756,4 +2809,4 @@ function defineWorkspaceConfig(options = {}, ...userConfigs) {
|
|
|
2756
2809
|
return composerWithOptions;
|
|
2757
2810
|
}
|
|
2758
2811
|
//#endregion
|
|
2759
|
-
export { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, STYLISTIC_CONFIG_DEFAULT, angular, comments, convertPathToPosix, defineConfig, defineProjectConfig, defineWorkspaceConfig, ensurePackages, getPlaywrightDirectory, getTsConfigFileName, getWorkspaceRoot, ignores, imports, interopDefault, isDirectory, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, markdown, ngrx, node, pathToGlobPattern, perfectionist, playwright, pnpm, regexp, resolveSubOptions, sortPackageJson, sortTsConfig, stylistic, tailwindcss, toml, typescript, unicorn, vitest, yaml };
|
|
2812
|
+
export { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, STYLISTIC_CONFIG_DEFAULT, angular, comments, convertPathToPosix, defineConfig, definePlaywrightConfig, defineProjectConfig, defineWorkspaceConfig, ensurePackages, getPlaywrightDirectory, getTsConfigFileName, getWorkspaceRoot, ignores, imports, interopDefault, isDirectory, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, markdown, ngrx, node, pathToGlobPattern, perfectionist, playwright, pnpm, 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.
|
|
4
|
+
"version": "0.13.1",
|
|
5
5
|
"description": "My personal eslint config preset",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Fabien Dehopré",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
],
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"eslint": "^9.38.0 || ^10.0.0",
|
|
40
|
-
"eslint-plugin-better-tailwindcss": "^4.
|
|
40
|
+
"eslint-plugin-better-tailwindcss": "^4.7.0",
|
|
41
41
|
"eslint-plugin-erasable-syntax-only": "^0.4.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
@@ -49,83 +49,84 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@antfu/install-pkg": "^
|
|
53
|
-
"@clack/prompts": "^1.
|
|
52
|
+
"@antfu/install-pkg": "^2.0.1",
|
|
53
|
+
"@clack/prompts": "^1.7.0",
|
|
54
54
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
|
|
55
|
-
"@eslint/markdown": "^8.0.
|
|
55
|
+
"@eslint/markdown": "^8.0.3",
|
|
56
56
|
"@ngrx/eslint-plugin": "^21.1.1",
|
|
57
57
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
58
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
59
|
-
"@typescript-eslint/parser": "^8.
|
|
60
|
-
"@typescript-eslint/utils": "^8.
|
|
61
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
62
|
-
"angular-eslint": "^22.
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^8.66.0",
|
|
59
|
+
"@typescript-eslint/parser": "^8.66.0",
|
|
60
|
+
"@typescript-eslint/utils": "^8.66.0",
|
|
61
|
+
"@vitest/eslint-plugin": "^1.6.27",
|
|
62
|
+
"angular-eslint": "^22.1.0",
|
|
63
63
|
"empathic": "^2.0.1",
|
|
64
64
|
"eslint-config-flat-gitignore": "^2.3.0",
|
|
65
65
|
"eslint-flat-config-utils": "^3.2.0",
|
|
66
66
|
"eslint-merge-processors": "^2.0.0",
|
|
67
|
-
"eslint-plugin-import-x": "^4.
|
|
67
|
+
"eslint-plugin-import-x": "^4.17.1",
|
|
68
68
|
"eslint-plugin-jest-dom-ya": "^1.0.1",
|
|
69
|
-
"eslint-plugin-jsdoc": "^63.
|
|
70
|
-
"eslint-plugin-jsonc": "^3.
|
|
71
|
-
"eslint-plugin-n": "^18.
|
|
72
|
-
"eslint-plugin-perfectionist": "^5.
|
|
73
|
-
"eslint-plugin-playwright": "^2.
|
|
74
|
-
"eslint-plugin-pnpm": "^1.
|
|
75
|
-
"eslint-plugin-prefer-arrow-functions": "^3.
|
|
76
|
-
"eslint-plugin-regexp": "^3.1.
|
|
69
|
+
"eslint-plugin-jsdoc": "^63.3.3",
|
|
70
|
+
"eslint-plugin-jsonc": "^3.4.1",
|
|
71
|
+
"eslint-plugin-n": "^18.3.0",
|
|
72
|
+
"eslint-plugin-perfectionist": "^5.10.1",
|
|
73
|
+
"eslint-plugin-playwright": "^2.11.0",
|
|
74
|
+
"eslint-plugin-pnpm": "^1.7.0",
|
|
75
|
+
"eslint-plugin-prefer-arrow-functions": "^3.10.2",
|
|
76
|
+
"eslint-plugin-regexp": "^3.1.1",
|
|
77
77
|
"eslint-plugin-testing-library": "^7.16.2",
|
|
78
|
-
"eslint-plugin-toml": "^1.
|
|
78
|
+
"eslint-plugin-toml": "^1.5.0",
|
|
79
79
|
"eslint-plugin-unicorn": "^65.0.1",
|
|
80
80
|
"eslint-plugin-unused-imports": "^4.4.1",
|
|
81
|
-
"eslint-plugin-yml": "^3.
|
|
81
|
+
"eslint-plugin-yml": "^3.8.1",
|
|
82
82
|
"glob": "^13.0.6",
|
|
83
|
-
"globals": "^17.
|
|
84
|
-
"jsonc-eslint-parser": "^3.
|
|
83
|
+
"globals": "^17.9.0",
|
|
84
|
+
"jsonc-eslint-parser": "^3.3.0",
|
|
85
85
|
"local-pkg": "^1.2.1",
|
|
86
|
-
"typescript-eslint": "^8.
|
|
86
|
+
"typescript-eslint": "^8.66.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@angular/cli": "^22.
|
|
90
|
-
"@angular/core": "^22.
|
|
91
|
-
"@arethetypeswrong/cli": "^0.18.
|
|
92
|
-
"@commitlint/cli": "^21.
|
|
93
|
-
"@commitlint/config-conventional": "^21.0
|
|
94
|
-
"@commitlint/cz-commitlint": "^21.0
|
|
95
|
-
"@commitlint/lint": "^21.0
|
|
96
|
-
"@commitlint/load": "^21.0
|
|
89
|
+
"@angular/cli": "^22.1.3",
|
|
90
|
+
"@angular/core": "^22.1.1",
|
|
91
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
92
|
+
"@commitlint/cli": "^21.2.1",
|
|
93
|
+
"@commitlint/config-conventional": "^21.2.0",
|
|
94
|
+
"@commitlint/cz-commitlint": "^21.2.0",
|
|
95
|
+
"@commitlint/lint": "^21.2.0",
|
|
96
|
+
"@commitlint/load": "^21.2.0",
|
|
97
97
|
"@ngrx/effects": "^21.1.1",
|
|
98
98
|
"@ngrx/operators": "^21.1.1",
|
|
99
99
|
"@ngrx/signals": "^21.1.1",
|
|
100
100
|
"@ngrx/store": "^21.1.1",
|
|
101
|
-
"@testing-library/angular": "^19.4.
|
|
102
|
-
"@testing-library/
|
|
101
|
+
"@testing-library/angular": "^19.4.2",
|
|
102
|
+
"@testing-library/dom": "^10.4.1",
|
|
103
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
103
104
|
"@types/fs-extra": "^11.0.4",
|
|
104
|
-
"@types/node": "^24.13.
|
|
105
|
-
"@vitest/coverage-v8": "^4.1.
|
|
106
|
-
"@vitest/ui": "^4.1.
|
|
107
|
-
"bumpp": "^
|
|
105
|
+
"@types/node": "^24.13.3",
|
|
106
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
107
|
+
"@vitest/ui": "^4.1.10",
|
|
108
|
+
"bumpp": "^12.2.0",
|
|
108
109
|
"change-case": "^5.4.4",
|
|
109
|
-
"changelogithub": "^
|
|
110
|
+
"changelogithub": "^15.0.4",
|
|
110
111
|
"commitizen": "^4.3.2",
|
|
111
|
-
"eslint": "^10.
|
|
112
|
-
"eslint-plugin-better-tailwindcss": "^4.
|
|
112
|
+
"eslint": "^10.8.1",
|
|
113
|
+
"eslint-plugin-better-tailwindcss": "^4.7.0",
|
|
113
114
|
"eslint-plugin-erasable-syntax-only": "^0.4.2",
|
|
114
115
|
"eslint-typegen": "^2.3.1",
|
|
115
|
-
"execa": "^
|
|
116
|
-
"fs-extra": "^11.
|
|
116
|
+
"execa": "^10.0.1",
|
|
117
|
+
"fs-extra": "^11.4.0",
|
|
117
118
|
"is-ci": "^4.1.0",
|
|
118
119
|
"jiti": "^2.7.0",
|
|
119
120
|
"nano-staged": "^1.0.2",
|
|
120
|
-
"playwright": "^1.
|
|
121
|
-
"semver": "^7.8.
|
|
121
|
+
"playwright": "^1.62.1",
|
|
122
|
+
"semver": "^7.8.5",
|
|
122
123
|
"simple-git-hooks": "^2.13.1",
|
|
123
|
-
"tailwindcss": "^4.3.
|
|
124
|
-
"tsdown": "^0.22.
|
|
125
|
-
"tsx": "^4.
|
|
124
|
+
"tailwindcss": "^4.3.3",
|
|
125
|
+
"tsdown": "^0.22.14",
|
|
126
|
+
"tsx": "^4.23.12",
|
|
126
127
|
"typescript": "^6.0.3",
|
|
127
|
-
"vitest": "^4.1.
|
|
128
|
-
"@fabdeh/eslint-config": "0.
|
|
128
|
+
"vitest": "^4.1.10",
|
|
129
|
+
"@fabdeh/eslint-config": "0.13.1"
|
|
129
130
|
},
|
|
130
131
|
"simple-git-hooks": {
|
|
131
132
|
"pre-commit": "pnpm nano-staged",
|