@dpuse/eslint-config-dpuse 1.0.155 → 1.1.101
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/README.md +1 -1
- package/dist/index.d.ts +20 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -20
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ cd eslint-config-dpuse
|
|
|
45
45
|
npm install
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
_Requires [Node.js](https://nodejs.org/) 24 or later, [npm](https://www.npmjs.com/) 12 or later, and [TypeScript](https://www.typescriptlang.org/) 6.0.3
|
|
48
|
+
_Requires [Node.js](https://nodejs.org/) 24 or later, [npm](https://www.npmjs.com/) 12 or later, and [TypeScript](https://www.typescriptlang.org/) 6.0.3, TypeScript 7 is not supported as yet._
|
|
49
49
|
|
|
50
50
|
This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development). See the `scripts` block in [package.json](https://github.com/dpuse/eslint-config-dpuse/blob/main/package.json) for details.
|
|
51
51
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Linter } from 'eslint';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Options accepted by the shared DPUse base ESLint configuration, common to every DPUse project regardless of
|
|
4
|
+
* framework.
|
|
5
|
+
*/
|
|
3
6
|
export interface DPUseBaseESLintConfigOptions {
|
|
4
7
|
/** Glob patterns for the files to lint. */
|
|
5
8
|
files: string[];
|
|
@@ -14,13 +17,26 @@ export interface DPUseESLintConfigOptions extends Omit<DPUseBaseESLintConfigOpti
|
|
|
14
17
|
files?: string[];
|
|
15
18
|
/** Module specifiers that `import-x` should treat as resolvable core modules (e.g. `cloudflare:workers`). */
|
|
16
19
|
importCoreModules?: string[];
|
|
17
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Path to the consuming project's `tsconfig.json`, used by the import resolver. Defaults to `./tsconfig.json`, used
|
|
22
|
+
* by every DPUse project.
|
|
23
|
+
*/
|
|
18
24
|
tsconfigPath?: string;
|
|
19
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* The consuming project's root directory. Defaults to `process.cwd()`, correct as long as ESLint is run from the
|
|
27
|
+
* project root.
|
|
28
|
+
*/
|
|
20
29
|
tsconfigRootDir?: string;
|
|
21
30
|
}
|
|
22
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* The rules, plugins, and ignores shared by every DPUse project, TypeScript or otherwise (e.g. dpuse-app's Vue
|
|
33
|
+
* setup).
|
|
34
|
+
*/
|
|
23
35
|
export declare function dpuseBaseESLintConfig(options: DPUseBaseESLintConfigOptions): Linter.Config[];
|
|
36
|
+
/**
|
|
37
|
+
* The full DPUse ESLint configuration for a TypeScript project: the base configuration plus type-aware TypeScript
|
|
38
|
+
* rules.
|
|
39
|
+
*/
|
|
24
40
|
export declare function dpuseESLintConfig(options: DPUseESLintConfigOptions): Linter.Config[];
|
|
25
41
|
export default dpuseESLintConfig;
|
|
26
42
|
//# 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":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAarC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAarC;;;GAGG;AACH,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;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAUD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,GAAG,MAAM,CAAC,MAAM,EAAE,CAwE5F;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,CAqCpF;AAED,eAAe,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// ── External Dependencies & Registrations
|
|
2
2
|
import globals from 'globals';
|
|
3
|
-
import
|
|
3
|
+
import { recommended as pluginCommentsRecommended } from '@eslint-community/eslint-plugin-eslint-comments/configs';
|
|
4
4
|
import { flatConfigs as pluginImportFlatConfigs } from 'eslint-plugin-import-x';
|
|
5
5
|
import pluginJS from '@eslint/js';
|
|
6
6
|
import pluginN from 'eslint-plugin-n';
|
|
@@ -14,29 +14,22 @@ import { defineConfig, globalIgnores } from 'eslint/config';
|
|
|
14
14
|
// other languages without also telling ESLint to lint code files that the project's 'files' leave out.
|
|
15
15
|
const NON_CODE_FILES = ['**/*', '!**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx,vue}'];
|
|
16
16
|
// ── ESLint Configuration ─────────────────────────────────────────────────────────────────────────────────────────────
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* The rules, plugins, and ignores shared by every DPUse project, TypeScript or otherwise (e.g. dpuse-app's Vue
|
|
19
|
+
* setup).
|
|
20
|
+
*/
|
|
18
21
|
export function dpuseBaseESLintConfig(options) {
|
|
19
22
|
const { files, ignores = [], rules = {} } = options;
|
|
20
23
|
return defineConfig(
|
|
21
24
|
// Ignores.
|
|
22
25
|
globalIgnores(['bundle-analysis-reports/**', 'dependency-check-bin/**', 'dependency-check-reports/**', 'dist/**', 'licenses/**', ...ignores]),
|
|
23
|
-
// Plugin configurations and rule overrides. Limited to code files rather than 'files', so a script outside
|
|
24
|
-
// (e.g. a '.mjs' script) still gets the DPUse settings, while a file in another language (e.g. '.css')
|
|
25
|
-
// these JavaScript rules, which ESLint refuses to run on it.
|
|
26
|
+
// Plugin configurations and rule overrides. Limited to code files rather than 'files', so a script outside
|
|
27
|
+
// 'files' (e.g. a '.mjs' script) still gets the DPUse settings, while a file in another language (e.g. '.css')
|
|
28
|
+
// gets none of these JavaScript rules, which ESLint refuses to run on it.
|
|
26
29
|
{
|
|
27
30
|
ignores: NON_CODE_FILES,
|
|
28
31
|
extends: [
|
|
29
|
-
|
|
30
|
-
// '@eslint-community/eslint-comments' only ships a legacy config; manually convert to flat format.
|
|
31
|
-
plugins: { '@eslint-community/eslint-comments': pluginComments },
|
|
32
|
-
rules: {
|
|
33
|
-
'@eslint-community/eslint-comments/disable-enable-pair': 'error',
|
|
34
|
-
'@eslint-community/eslint-comments/no-aggregating-enable': 'error',
|
|
35
|
-
'@eslint-community/eslint-comments/no-duplicate-disable': 'error',
|
|
36
|
-
'@eslint-community/eslint-comments/no-unlimited-disable': 'error',
|
|
37
|
-
'@eslint-community/eslint-comments/no-unused-enable': 'error'
|
|
38
|
-
}
|
|
39
|
-
},
|
|
32
|
+
pluginCommentsRecommended,
|
|
40
33
|
pluginImportFlatConfigs.recommended,
|
|
41
34
|
{
|
|
42
35
|
plugins: { n: pluginN },
|
|
@@ -56,14 +49,16 @@ export function dpuseBaseESLintConfig(options) {
|
|
|
56
49
|
'unicorn/consistent-boolean-name': [
|
|
57
50
|
'error',
|
|
58
51
|
{
|
|
59
|
-
// DPUse convention: a boolean may lead with its subject, then the verb (viewportIsWide,
|
|
52
|
+
// DPUse convention: a boolean may lead with its subject, then the verb (viewportIsWide,
|
|
53
|
+
// viewportNeedsTopEdgeLine).
|
|
60
54
|
ignore: ['^[a-z]+(Is|Are|Has|Have|Can|Should|Was|Were|Did|Will|Requires|Needs)[A-Z]']
|
|
61
55
|
}
|
|
62
56
|
],
|
|
63
57
|
'unicorn/consistent-class-member-order': [
|
|
64
58
|
'error',
|
|
65
59
|
{
|
|
66
|
-
// DPUse convention: private helpers are positioned after the public methods that use them, not
|
|
60
|
+
// DPUse convention: private helpers are positioned after the public methods that use them, not
|
|
61
|
+
// before.
|
|
67
62
|
order: ['static-field', 'static-block', 'static-method', 'private-field', 'public-field', 'constructor', 'public-method', 'private-method']
|
|
68
63
|
}
|
|
69
64
|
],
|
|
@@ -87,10 +82,15 @@ export function dpuseBaseESLintConfig(options) {
|
|
|
87
82
|
}
|
|
88
83
|
});
|
|
89
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* The full DPUse ESLint configuration for a TypeScript project: the base configuration plus type-aware TypeScript
|
|
87
|
+
* rules.
|
|
88
|
+
*/
|
|
90
89
|
export function dpuseESLintConfig(options) {
|
|
91
90
|
const { files = ['eslint.config.js', 'src/**/*.ts', 'tests/**/*.ts', 'vite.config.ts', 'vitest.config.ts'], ignores = [], importCoreModules = [], rules = {}, tsconfigPath = './tsconfig.json', tsconfigRootDir: tsconfigRootDirectory = process.cwd() } = options;
|
|
92
91
|
return defineConfig(
|
|
93
|
-
// ESLint's own recommended rules. Before the TypeScript configs, which switch off the ones TypeScript checks
|
|
92
|
+
// ESLint's own recommended rules. Before the TypeScript configs, which switch off the ones TypeScript checks
|
|
93
|
+
// better.
|
|
94
94
|
{ ignores: NON_CODE_FILES, extends: [pluginJS.configs.recommended] },
|
|
95
95
|
// Plain JavaScript files in DPUse projects are Node scripts, so their Node globals ('console', 'process') are
|
|
96
96
|
// declared. TypeScript files need none, because TypeScript checks names itself.
|
|
@@ -100,7 +100,8 @@ export function dpuseESLintConfig(options) {
|
|
|
100
100
|
files,
|
|
101
101
|
extends: [...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked],
|
|
102
102
|
languageOptions: {
|
|
103
|
-
|
|
103
|
+
// The project service type-checks each file with its nearest 'tsconfig.json', as the editor does.
|
|
104
|
+
parserOptions: { projectService: true, tsconfigRootDir: tsconfigRootDirectory }
|
|
104
105
|
},
|
|
105
106
|
settings: {
|
|
106
107
|
'import-x/core-modules': importCoreModules,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,WAAW,IAAI,yBAAyB,EAAE,MAAM,yDAAyD,CAAC;AACnH,OAAO,EAAE,WAAW,IAAI,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,OAAO,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACtE,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;AAmC5D,wHAAwH;AAExH,qHAAqH;AACrH,uGAAuG;AACvG,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,2CAA2C,CAAC,CAAC;AAE7E,wHAAwH;AAExH;;;GAGG;AACH,MAAM,UAAU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GAA8G;IAC9G,gFAAgF;IAChF,EAAE,KAAK,EAAE,CAAC,mBAAmB,CAAC,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE;IAE5E,uEAAuE;IACvE;QACI,KAAK;QACL,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC,oBAAoB,CAAC;QAC1F,eAAe,EAAE;YACb,kGAAkG;YAClG,aAAa,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,eAAe,EAAE,qBAAqB,EAAE;SAClF;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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dpuse/eslint-config-dpuse",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.101",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Common ESLint configuration used across DPUse projects.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -67,13 +67,12 @@
|
|
|
67
67
|
"typescript-eslint": "^8.73.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@dpuse/dpuse-development": "^1.0.
|
|
70
|
+
"@dpuse/dpuse-development": "^1.0.162",
|
|
71
71
|
"@types/node": "^26.6.6",
|
|
72
72
|
"@vitest/coverage-v8": "^5.1.1",
|
|
73
73
|
"eslint": "^10.15.0",
|
|
74
74
|
"prettier": "^3.10.1",
|
|
75
75
|
"typescript": "^6.0.3",
|
|
76
|
-
"typescript-eslint": "^8.73.0",
|
|
77
76
|
"vitest": "^5.1.1"
|
|
78
77
|
}
|
|
79
78
|
}
|