@dpuse/eslint-config-dpuse 1.0.103 → 1.0.104
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/config.json +1 -1
- package/dist/index.d.ts +13 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +45 -30
package/config.json
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import type { Linter } from 'eslint';
|
|
2
|
-
/** Options accepted by the shared DPUse ESLint configuration
|
|
3
|
-
export interface
|
|
4
|
-
/** Glob patterns for the files to
|
|
5
|
-
files
|
|
2
|
+
/** Options accepted by the shared DPUse base ESLint configuration, common to every DPUse project regardless of framework. */
|
|
3
|
+
export interface DPUseBaseESLintConfigOptions {
|
|
4
|
+
/** Glob patterns for the files to lint. */
|
|
5
|
+
files: string[];
|
|
6
6
|
/** Extra glob patterns to ignore, on top of the standard DPUse build/report directories. */
|
|
7
7
|
ignores?: string[];
|
|
8
|
-
/** Module specifiers that `import-x` should treat as resolvable core modules (e.g. `cloudflare:workers`). */
|
|
9
|
-
importCoreModules?: string[];
|
|
10
8
|
/** Project-specific rule overrides, applied last so they take precedence over the shared defaults. */
|
|
11
9
|
rules?: Linter.RulesRecord;
|
|
10
|
+
}
|
|
11
|
+
/** Options accepted by the shared DPUse TypeScript ESLint configuration factory. */
|
|
12
|
+
export interface DPUseESLintConfigOptions extends Omit<DPUseBaseESLintConfigOptions, 'files'> {
|
|
13
|
+
/** Glob patterns for the files to type-check. Defaults to the common DPUse project layout. */
|
|
14
|
+
files?: string[];
|
|
15
|
+
/** Module specifiers that `import-x` should treat as resolvable core modules (e.g. `cloudflare:workers`). */
|
|
16
|
+
importCoreModules?: string[];
|
|
12
17
|
/** Path to the consuming project's `tsconfig.json`. Defaults to `./tsconfig.json`, used by every DPUse project. */
|
|
13
18
|
tsconfigPath?: string;
|
|
14
19
|
/** The consuming project's root directory. Defaults to `process.cwd()`, correct as long as ESLint is run from the project root. */
|
|
15
20
|
tsconfigRootDir?: string;
|
|
16
21
|
}
|
|
22
|
+
/** The rules, plugins, and ignores shared by every DPUse project, TypeScript or otherwise (e.g. dpuse-app's Vue setup). */
|
|
23
|
+
export declare function dpuseBaseESLintConfig(options: DPUseBaseESLintConfigOptions): Linter.Config[];
|
|
17
24
|
export declare function dpuseESLintConfig(options: DPUseESLintConfigOptions): Linter.Config[];
|
|
18
25
|
export default dpuseESLintConfig;
|
|
19
26
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAarC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAarC,6HAA6H;AAC7H,MAAM,WAAW,4BAA4B;IACzC,2CAA2C;IAC3C,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,4FAA4F;IAC5F,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,sGAAsG;IACtG,KAAK,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;CAC9B;AAED,oFAAoF;AACpF,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,4BAA4B,EAAE,OAAO,CAAC;IACzF,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,6GAA6G;IAC7G,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,mHAAmH;IACnH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mIAAmI;IACnI,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAID,2HAA2H;AAC3H,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,GAAG,MAAM,CAAC,MAAM,EAAE,CAmD5F;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,CA4BpF;AAED,eAAe,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,23 +8,10 @@ import skipFormatting from 'eslint-config-prettier';
|
|
|
8
8
|
import tseslint from 'typescript-eslint';
|
|
9
9
|
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
10
10
|
// ── ESLint Configuration ─────────────────────────────────────────────────────────────────────────────────────────────
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
/** The rules, plugins, and ignores shared by every DPUse project, TypeScript or otherwise (e.g. dpuse-app's Vue setup). */
|
|
12
|
+
export function dpuseBaseESLintConfig(options) {
|
|
13
|
+
const { files, ignores = [], rules = {} } = options;
|
|
13
14
|
return defineConfig(
|
|
14
|
-
// Linting scope, strict TypeScript type-checking, and module resolver.
|
|
15
|
-
{
|
|
16
|
-
files,
|
|
17
|
-
extends: [...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked],
|
|
18
|
-
languageOptions: {
|
|
19
|
-
parserOptions: { project: tsconfigPath, tsconfigRootDir: tsconfigRootDirectory }
|
|
20
|
-
},
|
|
21
|
-
settings: {
|
|
22
|
-
'import-x/core-modules': importCoreModules,
|
|
23
|
-
'import-x/resolver': {
|
|
24
|
-
typescript: { project: [tsconfigPath] }
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
15
|
// Ignores.
|
|
29
16
|
globalIgnores(['bundle-analysis-reports/**', 'dependency-check-bin/**', 'dependency-check-reports/**', 'dist/**', 'licenses/**', ...ignores]),
|
|
30
17
|
// Plugin configurations.
|
|
@@ -58,5 +45,23 @@ export function dpuseESLintConfig(options) {
|
|
|
58
45
|
}
|
|
59
46
|
});
|
|
60
47
|
}
|
|
48
|
+
export function dpuseESLintConfig(options) {
|
|
49
|
+
const { files = ['eslint.config.js', 'src/**/*.ts', 'vite.config.ts', 'vitest.config.ts'], ignores = [], importCoreModules = [], rules = {}, tsconfigPath = './tsconfig.json', tsconfigRootDir: tsconfigRootDirectory = process.cwd() } = options;
|
|
50
|
+
return defineConfig(
|
|
51
|
+
// Linting scope, strict TypeScript type-checking, and module resolver.
|
|
52
|
+
{
|
|
53
|
+
files,
|
|
54
|
+
extends: [...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked],
|
|
55
|
+
languageOptions: {
|
|
56
|
+
parserOptions: { project: tsconfigPath, tsconfigRootDir: tsconfigRootDirectory }
|
|
57
|
+
},
|
|
58
|
+
settings: {
|
|
59
|
+
'import-x/core-modules': importCoreModules,
|
|
60
|
+
'import-x/resolver': {
|
|
61
|
+
typescript: { project: [tsconfigPath] }
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, ...dpuseBaseESLintConfig({ files, ignores, rules }));
|
|
65
|
+
}
|
|
61
66
|
export default dpuseESLintConfig;
|
|
62
67
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,iDAAiD,CAAC;AAC7E,OAAO,EAAE,WAAW,IAAI,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAClD,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAClD,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|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,EAAE,qBAAqB,EAAE;SACnF;QACD,QAAQ,EAAE;YACN,uBAAuB,EAAE,iBAAiB;YAC1C,mBAAmB,EAAE;gBACjB,UAAU,EAAE,EAAE,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE;aAC1C;SACJ;KACJ,EAED,GAAG,qBAAqB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CACtD,CAAC;AACN,CAAC;AAED,eAAe,iBAAiB,CAAC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -12,16 +12,22 @@ import { defineConfig, globalIgnores } from 'eslint/config';
|
|
|
12
12
|
|
|
13
13
|
// ── Types ────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
14
14
|
|
|
15
|
-
/** Options accepted by the shared DPUse ESLint configuration
|
|
16
|
-
export interface
|
|
17
|
-
/** Glob patterns for the files to
|
|
18
|
-
files
|
|
15
|
+
/** Options accepted by the shared DPUse base ESLint configuration, common to every DPUse project regardless of framework. */
|
|
16
|
+
export interface DPUseBaseESLintConfigOptions {
|
|
17
|
+
/** Glob patterns for the files to lint. */
|
|
18
|
+
files: string[];
|
|
19
19
|
/** Extra glob patterns to ignore, on top of the standard DPUse build/report directories. */
|
|
20
20
|
ignores?: string[];
|
|
21
|
-
/** Module specifiers that `import-x` should treat as resolvable core modules (e.g. `cloudflare:workers`). */
|
|
22
|
-
importCoreModules?: string[];
|
|
23
21
|
/** Project-specific rule overrides, applied last so they take precedence over the shared defaults. */
|
|
24
22
|
rules?: Linter.RulesRecord;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Options accepted by the shared DPUse TypeScript ESLint configuration factory. */
|
|
26
|
+
export interface DPUseESLintConfigOptions extends Omit<DPUseBaseESLintConfigOptions, 'files'> {
|
|
27
|
+
/** Glob patterns for the files to type-check. Defaults to the common DPUse project layout. */
|
|
28
|
+
files?: string[];
|
|
29
|
+
/** Module specifiers that `import-x` should treat as resolvable core modules (e.g. `cloudflare:workers`). */
|
|
30
|
+
importCoreModules?: string[];
|
|
25
31
|
/** Path to the consuming project's `tsconfig.json`. Defaults to `./tsconfig.json`, used by every DPUse project. */
|
|
26
32
|
tsconfigPath?: string;
|
|
27
33
|
/** The consuming project's root directory. Defaults to `process.cwd()`, correct as long as ESLint is run from the project root. */
|
|
@@ -30,32 +36,11 @@ export interface DPUseESLintConfigOptions {
|
|
|
30
36
|
|
|
31
37
|
// ── ESLint Configuration ─────────────────────────────────────────────────────────────────────────────────────────────
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
ignores = [],
|
|
37
|
-
importCoreModules = [],
|
|
38
|
-
rules = {},
|
|
39
|
-
tsconfigPath = './tsconfig.json',
|
|
40
|
-
tsconfigRootDir: tsconfigRootDirectory = process.cwd()
|
|
41
|
-
} = options;
|
|
39
|
+
/** The rules, plugins, and ignores shared by every DPUse project, TypeScript or otherwise (e.g. dpuse-app's Vue setup). */
|
|
40
|
+
export function dpuseBaseESLintConfig(options: DPUseBaseESLintConfigOptions): Linter.Config[] {
|
|
41
|
+
const { files, ignores = [], rules = {} } = options;
|
|
42
42
|
|
|
43
43
|
return defineConfig(
|
|
44
|
-
// Linting scope, strict TypeScript type-checking, and module resolver.
|
|
45
|
-
{
|
|
46
|
-
files,
|
|
47
|
-
extends: [...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked],
|
|
48
|
-
languageOptions: {
|
|
49
|
-
parserOptions: { project: tsconfigPath, tsconfigRootDir: tsconfigRootDirectory }
|
|
50
|
-
},
|
|
51
|
-
settings: {
|
|
52
|
-
'import-x/core-modules': importCoreModules,
|
|
53
|
-
'import-x/resolver': {
|
|
54
|
-
typescript: { project: [tsconfigPath] }
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
|
|
59
44
|
// Ignores.
|
|
60
45
|
globalIgnores(['bundle-analysis-reports/**', 'dependency-check-bin/**', 'dependency-check-reports/**', 'dist/**', 'licenses/**', ...ignores]),
|
|
61
46
|
|
|
@@ -105,4 +90,34 @@ export function dpuseESLintConfig(options: DPUseESLintConfigOptions): Linter.Con
|
|
|
105
90
|
);
|
|
106
91
|
}
|
|
107
92
|
|
|
93
|
+
export function dpuseESLintConfig(options: DPUseESLintConfigOptions): Linter.Config[] {
|
|
94
|
+
const {
|
|
95
|
+
files = ['eslint.config.js', 'src/**/*.ts', 'vite.config.ts', 'vitest.config.ts'],
|
|
96
|
+
ignores = [],
|
|
97
|
+
importCoreModules = [],
|
|
98
|
+
rules = {},
|
|
99
|
+
tsconfigPath = './tsconfig.json',
|
|
100
|
+
tsconfigRootDir: tsconfigRootDirectory = process.cwd()
|
|
101
|
+
} = options;
|
|
102
|
+
|
|
103
|
+
return defineConfig(
|
|
104
|
+
// Linting scope, strict TypeScript type-checking, and module resolver.
|
|
105
|
+
{
|
|
106
|
+
files,
|
|
107
|
+
extends: [...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked],
|
|
108
|
+
languageOptions: {
|
|
109
|
+
parserOptions: { project: tsconfigPath, tsconfigRootDir: tsconfigRootDirectory }
|
|
110
|
+
},
|
|
111
|
+
settings: {
|
|
112
|
+
'import-x/core-modules': importCoreModules,
|
|
113
|
+
'import-x/resolver': {
|
|
114
|
+
typescript: { project: [tsconfigPath] }
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
...dpuseBaseESLintConfig({ files, ignores, rules })
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
108
123
|
export default dpuseESLintConfig;
|