@nx/eslint 22.7.0-beta.1 → 22.7.0-beta.11
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/package.json +7 -8
- package/src/generators/convert-to-flat-config/converters/json-converter.js +2 -1
- package/src/generators/utils/eslint-file.d.ts +7 -1
- package/src/generators/utils/eslint-file.d.ts.map +1 -1
- package/src/generators/utils/eslint-file.js +3 -2
- package/src/generators/utils/flat-config/ast-utils.d.ts.map +1 -1
- package/src/generators/utils/flat-config/ast-utils.js +43 -4
- package/src/generators/workspace-rule/workspace-rule.js +2 -1
- package/src/migrations/update-20-3-0/add-file-extensions-to-overrides.js +2 -1
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +7 -7
- package/src/utils/resolve-eslint-class.js +35 -2
- package/project.json +0 -53
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/eslint",
|
|
3
|
-
"version": "22.7.0-beta.
|
|
3
|
+
"version": "22.7.0-beta.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The ESLint plugin for Nx contains executors, generators and utilities used for linting JavaScript/TypeScript projects within an Nx workspace.",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"Testing"
|
|
18
18
|
],
|
|
19
19
|
"main": "./index.js",
|
|
20
|
-
"
|
|
20
|
+
"type": "commonjs",
|
|
21
|
+
"types": "./index.d.ts",
|
|
21
22
|
"author": "Victor Savkin",
|
|
22
23
|
"license": "MIT",
|
|
23
24
|
"bugs": {
|
|
@@ -35,14 +36,14 @@
|
|
|
35
36
|
"eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
|
-
"@nx/devkit": "22.7.0-beta.
|
|
39
|
-
"@nx/js": "22.7.0-beta.
|
|
39
|
+
"@nx/devkit": "22.7.0-beta.11",
|
|
40
|
+
"@nx/js": "22.7.0-beta.11",
|
|
40
41
|
"semver": "^7.6.3",
|
|
41
42
|
"tslib": "^2.3.0",
|
|
42
43
|
"typescript": "~5.9.2"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"nx": "22.7.0-beta.
|
|
46
|
+
"nx": "22.7.0-beta.11"
|
|
46
47
|
},
|
|
47
48
|
"peerDependenciesMeta": {
|
|
48
49
|
"@zkochan/js-yaml": {
|
|
@@ -51,7 +52,5 @@
|
|
|
51
52
|
},
|
|
52
53
|
"publishConfig": {
|
|
53
54
|
"access": "public"
|
|
54
|
-
}
|
|
55
|
-
"types": "./index.d.ts",
|
|
56
|
-
"type": "commonjs"
|
|
55
|
+
}
|
|
57
56
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertEslintJsonToFlatConfig = convertEslintJsonToFlatConfig;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const ts = require("typescript");
|
|
6
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
6
7
|
const ast_utils_1 = require("../../utils/flat-config/ast-utils");
|
|
7
8
|
const eslint_file_1 = require("../../utils/eslint-file");
|
|
8
9
|
const path_utils_1 = require("../../utils/flat-config/path-utils");
|
|
@@ -18,7 +18,13 @@ export declare function addExtendsToLintConfig(tree: Tree, root: string, plugin:
|
|
|
18
18
|
name: string;
|
|
19
19
|
needCompatFixup: boolean;
|
|
20
20
|
}>, insertAtTheEnd?: boolean): GeneratorCallback;
|
|
21
|
-
export declare function addPredefinedConfigToFlatLintConfig(tree: Tree, root: string, predefinedConfigName: string,
|
|
21
|
+
export declare function addPredefinedConfigToFlatLintConfig(tree: Tree, root: string, predefinedConfigName: string, options?: {
|
|
22
|
+
moduleName?: string;
|
|
23
|
+
moduleImportPath?: string;
|
|
24
|
+
spread?: boolean;
|
|
25
|
+
insertAtTheEnd?: boolean;
|
|
26
|
+
checkBaseConfig?: boolean;
|
|
27
|
+
}): void;
|
|
22
28
|
export declare function addPluginsToLintConfig(tree: Tree, root: string, plugin: string | string[]): void;
|
|
23
29
|
export declare function addIgnoresToLintConfig(tree: Tree, root: string, ignorePatterns: string[]): void;
|
|
24
30
|
export declare function getPluginImport(pluginName: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-file.d.ts","sourceRoot":"","sources":["../../../../../../packages/eslint/src/generators/utils/eslint-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EAKtB,KAAK,IAAI,EAEV,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAuCrC,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI,CAmBf;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,SAAK,GAAG,OAAO,CAW7E;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,QA6CxB;AAsED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAc1E;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,EAC5D,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,eAAe,CAAC,EAAE,OAAO,CAAA;CAE7D,QAiDF;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,CAAC,QA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AM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,QA8BvD;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EACZ,MAAM,EACF,MAAM,GACN;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,OAAO,CAAA;CAAE,GAC1C,KAAK,CAAC,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,OAAO,CAAA;CAAE,CAAC,EAC9D,cAAc,UAAQ,GACrB,iBAAiB,CA+GnB;AAED,wBAAgB,mCAAmC,CACjD,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EACZ,oBAAoB,EAAE,MAAM,EAC5B,OAAO,GAAE;IACP,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;CACtB,GACL,IAAI,CA6BN;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,QA+B1B;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EAAE,QAuCzB;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAY1D"}
|
|
@@ -375,7 +375,8 @@ function addExtendsToLintConfig(tree, root, plugin, insertAtTheEnd = false) {
|
|
|
375
375
|
return () => { };
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
function addPredefinedConfigToFlatLintConfig(tree, root, predefinedConfigName,
|
|
378
|
+
function addPredefinedConfigToFlatLintConfig(tree, root, predefinedConfigName, options = {}) {
|
|
379
|
+
const { moduleName = 'nx', moduleImportPath = '@nx/eslint-plugin', spread = true, insertAtTheEnd = true, checkBaseConfig = false, } = options;
|
|
379
380
|
if (!(0, flat_config_1.useFlatConfig)(tree))
|
|
380
381
|
throw new Error('Predefined configs can only be used with flat configs');
|
|
381
382
|
let fileName;
|
|
@@ -387,7 +388,7 @@ function addPredefinedConfigToFlatLintConfig(tree, root, predefinedConfigName, m
|
|
|
387
388
|
}
|
|
388
389
|
let content = tree.read(fileName, 'utf8');
|
|
389
390
|
content = (0, ast_utils_1.addImportToFlatConfig)(content, moduleName, moduleImportPath);
|
|
390
|
-
content = (0, ast_utils_1.addBlockToFlatConfigExport)(content, (0, ast_utils_1.generateFlatPredefinedConfig)(predefinedConfigName, moduleName, spread), { insertAtTheEnd });
|
|
391
|
+
content = (0, ast_utils_1.addBlockToFlatConfigExport)(content, (0, ast_utils_1.generateFlatPredefinedConfig)(predefinedConfigName, moduleName, spread), { insertAtTheEnd, checkBaseConfig });
|
|
391
392
|
tree.write(fileName, content);
|
|
392
393
|
}
|
|
393
394
|
function addPluginsToLintConfig(tree, root, plugin) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/eslint/src/generators/utils/flat-config/ast-utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AASjC;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA+BrE;AA2BD,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EAAE,GACvB,MAAM,CA0CR;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAgBlE;AA8BD,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,OAAO,GACvE,OAAO,CAoCT;AAiJD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,OAAO,EACxE,MAAM,CAAC,EAAE,CACP,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KACzD,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,GACtD,MAAM,CAsGR;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,GAAG,EAAE,MAAM,GACV,MAAM,CAgBR;AA+QD;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV,MAAM,CAeR;AA+DD;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,aAAa,EACxC,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,eAAe,CAAC,EAAE,OAAO,CAAA;CAE7D,GACA,MAAM,CA8BR;
|
|
1
|
+
{"version":3,"file":"ast-utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/eslint/src/generators/utils/flat-config/ast-utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AASjC;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,M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,CAAC;IAC5B,QAAQ,EAAE,CACR,kBAAkB,EAAE,EAAE,CAAC,kBAAkB,EACzC,YAAY,EAAE,MAAM,KACjB,EAAE,CAAC,kBAAkB,CAAC;CAC5B,GACA,CAAC,CAuCH"}
|
|
@@ -25,8 +25,9 @@ exports.generateFlatOverride = generateFlatOverride;
|
|
|
25
25
|
exports.generateFlatPredefinedConfig = generateFlatPredefinedConfig;
|
|
26
26
|
exports.mapFilePaths = mapFilePaths;
|
|
27
27
|
exports.generateAst = generateAst;
|
|
28
|
+
const tslib_1 = require("tslib");
|
|
28
29
|
const devkit_1 = require("@nx/devkit");
|
|
29
|
-
const ts = require("typescript");
|
|
30
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
30
31
|
const path_utils_1 = require("./path-utils");
|
|
31
32
|
/**
|
|
32
33
|
* Supports direct identifiers, and those nested within an object (of arbitrary depth)
|
|
@@ -619,9 +620,25 @@ function addBlockToFlatConfigExportESM(content, config, source, printer, options
|
|
|
619
620
|
if (!exportDefaultStatement)
|
|
620
621
|
return content;
|
|
621
622
|
const exportArrayLiteral = exportDefaultStatement.expression;
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
623
|
+
let updatedArrayElements;
|
|
624
|
+
if (options.checkBaseConfig) {
|
|
625
|
+
const baseConfigIndex = exportArrayLiteral.elements.findIndex((el) => ts.isSpreadElement(el) &&
|
|
626
|
+
ts.isIdentifier(el.expression) &&
|
|
627
|
+
el.expression.text === 'baseConfig');
|
|
628
|
+
if (baseConfigIndex >= 0) {
|
|
629
|
+
const before = exportArrayLiteral.elements.slice(0, baseConfigIndex);
|
|
630
|
+
const after = exportArrayLiteral.elements.slice(baseConfigIndex);
|
|
631
|
+
updatedArrayElements = [...before, config, ...after];
|
|
632
|
+
}
|
|
633
|
+
else {
|
|
634
|
+
updatedArrayElements = [...exportArrayLiteral.elements, config];
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
updatedArrayElements = options.insertAtTheEnd
|
|
639
|
+
? [...exportArrayLiteral.elements, config]
|
|
640
|
+
: [config, ...exportArrayLiteral.elements];
|
|
641
|
+
}
|
|
625
642
|
const updatedExportDefault = ts.factory.createExportAssignment(undefined, false, ts.factory.createArrayLiteralExpression(updatedArrayElements, true));
|
|
626
643
|
// update the existing export default array
|
|
627
644
|
const updatedStatements = source.statements.map((statement) => statement === exportDefaultStatement ? updatedExportDefault : statement);
|
|
@@ -650,6 +667,28 @@ function addBlockToFlatConfigExportCJS(content, config, source, printer, options
|
|
|
650
667
|
printer
|
|
651
668
|
.printNode(ts.EmitHint.Expression, config, source)
|
|
652
669
|
.replaceAll(/\n/g, '\n ');
|
|
670
|
+
if (options.checkBaseConfig) {
|
|
671
|
+
const baseConfigElement = exportsArray.find((el) => ts.isSpreadElement(el) &&
|
|
672
|
+
ts.isIdentifier(el.expression) &&
|
|
673
|
+
el.expression.text === 'baseConfig');
|
|
674
|
+
if (baseConfigElement) {
|
|
675
|
+
// Match baseConfig's indentation for consistent formatting
|
|
676
|
+
const baseConfigStart = baseConfigElement.getStart();
|
|
677
|
+
const lineStart = content.lastIndexOf('\n', baseConfigStart) + 1;
|
|
678
|
+
const indentation = content.substring(lineStart, baseConfigStart);
|
|
679
|
+
const configText = printer
|
|
680
|
+
.printNode(ts.EmitHint.Expression, config, source)
|
|
681
|
+
.replaceAll(/\n/g, `\n${indentation}`);
|
|
682
|
+
return (0, devkit_1.applyChangesToString)(content, [
|
|
683
|
+
{
|
|
684
|
+
type: devkit_1.ChangeType.Insert,
|
|
685
|
+
index: baseConfigStart,
|
|
686
|
+
text: `${configText},\n${indentation}`,
|
|
687
|
+
},
|
|
688
|
+
]);
|
|
689
|
+
}
|
|
690
|
+
// baseConfig not found — fall through to insertAtTheEnd behavior
|
|
691
|
+
}
|
|
653
692
|
if (options.insertAtTheEnd) {
|
|
654
693
|
const index = exportsArray.length > 0
|
|
655
694
|
? exportsArray.at(exportsArray.length - 1).end
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lintWorkspaceRuleGenerator = lintWorkspaceRuleGenerator;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const string_utils_1 = require("@nx/devkit/src/utils/string-utils");
|
|
6
7
|
const path_1 = require("path");
|
|
7
|
-
const ts = require("typescript");
|
|
8
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
8
9
|
const workspace_lint_rules_1 = require("../../utils/workspace-lint-rules");
|
|
9
10
|
const workspace_rules_project_1 = require("../workspace-rules-project/workspace-rules-project");
|
|
10
11
|
const flat_config_1 = require("../../utils/flat-config");
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
5
6
|
const js_1 = require("@nx/js");
|
|
6
7
|
async function default_1(tree) {
|
|
7
8
|
let rootConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/eslint/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EAMd,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/eslint/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EAMd,MAAM,YAAY,CAAC;AAmBpB,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAqHD,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,mBAAmB,CA0E1D,CAAC;AAEF,eAAO,MAAM,aAAa,oCAAc,CAAC"}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -13,7 +13,6 @@ const workspace_context_1 = require("nx/src/utils/workspace-context");
|
|
|
13
13
|
const semver_1 = require("semver");
|
|
14
14
|
const config_file_1 = require("../utils/config-file");
|
|
15
15
|
const resolve_eslint_class_1 = require("../utils/resolve-eslint-class");
|
|
16
|
-
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
17
16
|
const DEFAULT_EXTENSIONS = [
|
|
18
17
|
'ts',
|
|
19
18
|
'cts',
|
|
@@ -39,7 +38,7 @@ function readTargetsCache(cachePath) {
|
|
|
39
38
|
function writeTargetsToCache(cachePath, results) {
|
|
40
39
|
(0, devkit_1.writeJsonFile)(cachePath, results);
|
|
41
40
|
}
|
|
42
|
-
const internalCreateNodesV2 = async (ESLint, configFilePath, options, context, projectRootsByEslintRoots, lintableFilesPerProjectRoot, projectsCache, hashByRoot) => {
|
|
41
|
+
const internalCreateNodesV2 = async (ESLint, configFilePath, options, context, projectRootsByEslintRoots, lintableFilesPerProjectRoot, projectsCache, hashByRoot, pmc) => {
|
|
43
42
|
const configDir = (0, posix_1.dirname)(configFilePath);
|
|
44
43
|
const eslintVersion = ESLint.version;
|
|
45
44
|
let sharedEslint;
|
|
@@ -78,7 +77,7 @@ const internalCreateNodesV2 = async (ESLint, configFilePath, options, context, p
|
|
|
78
77
|
projectsCache[hash] = {};
|
|
79
78
|
return;
|
|
80
79
|
}
|
|
81
|
-
const project = getProjectUsingESLintConfig(configFilePath, projectRoot, eslintVersion, options, context);
|
|
80
|
+
const project = getProjectUsingESLintConfig(configFilePath, projectRoot, eslintVersion, options, context, pmc);
|
|
82
81
|
if (project) {
|
|
83
82
|
projects[projectRoot] = project;
|
|
84
83
|
// Store project into the cache
|
|
@@ -97,6 +96,7 @@ exports.createNodes = [
|
|
|
97
96
|
ESLINT_CONFIG_GLOB_V2,
|
|
98
97
|
async (configFiles, options, context) => {
|
|
99
98
|
options = normalizeOptions(options);
|
|
99
|
+
const pmc = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
|
|
100
100
|
const optionsHash = (0, file_hasher_1.hashObject)(options);
|
|
101
101
|
const cachePath = (0, posix_1.join)(cache_directory_1.workspaceDataDirectory, `eslint-${optionsHash}.hash`);
|
|
102
102
|
const targetsCache = readTargetsCache(cachePath);
|
|
@@ -121,7 +121,7 @@ exports.createNodes = [
|
|
|
121
121
|
const ESLint = await (0, resolve_eslint_class_1.resolveESLintClass)({
|
|
122
122
|
useFlatConfigOverrideVal: (0, config_file_1.isFlatConfig)(rootConfig ?? eslintConfigFiles[0]),
|
|
123
123
|
});
|
|
124
|
-
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => internalCreateNodesV2(ESLint, configFile, options, context, projectRootsByEslintRoots, lintableFilesPerProjectRoot, targetsCache, hashByRoot), eslintConfigFiles, options, context);
|
|
124
|
+
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => internalCreateNodesV2(ESLint, configFile, options, context, projectRootsByEslintRoots, lintableFilesPerProjectRoot, targetsCache, hashByRoot, pmc), eslintConfigFiles, options, context);
|
|
125
125
|
}
|
|
126
126
|
finally {
|
|
127
127
|
writeTargetsToCache(cachePath, targetsCache);
|
|
@@ -187,7 +187,7 @@ function getRootForDirectory(directory, roots) {
|
|
|
187
187
|
}
|
|
188
188
|
return roots.has(currentPath) ? currentPath : null;
|
|
189
189
|
}
|
|
190
|
-
function getProjectUsingESLintConfig(configFilePath, projectRoot, eslintVersion, options, context) {
|
|
190
|
+
function getProjectUsingESLintConfig(configFilePath, projectRoot, eslintVersion, options, context, pmc) {
|
|
191
191
|
const rootEslintConfig = [
|
|
192
192
|
config_file_1.baseEsLintConfigFile,
|
|
193
193
|
...config_file_1.BASE_ESLINT_CONFIG_FILENAMES,
|
|
@@ -212,10 +212,10 @@ function getProjectUsingESLintConfig(configFilePath, projectRoot, eslintVersion,
|
|
|
212
212
|
eslintConfigs.unshift(rootEslintConfig);
|
|
213
213
|
}
|
|
214
214
|
return {
|
|
215
|
-
targets: buildEslintTargets(eslintConfigs, eslintVersion, projectRoot, context.workspaceRoot, options, standaloneSrcPath),
|
|
215
|
+
targets: buildEslintTargets(eslintConfigs, eslintVersion, projectRoot, context.workspaceRoot, options, pmc, standaloneSrcPath),
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
|
-
function buildEslintTargets(eslintConfigs, eslintVersion, projectRoot, workspaceRoot, options, standaloneSrcPath) {
|
|
218
|
+
function buildEslintTargets(eslintConfigs, eslintVersion, projectRoot, workspaceRoot, options, pmc, standaloneSrcPath) {
|
|
219
219
|
const isRootProject = projectRoot === '.';
|
|
220
220
|
const targets = {};
|
|
221
221
|
const targetConfig = {
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.resolveESLintClass = resolveESLintClass;
|
|
4
37
|
const flat_config_1 = require("../utils/flat-config");
|
|
@@ -8,7 +41,7 @@ async function resolveESLintClass(opts) {
|
|
|
8
41
|
? opts.useFlatConfigOverrideVal
|
|
9
42
|
: (0, flat_config_1.useFlatConfig)();
|
|
10
43
|
// In eslint 8.57.0 (the final v8 version), a dedicated API was added for resolving the correct ESLint class.
|
|
11
|
-
const eslintModule = (await Promise.resolve().then(() => require('eslint')));
|
|
44
|
+
const eslintModule = (await Promise.resolve().then(() => __importStar(require('eslint'))));
|
|
12
45
|
if (typeof eslintModule.loadESLint === 'function') {
|
|
13
46
|
return await eslintModule.loadESLint({
|
|
14
47
|
useFlatConfig: shouldESLintUseFlatConfig,
|
|
@@ -17,7 +50,7 @@ async function resolveESLintClass(opts) {
|
|
|
17
50
|
// Explicitly use the FlatESLint and LegacyESLint classes here because the ESLint class points at a different one based on ESLint v8 vs ESLint v9
|
|
18
51
|
// But the decision on which one to use is not just based on the major version of ESLint.
|
|
19
52
|
// @ts-expect-error The may be wrong based on our installed eslint version
|
|
20
|
-
const { LegacyESLint, FlatESLint } = await Promise.resolve().then(() => require('eslint/use-at-your-own-risk'));
|
|
53
|
+
const { LegacyESLint, FlatESLint } = await Promise.resolve().then(() => __importStar(require('eslint/use-at-your-own-risk')));
|
|
21
54
|
return shouldESLintUseFlatConfig ? FlatESLint : LegacyESLint;
|
|
22
55
|
}
|
|
23
56
|
catch {
|
package/project.json
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "eslint",
|
|
3
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "packages/eslint",
|
|
5
|
-
"projectType": "library",
|
|
6
|
-
"targets": {
|
|
7
|
-
"build": {
|
|
8
|
-
"outputs": ["{workspaceRoot}/dist/packages/eslint/README.md"],
|
|
9
|
-
"command": "node ./scripts/copy-readme.js eslint"
|
|
10
|
-
},
|
|
11
|
-
"legacy-post-build": {
|
|
12
|
-
"executor": "@nx/workspace-plugin:legacy-post-build",
|
|
13
|
-
"options": {
|
|
14
|
-
"tsConfig": "./tsconfig.lib.json",
|
|
15
|
-
"assets": [
|
|
16
|
-
{
|
|
17
|
-
"input": "packages/eslint",
|
|
18
|
-
"glob": "**/files/**",
|
|
19
|
-
"output": "/"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"input": "packages/eslint",
|
|
23
|
-
"glob": "**/files/**/.gitkeep",
|
|
24
|
-
"output": "/"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"input": "packages/eslint",
|
|
28
|
-
"glob": "**/*.json",
|
|
29
|
-
"ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"],
|
|
30
|
-
"output": "/"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"input": "packages/eslint",
|
|
34
|
-
"glob": "**/*.js",
|
|
35
|
-
"ignore": ["**/jest.config.js"],
|
|
36
|
-
"output": "/"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"input": "packages/eslint",
|
|
40
|
-
"glob": "**/*.d.ts",
|
|
41
|
-
"output": "/"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"input": "",
|
|
45
|
-
"glob": "LICENSE",
|
|
46
|
-
"output": "/"
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"implicitDependencies": ["eslint-plugin"]
|
|
53
|
-
}
|