@open-xchange/linter-presets 1.30.7 → 1.31.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/CHANGELOG.md +14 -1
- package/README.md +1 -1
- package/dist/eslint/index.d.mts +38 -28
- package/dist/eslint/index.d.mts.map +1 -1
- package/dist/eslint/index.mjs +58 -54
- package/dist/eslint/index.mjs.map +1 -1
- package/dist/{resolver-Nkg5OKUN.mjs → resolver-CKKbaGEf.mjs} +3 -1
- package/dist/resolver-CKKbaGEf.mjs.map +1 -0
- package/dist/stylelint/index.d.mts +11 -9
- package/dist/stylelint/index.d.mts.map +1 -1
- package/dist/stylelint/index.mjs +30 -79
- package/dist/stylelint/index.mjs.map +1 -1
- package/docs/eslint/README.md +1 -1
- package/docs/eslint/env/project.md +2 -2
- package/docs/stylelint/README.md +4 -4
- package/package.json +18 -18
- package/dist/resolver-Nkg5OKUN.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [1.31.1] - 2026-10-26
|
|
6
|
+
|
|
7
|
+
- fixed: (ESLint) `env.react` keeps the TypeScript parser for JSX files, as the configuration `strict-type-checked` of `@eslint-react/eslint-plugin` now overrides the language options (type-checked rules failed with missing type information)
|
|
8
|
+
- chore: bump dependencies
|
|
9
|
+
|
|
10
|
+
## [1.31.0] - 2026-10-05
|
|
11
|
+
|
|
12
|
+
- changed: (ESLint) disable all rules of `eslint-plugin-react-hooks` that are also implemented in `@eslint-react/eslint-plugin`, using the configuration `disable-conflict-eslint-plugin-react-hooks` of that plugin; enable rule `@eslint-react/globals`
|
|
13
|
+
- changed: (StyleLint) pass extension and plugin packages as absolute paths resolved with `import.meta.resolve()` instead of importing all packages eagerly and replacing them in the configuration
|
|
14
|
+
- fixed: (ESLint) re-enable rule `@typescript-eslint/no-unnecessary-type-arguments` (the bug in `typescript-eslint` has been fixed upstream)
|
|
15
|
+
|
|
5
16
|
## [1.30.7] - 2026-10-01
|
|
6
17
|
|
|
7
18
|
- chore: plain https repository URL, so that Renovate shows links and release notes in merge requests
|
|
@@ -936,7 +947,9 @@
|
|
|
936
947
|
- added: (ESLint) project configuration (core, js, ts, json, yaml, license, directives, promises, jsdoc, stylistic)
|
|
937
948
|
- added: (ESLint) environment presets (tsconfig, node, browser, jest, vitest, codecept, react, plugin)
|
|
938
949
|
|
|
939
|
-
[Unreleased]: https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/compare/linter-presets-1.
|
|
950
|
+
[Unreleased]: https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/compare/linter-presets-1.31.1...main
|
|
951
|
+
[1.31.1]: https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/compare/linter-presets-1.31.0...linter-presets-1.31.1
|
|
952
|
+
[1.31.0]: https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/compare/linter-presets-1.30.7...linter-presets-1.31.0
|
|
940
953
|
[1.30.7]: https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/compare/linter-presets-1.30.6...linter-presets-1.30.7
|
|
941
954
|
[1.30.6]: https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/compare/linter-presets-1.30.5...linter-presets-1.30.6
|
|
942
955
|
[1.30.5]: https://gitlab.com/openxchange/appsuite/documents/commons/plugins/-/compare/linter-presets-1.30.4...linter-presets-1.30.5
|
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ The module `stylelint` exports a `defineConfig` function for setting up the enti
|
|
|
41
41
|
_Usage example:_
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
|
-
// stylelint.config.
|
|
44
|
+
// stylelint.config.ts
|
|
45
45
|
import { defineConfig } from '@open-xchange/linter-presets/stylelint'
|
|
46
46
|
|
|
47
47
|
export default defineConfig({
|
package/dist/eslint/index.d.mts
CHANGED
|
@@ -12,6 +12,8 @@ declare class PathResolver {
|
|
|
12
12
|
#private;
|
|
13
13
|
constructor(url: string);
|
|
14
14
|
/**
|
|
15
|
+
* Returns the directory path of the URL passed to the constructor.
|
|
16
|
+
*
|
|
15
17
|
* @returns
|
|
16
18
|
* The directory path of the URL passed to the constructor.
|
|
17
19
|
*/
|
|
@@ -47,8 +49,8 @@ interface LanguageOptions {
|
|
|
47
49
|
/**
|
|
48
50
|
* Specifies how to treat `.js`, `.jsx`, `.ts`, and `.tsx` files.
|
|
49
51
|
*
|
|
50
|
-
* - 'module': The files will be
|
|
51
|
-
* - 'commonjs': The files will be
|
|
52
|
+
* - 'module': The files will be parsed as ES modules.
|
|
53
|
+
* - 'commonjs': The files will be parsed as CommonJS modules.
|
|
52
54
|
*
|
|
53
55
|
* @default 'module'
|
|
54
56
|
*/
|
|
@@ -105,9 +107,7 @@ interface StylisticOptions {
|
|
|
105
107
|
indent?: number;
|
|
106
108
|
/**
|
|
107
109
|
* Indentation (number of space characters) overrides for specific file
|
|
108
|
-
* types.
|
|
109
|
-
*
|
|
110
|
-
* @default 2
|
|
110
|
+
* types. Each file type defaults to the value of `indent`.
|
|
111
111
|
*/
|
|
112
112
|
indentOverrides?: IndentOverridesOptions;
|
|
113
113
|
/**
|
|
@@ -125,7 +125,7 @@ interface StylisticOptions {
|
|
|
125
125
|
/**
|
|
126
126
|
* The type of the string delimiter character.
|
|
127
127
|
*
|
|
128
|
-
* Affects rule `@stylistic/
|
|
128
|
+
* Affects rule `@stylistic/quotes`.
|
|
129
129
|
*
|
|
130
130
|
* @default 'single'
|
|
131
131
|
*/
|
|
@@ -148,12 +148,12 @@ interface StylisticOptions {
|
|
|
148
148
|
* Specifies whether to expect whitespace between function names and
|
|
149
149
|
* parentheses. Does not affect anonymous functions and `catch` clauses.
|
|
150
150
|
*
|
|
151
|
-
* Affects rule `@stylistic/space-before-function-paren`.
|
|
152
|
-
*
|
|
153
151
|
* - 'always': Spacing between function name and parenthesis required.
|
|
154
152
|
* - 'never': Spacing between function name and parenthesis forbidden.
|
|
155
153
|
* - 'off': Spacing between function name and parenthesis will be ignored.
|
|
156
154
|
*
|
|
155
|
+
* Affects rule `@stylistic/space-before-function-paren`.
|
|
156
|
+
*
|
|
157
157
|
* @default 'off'
|
|
158
158
|
*/
|
|
159
159
|
funcSpacing?: 'always' | 'never' | 'off';
|
|
@@ -164,7 +164,7 @@ interface StylisticOptions {
|
|
|
164
164
|
interface EnvFilesOptions {
|
|
165
165
|
/**
|
|
166
166
|
* Path to a sub directory to apply the environment preset to. The options
|
|
167
|
-
* 'files' and 'ignores' will be interpreted
|
|
167
|
+
* 'files' and 'ignores' will be interpreted relative to this path.
|
|
168
168
|
*
|
|
169
169
|
* @default '.'
|
|
170
170
|
*/
|
|
@@ -358,14 +358,14 @@ declare function browser(envOptions: EnvBrowserOptions): ConfigArg;
|
|
|
358
358
|
interface EnvUnitTestOptions extends EnvBaseOptions {
|
|
359
359
|
/**
|
|
360
360
|
* Specifies whether to include `eslint-plugin-jest-extended`. Should only be
|
|
361
|
-
* used
|
|
361
|
+
* used if the package `jest-extended` has been installed in the project.
|
|
362
362
|
*
|
|
363
363
|
* @default false
|
|
364
364
|
*/
|
|
365
365
|
jestExtended?: boolean;
|
|
366
366
|
/**
|
|
367
367
|
* Specifies whether to include `eslint-plugin-jest-dom`. Should only be
|
|
368
|
-
* used
|
|
368
|
+
* used if the package `@testing-library/jest-dom` has been installed in the
|
|
369
369
|
* project.
|
|
370
370
|
*
|
|
371
371
|
* @default false
|
|
@@ -411,7 +411,7 @@ interface EnvVitestOptions extends EnvUnitTestOptions {}
|
|
|
411
411
|
* tests using Vitest.
|
|
412
412
|
*
|
|
413
413
|
* Wraps the following packages:
|
|
414
|
-
* -
|
|
414
|
+
* - `@vitest/eslint-plugin`
|
|
415
415
|
* - `eslint-plugin-jest-extended`
|
|
416
416
|
* - `eslint-plugin-jest-dom`
|
|
417
417
|
* - `eslint-plugin-testing-library`
|
|
@@ -453,7 +453,7 @@ interface EnvReactOptions extends EnvBaseOptions {
|
|
|
453
453
|
/**
|
|
454
454
|
* Additional hooks that will be treated as state hooks, like 'useState'.
|
|
455
455
|
*
|
|
456
|
-
* Will be used by the rule '@eslint-react/set-state-in-effect'.
|
|
456
|
+
* Will be used by the rule '@eslint-react/set-state-in-effect' and others.
|
|
457
457
|
*/
|
|
458
458
|
stateHooks?: readonly string[];
|
|
459
459
|
/**
|
|
@@ -467,7 +467,7 @@ interface EnvReactOptions extends EnvBaseOptions {
|
|
|
467
467
|
/**
|
|
468
468
|
* Additional hooks that will be treated as effect hooks, like 'useEffect'.
|
|
469
469
|
*
|
|
470
|
-
* Will be used by the rule '@eslint-react/rules-of-hooks'.
|
|
470
|
+
* Will be used by the rule '@eslint-react/rules-of-hooks' and others.
|
|
471
471
|
*/
|
|
472
472
|
effectHooks?: readonly string[];
|
|
473
473
|
}
|
|
@@ -475,6 +475,7 @@ interface EnvReactOptions extends EnvBaseOptions {
|
|
|
475
475
|
* Creates configuration objects with linter rules for ReactJS.
|
|
476
476
|
*
|
|
477
477
|
* Wraps the following packages:
|
|
478
|
+
* - `@eslint-react/kit`
|
|
478
479
|
* - `@eslint-react/eslint-plugin`
|
|
479
480
|
* - `eslint-plugin-react-hooks`
|
|
480
481
|
* - `eslint-plugin-react-refresh`
|
|
@@ -524,7 +525,9 @@ interface SharedRuleSettings {
|
|
|
524
525
|
*/
|
|
525
526
|
interface RuleNoInvalidModulesOptions {
|
|
526
527
|
/**
|
|
527
|
-
*
|
|
528
|
+
* Glob patterns for module names that are neither project source files nor
|
|
529
|
+
* installed packages, e.g. virtual modules of a bundler. Matching imports
|
|
530
|
+
* are accepted without further checks.
|
|
528
531
|
*/
|
|
529
532
|
external?: string[];
|
|
530
533
|
}
|
|
@@ -536,7 +539,9 @@ interface RuleNoInvalidModulesOptions {
|
|
|
536
539
|
*/
|
|
537
540
|
interface RuleNoInvalidHierarchyPackage {
|
|
538
541
|
/**
|
|
539
|
-
* Glob patterns
|
|
542
|
+
* Glob patterns matching the module names (project-relative paths without
|
|
543
|
+
* file extension, with alias prefix if configured) of all modules in the
|
|
544
|
+
* package.
|
|
540
545
|
*/
|
|
541
546
|
files: string[];
|
|
542
547
|
/**
|
|
@@ -547,9 +552,8 @@ interface RuleNoInvalidHierarchyPackage {
|
|
|
547
552
|
/**
|
|
548
553
|
* Set to `true` to mark an optional package that may be missing in an
|
|
549
554
|
* installation. Such a package cannot be imported statically (with `import`
|
|
550
|
-
* statement) from
|
|
551
|
-
*
|
|
552
|
-
* of optional code as an error.
|
|
555
|
+
* statement) from any other package, but can only be loaded dynamically at
|
|
556
|
+
* runtime (by calling `import()`).
|
|
553
557
|
*
|
|
554
558
|
* @default false
|
|
555
559
|
*/
|
|
@@ -567,11 +571,13 @@ interface EnvProjectOptions extends EnvBaseOptions {
|
|
|
567
571
|
*/
|
|
568
572
|
alias?: SharedRuleSettings['alias'];
|
|
569
573
|
/**
|
|
570
|
-
*
|
|
574
|
+
* Glob patterns for external modules, passed as option 'external' to the
|
|
575
|
+
* rule 'env-project/no-invalid-modules'.
|
|
571
576
|
*/
|
|
572
577
|
external?: RuleNoInvalidModulesOptions['external'];
|
|
573
578
|
/**
|
|
574
|
-
* Options to be passed to the rule 'env-project/no-invalid-hierarchy'.
|
|
579
|
+
* Options to be passed to the rule 'env-project/no-invalid-hierarchy'. If
|
|
580
|
+
* omitted, the rule will be disabled.
|
|
575
581
|
*/
|
|
576
582
|
hierarchy?: RuleNoInvalidHierarchyOptions;
|
|
577
583
|
}
|
|
@@ -597,7 +603,8 @@ interface EnvTSConfigOptions extends EnvBaseOptions {
|
|
|
597
603
|
project: string;
|
|
598
604
|
}
|
|
599
605
|
/**
|
|
600
|
-
*
|
|
606
|
+
* Binds type-aware linter rules to an explicit TypeScript project
|
|
607
|
+
* configuration file instead of the automatic project service.
|
|
601
608
|
*
|
|
602
609
|
* @param envOptions
|
|
603
610
|
* Configuration options for the environment.
|
|
@@ -608,12 +615,15 @@ interface EnvTSConfigOptions extends EnvBaseOptions {
|
|
|
608
615
|
declare function tsconfig(envOptions: EnvTSConfigOptions): ConfigArg;
|
|
609
616
|
//#endregion
|
|
610
617
|
//#region src/eslint/env/decorators.d.ts
|
|
618
|
+
/**
|
|
619
|
+
* Configuration options for the environment preset 'env.decorators'.
|
|
620
|
+
*/
|
|
621
|
+
interface EnvDecoratorsOptions extends EnvBaseOptions {}
|
|
611
622
|
/**
|
|
612
623
|
* Adds support for native decorators in JavaScript source files.
|
|
613
624
|
*
|
|
614
625
|
* Wraps the following packages:
|
|
615
|
-
* - `@babel/eslint-parser`
|
|
616
|
-
* - `@babel/plugin-proposal-decorators`
|
|
626
|
+
* - `@babel/eslint-parser` with syntax plugin `decorators`
|
|
617
627
|
*
|
|
618
628
|
* @param envOptions
|
|
619
629
|
* Configuration options for the environment.
|
|
@@ -621,7 +631,7 @@ declare function tsconfig(envOptions: EnvTSConfigOptions): ConfigArg;
|
|
|
621
631
|
* @returns
|
|
622
632
|
* The configuration entries to be added to the resulting configuration array.
|
|
623
633
|
*/
|
|
624
|
-
declare function decorators(envOptions:
|
|
634
|
+
declare function decorators(envOptions: EnvDecoratorsOptions): ConfigArg;
|
|
625
635
|
//#endregion
|
|
626
636
|
//#region src/eslint/index.d.ts
|
|
627
637
|
/**
|
|
@@ -629,8 +639,8 @@ declare function decorators(envOptions: EnvBaseOptions): ConfigArg;
|
|
|
629
639
|
*/
|
|
630
640
|
export interface ProjectOptions {
|
|
631
641
|
/**
|
|
632
|
-
* The URL of the
|
|
633
|
-
*
|
|
642
|
+
* The URL of the ESLint configuration file in the project root. Should
|
|
643
|
+
* usually be set to `import.meta.url`.
|
|
634
644
|
*/
|
|
635
645
|
root: string;
|
|
636
646
|
/**
|
|
@@ -685,7 +695,7 @@ export declare const env: {
|
|
|
685
695
|
* Options for the base configuration that will be generated.
|
|
686
696
|
*
|
|
687
697
|
* @param configs
|
|
688
|
-
* Additional configuration entries
|
|
698
|
+
* Additional configuration entries. Each entry may be a callback function
|
|
689
699
|
* that will be invoked with a `PathResolver` utility.
|
|
690
700
|
*
|
|
691
701
|
* @returns
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["ConfigObject","RulesConfig"],"sources":["../../src/utils/resolver.ts","../../src/utils/utils.ts","../../src/eslint/shared/env-utils.ts","../../src/eslint/core/vue.ts","../../src/eslint/shared/restricted.ts","../../src/eslint/env/node.ts","../../src/eslint/env/browser.ts","../../src/eslint/shared/unittest.ts","../../src/eslint/env/jest.ts","../../src/eslint/env/vitest.ts","../../src/eslint/env/codecept.ts","../../src/eslint/env/react.ts","../../src/eslint/env/eslint.ts","../../src/eslint/shared/rule-utils.ts","../../src/eslint/rules/project/noInvalidModules.ts","../../src/eslint/rules/project/noInvalidHierarchy.ts","../../src/eslint/env/project.ts","../../src/eslint/env/tsconfig.ts","../../src/eslint/env/decorators.ts","../../src/eslint/index.ts"],"mappings":";;;;;;;;;;cASa;;EAKC,YAAA
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["ConfigObject","RulesConfig"],"sources":["../../src/utils/resolver.ts","../../src/utils/utils.ts","../../src/eslint/shared/env-utils.ts","../../src/eslint/core/vue.ts","../../src/eslint/shared/restricted.ts","../../src/eslint/env/node.ts","../../src/eslint/env/browser.ts","../../src/eslint/shared/unittest.ts","../../src/eslint/env/jest.ts","../../src/eslint/env/vitest.ts","../../src/eslint/env/codecept.ts","../../src/eslint/env/react.ts","../../src/eslint/env/eslint.ts","../../src/eslint/shared/rule-utils.ts","../../src/eslint/rules/project/noInvalidModules.ts","../../src/eslint/rules/project/noInvalidHierarchy.ts","../../src/eslint/env/project.ts","../../src/eslint/env/tsconfig.ts","../../src/eslint/env/decorators.ts","../../src/eslint/index.ts"],"mappings":";;;;;;;;;;cASa;;EAKC,YAAA;;;;;;;MAWR;;;;;;;;;;EAaJ,KAAK;;;;KC/BK,aAAa,KAAK,+BAA+B,cAAc,aAAa;;;KCK5E,SAASA,iBAAe,oBAAoB,OAAO,SAAS,SAAS,WAAW;KAEhF,YAAY,aAAa;;;;UAOpB;;;;;;EAOf,cAAc,OAAO;;;;;;;;;EAUrB;;;;;UAae;;;;;EAMf;;;;EAKA;;;;;UAae;;;;EAKf;;;;EAKA;;;;EAKA;;;;EAKA;;;;;UAMe;;;;;;;;;;EAWf;;;;;EAMA,kBAAkB;;;;;;;;;;;;EAalB;;;;;;;;EASA;;;;;;;;;;;;;;EAeA;;;;;;;;;;;;;EAcA;;;;;UAae;;;;;;;EAQf;;;;;;EAOA,OAAO;;;;;;EAOP;;;;;;UASe,uBAAuB;;;;EAKtC,QAAQC;;;;;;;UC5MO;;;;;EAMf;;;;;;;UCRe;EACf;EACA;;;;;UAMe;EACf;EACA;EACA;;;;;UAMe;EACf;EACA;;;;;UAMe;;EAEf,UAAU;;EAEV,UAAU;;EAEV,aAAa;;EAEb,SAAS;;;;;;UAOM,8BAA8B,iBAAiB;;;;;UAM/C,4BAA4B;;;;;;EAO3C,YAAY;;;;;;UAOG,6BAA6B;;;;;EAM5C,aAAa;;;;KCpEH,6BAA6B,iBAAiB;;;;;KAM9C,2BAA2B,eAAe;;;;;UAMrC;EACf;EACA;EACA,SAAS;;;;;UAMM;EACf;EACA;EACA;EACA,cAAc,2BAA2B;EACzC;EACA;EACA,yBAAyB,GAAG,OAAO,SAAS,UAAU;;;;;UAMvC,uBAAuB;;;;;;EAOtC,aAAa;;;;;EAMb,WAAW;;;;;;;;;;;;;;;iBAkBW,KAAK,YAAY,iBAAiB;;;;;;UC7DzC,0BAA0B;;;;;;;;;;;;;;;;iBAmGnB,QAAQ,YAAY,oBAAoB;;;;;;UCpG/C,2BAA2B;;;;;;;EAQ1C;;;;;;;;EASA;;;;;EAMA;;;;;;;UCzBe,uBAAuB;;;;;;;;;;;;;;;;;iBAoBhB,KAAK,YAAY,iBAAiB;;;;;;UCpBzC,yBAAyB;;;;;;;;;;;;;;;;;iBAoBlB,OAAO,YAAY,mBAAmB;;;;;;UCnB7C,2BAA2B;;;;;;;;;;;;;;;iBAkBpB,SAAS,YAAY,qBAAqB;;;;;;UCXjD,wBAAwB;;;;;;EAOvC;;;;;;;;EASA;;;;;;EAOA;;;;;;;;;;;;;;;;;;iBAqBsB,MAAM,YAAY,kBAAkB;;;;;;UCpD3C,yBAAyB;;;;;;;;;;;;;iBAgBlB,OAAO,YAAY,mBAAmB;;;;;;UCT7C;;;;EAKf,QAAQ;;;;;;;UCZO;;;;;;EAOf;;;;;;;;UCNe;;;;;;EAOf;;;;;EAMA;;;;;;;;;EAUA;;KAKU,gCAAgC,eAAe;;;;;;UC3B1C,0BAA0B;;;;EAKzC,QAAQ;;;;;EAMR,WAAW;;;;;EAMX,YAAY;;;;;;;;;;;iBAcU,QAAQ,YAAY,oBAAoB;;;;;;UCnC/C,2BAA2B;;;;EAK1C;;;;;;;;;;;;iBAesB,SAAS,YAAY,qBAAqB;;;;;;UClBjD,6BAA6B;;;;;;;;;;;;;iBAgBtB,WAAW,YAAY,uBAAuB;;;;;;iBCerD;;;;;EAMf;;;;EAKA;;;;;EAMA;;;;EAKA,WAAW;;;;EAKX,WAAW;;;;EAKX,YAAY;;;;EAKZ,MAAM;;;;EAKN,QAAQ;;;;;qBAQG;;;;;;;;;;;;;;;;;;;;;;;;;;wBA6BG,aAAa,SAAS,mBAAmB,SAAS,MAAM,cAAc,UAAU,iBAAiB,cAAc"}
|
package/dist/eslint/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PathResolver } from "../resolver-
|
|
1
|
+
import { t as PathResolver } from "../resolver-CKKbaGEf.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { defineConfig as defineConfig$1, globalIgnores } from "@eslint/config-helpers";
|
|
4
4
|
import { dirname, extname, posix, sep } from "node:path";
|
|
@@ -67,7 +67,7 @@ function* yieldDeepArrays(...arrays) {
|
|
|
67
67
|
* The deeply nested arrays to be flattened.
|
|
68
68
|
*
|
|
69
69
|
* @returns
|
|
70
|
-
*
|
|
70
|
+
* A flat array with all truthy elements.
|
|
71
71
|
*/
|
|
72
72
|
function flattenDeepArrays(...arrays) {
|
|
73
73
|
return [...yieldDeepArrays(...arrays)];
|
|
@@ -136,14 +136,14 @@ const NO_IMPLICIT_COERCION_OPTIONS = {
|
|
|
136
136
|
allow: ["!!"]
|
|
137
137
|
};
|
|
138
138
|
/**
|
|
139
|
-
* Creates
|
|
139
|
+
* Creates glob patterns deeply matching all files with the specified file
|
|
140
140
|
* extensions.
|
|
141
141
|
*
|
|
142
142
|
* @param extensions
|
|
143
|
-
* The file extensions to be converted to
|
|
143
|
+
* The file extensions to be converted to glob patterns.
|
|
144
144
|
*
|
|
145
145
|
* @returns
|
|
146
|
-
* The glob
|
|
146
|
+
* The glob patterns for the specified file extensions.
|
|
147
147
|
*/
|
|
148
148
|
function extGlob(extensions) {
|
|
149
149
|
return extensions.map((ext) => "**/*." + ext);
|
|
@@ -195,12 +195,12 @@ function createConfig(name, envOptions, config, rules) {
|
|
|
195
195
|
*
|
|
196
196
|
* @param rules
|
|
197
197
|
* Hard-coded rule settings to be configured by the environment itself. These
|
|
198
|
-
* rule settings will precede the rules contained in 'envOptions',
|
|
199
|
-
*
|
|
198
|
+
* rule settings will precede the rules contained in 'envOptions', so that the
|
|
199
|
+
* rules in 'envOptions' can override them.
|
|
200
200
|
*
|
|
201
201
|
* @returns
|
|
202
|
-
* The resulting configuration entry, if the environment options
|
|
203
|
-
*
|
|
202
|
+
* The resulting configuration entry, if `rules` or the environment options
|
|
203
|
+
* contain rule settings, otherwise `undefined`.
|
|
204
204
|
*/
|
|
205
205
|
function customRules(name, envOptions, rules) {
|
|
206
206
|
return (rules ?? envOptions.rules) && createConfig(name, envOptions, { rules: {
|
|
@@ -217,7 +217,7 @@ function customRules(name, envOptions, rules) {
|
|
|
217
217
|
* The configuration objects to be fixed.
|
|
218
218
|
*
|
|
219
219
|
* @returns
|
|
220
|
-
* The fixed configuration
|
|
220
|
+
* The fixed configuration objects.
|
|
221
221
|
*/
|
|
222
222
|
function fixMissingFilesOption(...configs) {
|
|
223
223
|
const flatConfigs = flattenDeepArrays(configs);
|
|
@@ -228,8 +228,8 @@ function fixMissingFilesOption(...configs) {
|
|
|
228
228
|
} : config) : flatConfigs;
|
|
229
229
|
}
|
|
230
230
|
/**
|
|
231
|
-
* Converts severity '
|
|
232
|
-
*
|
|
231
|
+
* Converts severity 'warn' of all rules in the passed configuration entry to
|
|
232
|
+
* severity 'error'.
|
|
233
233
|
*
|
|
234
234
|
* @template T
|
|
235
235
|
* The exact type of the passed configuration.
|
|
@@ -320,7 +320,7 @@ function createRulesConfig(generator) {
|
|
|
320
320
|
* The custom items for restricted rules to be merged.
|
|
321
321
|
*
|
|
322
322
|
* @returns
|
|
323
|
-
* The
|
|
323
|
+
* The merged item lists.
|
|
324
324
|
*/
|
|
325
325
|
function mergeRestrictedItems(...restrictedItems) {
|
|
326
326
|
return {
|
|
@@ -350,7 +350,7 @@ function builtinRestrictedRules() {
|
|
|
350
350
|
return createRulesConfig((key) => items[key]);
|
|
351
351
|
}
|
|
352
352
|
/**
|
|
353
|
-
* Generates various 'no-restricted
|
|
353
|
+
* Generates various 'no-restricted-*' rules from the passed configuration.
|
|
354
354
|
*
|
|
355
355
|
* @param baseName
|
|
356
356
|
* Base name for the configuration objects.
|
|
@@ -521,7 +521,7 @@ function js() {
|
|
|
521
521
|
//#endregion
|
|
522
522
|
//#region src/eslint/core/ts.ts
|
|
523
523
|
/**
|
|
524
|
-
* Names of all `typescript-eslint` presets to be included
|
|
524
|
+
* Names of all `typescript-eslint` presets to be included.
|
|
525
525
|
*/
|
|
526
526
|
const TSESLINT_PRESETS = ["strictTypeChecked", "stylisticTypeChecked"];
|
|
527
527
|
/**
|
|
@@ -562,7 +562,6 @@ const TSESLINT_RULES = {
|
|
|
562
562
|
"@typescript-eslint/no-redeclare": "error",
|
|
563
563
|
"@typescript-eslint/no-shadow": ["error", { ignoreOnInitialization: true }],
|
|
564
564
|
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
565
|
-
"@typescript-eslint/no-unnecessary-type-arguments": "off",
|
|
566
565
|
"@typescript-eslint/no-unnecessary-type-conversion": "error",
|
|
567
566
|
"@typescript-eslint/no-unnecessary-type-parameters": "off",
|
|
568
567
|
"@typescript-eslint/no-unsafe-declaration-merging": "off",
|
|
@@ -640,7 +639,7 @@ function ts(rootDir) {
|
|
|
640
639
|
* Resolved stylistic configuration options.
|
|
641
640
|
*
|
|
642
641
|
* @param vueOptions
|
|
643
|
-
* Additional configuration for Vue
|
|
642
|
+
* Additional configuration for Vue-specific rules.
|
|
644
643
|
*
|
|
645
644
|
* @returns
|
|
646
645
|
* The configuration entries to be added to the resulting configuration array.
|
|
@@ -839,7 +838,7 @@ function license(path) {
|
|
|
839
838
|
* Checks inline linter directives.
|
|
840
839
|
*
|
|
841
840
|
* Wraps the following packages:
|
|
842
|
-
* -
|
|
841
|
+
* - `@eslint-community/eslint-plugin-eslint-comments`
|
|
843
842
|
*
|
|
844
843
|
* @returns
|
|
845
844
|
* The configuration entries to be added to the resulting configuration array.
|
|
@@ -1263,7 +1262,8 @@ function browser(envOptions) {
|
|
|
1263
1262
|
//#region src/eslint/shared/unittest.ts
|
|
1264
1263
|
/**
|
|
1265
1264
|
* Conditionally creates configuration entries for the ESLint plugins
|
|
1266
|
-
* `eslint-plugin-jest-
|
|
1265
|
+
* `eslint-plugin-jest-extended`, `eslint-plugin-jest-dom` and
|
|
1266
|
+
* `eslint-plugin-testing-library`, and relaxes JSDoc rules for test files.
|
|
1267
1267
|
*
|
|
1268
1268
|
* @param baseName
|
|
1269
1269
|
* The base name for all configuration entries.
|
|
@@ -1354,7 +1354,7 @@ function jest(envOptions) {
|
|
|
1354
1354
|
* tests using Vitest.
|
|
1355
1355
|
*
|
|
1356
1356
|
* Wraps the following packages:
|
|
1357
|
-
* -
|
|
1357
|
+
* - `@vitest/eslint-plugin`
|
|
1358
1358
|
* - `eslint-plugin-jest-extended`
|
|
1359
1359
|
* - `eslint-plugin-jest-dom`
|
|
1360
1360
|
* - `eslint-plugin-testing-library`
|
|
@@ -1508,7 +1508,7 @@ const Schema = {
|
|
|
1508
1508
|
}
|
|
1509
1509
|
};
|
|
1510
1510
|
/**
|
|
1511
|
-
* Returns whether the passed AST node is an `Identifier
|
|
1511
|
+
* Returns whether the passed AST node is an `Identifier` node.
|
|
1512
1512
|
*
|
|
1513
1513
|
* @param node
|
|
1514
1514
|
* The AST node to be checked.
|
|
@@ -1542,7 +1542,7 @@ function isLiteral(node) {
|
|
|
1542
1542
|
* The expected literal value.
|
|
1543
1543
|
*
|
|
1544
1544
|
* @returns
|
|
1545
|
-
* Whether the passed AST node is a `Literal` node with
|
|
1545
|
+
* Whether the passed AST node is a `Literal` node with the specified value.
|
|
1546
1546
|
*/
|
|
1547
1547
|
function isLiteralValue(node, value) {
|
|
1548
1548
|
return isLiteral(node) && node.value === value;
|
|
@@ -1613,13 +1613,13 @@ function isFile(path) {
|
|
|
1613
1613
|
return lstatSync(path, { throwIfNoEntry: false })?.isFile() ?? false;
|
|
1614
1614
|
}
|
|
1615
1615
|
/**
|
|
1616
|
-
* A wrapper for an `import` statement containing a string literal
|
|
1617
|
-
* module name, and the resulting extracted module name.
|
|
1616
|
+
* A wrapper for an `import` or `export` statement containing a string literal
|
|
1617
|
+
* node with a module name, and the resulting extracted module name.
|
|
1618
1618
|
*/
|
|
1619
1619
|
var ImportNodeWrapper = class {
|
|
1620
1620
|
/** The string literal node containing the name of the imported module. */
|
|
1621
1621
|
sourceNode;
|
|
1622
|
-
/** The
|
|
1622
|
+
/** The name of the imported module (with alias key, without query string). */
|
|
1623
1623
|
moduleName;
|
|
1624
1624
|
constructor(node) {
|
|
1625
1625
|
this.sourceNode = node;
|
|
@@ -1643,9 +1643,6 @@ var ImportNodeWrapper = class {
|
|
|
1643
1643
|
/**
|
|
1644
1644
|
* A custom context helper for the linter rules of the preset environment
|
|
1645
1645
|
* 'env.project'.
|
|
1646
|
-
*
|
|
1647
|
-
* @param context
|
|
1648
|
-
* The rule context of the module currently linted.
|
|
1649
1646
|
*/
|
|
1650
1647
|
var ProjectContext = class {
|
|
1651
1648
|
/** Maps alias keys to alias paths. */
|
|
@@ -1658,6 +1655,13 @@ var ProjectContext = class {
|
|
|
1658
1655
|
#moduleName;
|
|
1659
1656
|
/** Resolver for npm packages. */
|
|
1660
1657
|
#requireModule;
|
|
1658
|
+
/**
|
|
1659
|
+
* @param context
|
|
1660
|
+
* The rule context of the module currently linted.
|
|
1661
|
+
*
|
|
1662
|
+
* @throws {Error}
|
|
1663
|
+
* If the path of the linted module cannot be resolved.
|
|
1664
|
+
*/
|
|
1661
1665
|
constructor(context) {
|
|
1662
1666
|
const sharedSettings = context.settings["env-project"];
|
|
1663
1667
|
this.#aliasMap = new Map(Object.entries(sharedSettings?.alias ?? {}));
|
|
@@ -1686,7 +1690,8 @@ var ProjectContext = class {
|
|
|
1686
1690
|
*
|
|
1687
1691
|
* @returns
|
|
1688
1692
|
* The string literal node containing the module name, and the resulting
|
|
1689
|
-
* extracted module name
|
|
1693
|
+
* extracted module name; or `undefined`, if the module name is not a string
|
|
1694
|
+
* literal.
|
|
1690
1695
|
*/
|
|
1691
1696
|
resolveImportNode(node) {
|
|
1692
1697
|
const sourceNodeRaw = node.type === AST_NODE_TYPES.TSExternalModuleReference ? node.expression : node.source;
|
|
@@ -1736,13 +1741,15 @@ var ProjectContext = class {
|
|
|
1736
1741
|
return FILE_EXTENSIONS.some((ext) => isFile(resolvedPath + "." + ext));
|
|
1737
1742
|
}
|
|
1738
1743
|
/**
|
|
1739
|
-
* Returns whether the passed module name is an installed npm package
|
|
1744
|
+
* Returns whether the passed module name is an installed npm package, or a
|
|
1745
|
+
* built-in Node.js module.
|
|
1740
1746
|
*
|
|
1741
1747
|
* @param moduleName
|
|
1742
1748
|
* The module name to be checked.
|
|
1743
1749
|
*
|
|
1744
1750
|
* @returns
|
|
1745
|
-
* Whether the passed module name is an installed npm package
|
|
1751
|
+
* Whether the passed module name is an installed npm package, or a built-in
|
|
1752
|
+
* Node.js module.
|
|
1746
1753
|
*/
|
|
1747
1754
|
packageExists(moduleName) {
|
|
1748
1755
|
this.#requireModule ??= createRequire(this.#configPath);
|
|
@@ -1809,6 +1816,7 @@ function preferDestructuringAssignment() {
|
|
|
1809
1816
|
* Creates configuration objects with linter rules for ReactJS.
|
|
1810
1817
|
*
|
|
1811
1818
|
* Wraps the following packages:
|
|
1819
|
+
* - `@eslint-react/kit`
|
|
1812
1820
|
* - `@eslint-react/eslint-plugin`
|
|
1813
1821
|
* - `eslint-plugin-react-hooks`
|
|
1814
1822
|
* - `eslint-plugin-react-refresh`
|
|
@@ -1828,14 +1836,19 @@ function react(envOptions) {
|
|
|
1828
1836
|
if (envOptions.effectHooks?.length) mergeSettings(settings, "react-x", { additionalEffectHooks: `/^(${envOptions.effectHooks.join("|")})$/` });
|
|
1829
1837
|
return [
|
|
1830
1838
|
createConfig("env.react.recommended", envOptions, {
|
|
1839
|
+
...convertRuleWarningsToErrors(reactConfig),
|
|
1831
1840
|
languageOptions: {
|
|
1841
|
+
...reactConfig.languageOptions,
|
|
1832
1842
|
parser,
|
|
1833
|
-
parserOptions: {
|
|
1843
|
+
parserOptions: {
|
|
1844
|
+
ecmaFeatures: { jsx: true },
|
|
1845
|
+
projectService: true
|
|
1846
|
+
}
|
|
1834
1847
|
},
|
|
1835
|
-
...convertRuleWarningsToErrors(reactConfig),
|
|
1836
1848
|
settings
|
|
1837
1849
|
}, {
|
|
1838
1850
|
"@eslint-react/dom-no-unknown-property": "error",
|
|
1851
|
+
"@eslint-react/globals": "error",
|
|
1839
1852
|
"@eslint-react/immutability": "error",
|
|
1840
1853
|
"@eslint-react/jsx-no-leaked-dollar": "error",
|
|
1841
1854
|
"@eslint-react/jsx-no-useless-fragment": ["error", { allowEmptyFragment: true }],
|
|
@@ -1844,15 +1857,8 @@ function react(envOptions) {
|
|
|
1844
1857
|
"@eslint-react/no-missing-context-display-name": "error",
|
|
1845
1858
|
"@eslint-react/refs": "error"
|
|
1846
1859
|
}),
|
|
1847
|
-
createConfig("env.react.
|
|
1848
|
-
createConfig("env.react.react-hooks", envOptions, convertRuleWarningsToErrors(reactHooksPlugin.configs.flat.recommended),
|
|
1849
|
-
"react-hooks/exhaustive-deps": "off",
|
|
1850
|
-
"react-hooks/immutability": "off",
|
|
1851
|
-
"react-hooks/refs": "off",
|
|
1852
|
-
"react-hooks/rules-of-hooks": "off",
|
|
1853
|
-
"react-hooks/set-state-in-effect": "off",
|
|
1854
|
-
"react-hooks/set-state-in-render": "off"
|
|
1855
|
-
}),
|
|
1860
|
+
createConfig("env.react.custom", envOptions, { extends: [reactKit().use(jsxShorthandBoolean).use(preferDestructuringAssignment).getConfig()] }),
|
|
1861
|
+
createConfig("env.react.react-hooks", envOptions, convertRuleWarningsToErrors(reactHooksPlugin.configs.flat.recommended), reactPlugin.configs["disable-conflict-eslint-plugin-react-hooks"].rules),
|
|
1856
1862
|
createConfig("env.react.react-refresh", envOptions, reactRefresh.configs.vite()),
|
|
1857
1863
|
createConfig("env.react.jsx-a11y", envOptions, jsxA11yPlugin.flatConfigs.recommended),
|
|
1858
1864
|
customRules("env.react.rules", envOptions)
|
|
@@ -1886,10 +1892,9 @@ var noInvalidModules_default = ESLintUtils.RuleCreator.withoutDocs({
|
|
|
1886
1892
|
meta: {
|
|
1887
1893
|
type: "problem",
|
|
1888
1894
|
schema: [Schema.options({ external: Schema.array(Schema.stringNE()) })],
|
|
1889
|
-
|
|
1890
|
-
|
|
1895
|
+
defaultOptions: [{ external: [] }],
|
|
1896
|
+
messages: { SOURCE_FILE_NOT_FOUND: "Source file for `{{moduleName}}` not found." }
|
|
1891
1897
|
},
|
|
1892
|
-
defaultOptions: [{ external: [] }],
|
|
1893
1898
|
create(context, [options]) {
|
|
1894
1899
|
const projectContext = new ProjectContext(context);
|
|
1895
1900
|
return { "ImportDeclaration, TSExternalModuleReference, ImportExpression, ExportAllDeclaration, ExportNamedDeclaration"(node) {
|
|
@@ -1917,13 +1922,12 @@ var noInvalidHierarchy_default = ESLintUtils.RuleCreator.withoutDocs({
|
|
|
1917
1922
|
extends: Schema.maybeArray(Schema.stringNE()),
|
|
1918
1923
|
optional: Schema.boolean()
|
|
1919
1924
|
}, ["files"]))],
|
|
1925
|
+
defaultOptions: [{}],
|
|
1920
1926
|
messages: {
|
|
1921
1927
|
UNEXPECTED_OPTIONAL_STATIC: "Unexpected static import of optional package.",
|
|
1922
1928
|
INVALID_PACKAGE_HIERARCHY: "Low-level package cannot import modules from higher-level package."
|
|
1923
|
-
}
|
|
1924
|
-
fixable: "code"
|
|
1929
|
+
}
|
|
1925
1930
|
},
|
|
1926
|
-
defaultOptions: [{}],
|
|
1927
1931
|
create(context, [options]) {
|
|
1928
1932
|
const projectContext = new ProjectContext(context);
|
|
1929
1933
|
const hierarchyMap = /* @__PURE__ */ new Map();
|
|
@@ -1990,7 +1994,8 @@ function project(envOptions) {
|
|
|
1990
1994
|
//#endregion
|
|
1991
1995
|
//#region src/eslint/env/tsconfig.ts
|
|
1992
1996
|
/**
|
|
1993
|
-
*
|
|
1997
|
+
* Binds type-aware linter rules to an explicit TypeScript project
|
|
1998
|
+
* configuration file instead of the automatic project service.
|
|
1994
1999
|
*
|
|
1995
2000
|
* @param envOptions
|
|
1996
2001
|
* Configuration options for the environment.
|
|
@@ -2010,8 +2015,7 @@ function tsconfig(envOptions) {
|
|
|
2010
2015
|
* Adds support for native decorators in JavaScript source files.
|
|
2011
2016
|
*
|
|
2012
2017
|
* Wraps the following packages:
|
|
2013
|
-
* - `@babel/eslint-parser`
|
|
2014
|
-
* - `@babel/plugin-proposal-decorators`
|
|
2018
|
+
* - `@babel/eslint-parser` with syntax plugin `decorators`
|
|
2015
2019
|
*
|
|
2016
2020
|
* @param envOptions
|
|
2017
2021
|
* Configuration options for the environment.
|
|
@@ -2020,7 +2024,7 @@ function tsconfig(envOptions) {
|
|
|
2020
2024
|
* The configuration entries to be added to the resulting configuration array.
|
|
2021
2025
|
*/
|
|
2022
2026
|
function decorators(envOptions) {
|
|
2023
|
-
return [createConfig("
|
|
2027
|
+
return [createConfig("env.decorators.babel", envOptions, {
|
|
2024
2028
|
ignores: TS_GLOB,
|
|
2025
2029
|
languageOptions: {
|
|
2026
2030
|
parser: babelParser,
|
|
@@ -2033,7 +2037,7 @@ function decorators(envOptions) {
|
|
|
2033
2037
|
}
|
|
2034
2038
|
}
|
|
2035
2039
|
}
|
|
2036
|
-
}), customRules("
|
|
2040
|
+
}), customRules("env.decorators.rules", envOptions)];
|
|
2037
2041
|
}
|
|
2038
2042
|
//#endregion
|
|
2039
2043
|
//#region src/eslint/index.ts
|
|
@@ -2059,7 +2063,7 @@ const env = {
|
|
|
2059
2063
|
* Options for the base configuration that will be generated.
|
|
2060
2064
|
*
|
|
2061
2065
|
* @param configs
|
|
2062
|
-
* Additional configuration entries
|
|
2066
|
+
* Additional configuration entries. Each entry may be a callback function
|
|
2063
2067
|
* that will be invoked with a `PathResolver` utility.
|
|
2064
2068
|
*
|
|
2065
2069
|
* @returns
|