@nx/eslint 17.3.0-canary.20231222-d819e6c → 17.3.0-canary.20231223-cb09f25
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
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/eslint",
|
3
|
-
"version": "17.3.0-canary.
|
3
|
+
"version": "17.3.0-canary.20231223-cb09f25",
|
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": {
|
@@ -34,11 +34,11 @@
|
|
34
34
|
"js-yaml": "4.1.0"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
|
-
"@nx/devkit": "17.3.0-canary.
|
38
|
-
"@nx/js": "17.3.0-canary.
|
37
|
+
"@nx/devkit": "17.3.0-canary.20231223-cb09f25",
|
38
|
+
"@nx/js": "17.3.0-canary.20231223-cb09f25",
|
39
39
|
"tslib": "^2.3.0",
|
40
40
|
"typescript": "~5.2.2",
|
41
|
-
"@nx/linter": "17.3.0-canary.
|
41
|
+
"@nx/linter": "17.3.0-canary.20231223-cb09f25"
|
42
42
|
},
|
43
43
|
"peerDependenciesMeta": {
|
44
44
|
"eslint": {
|
@@ -14,17 +14,11 @@ async function run(options, context) {
|
|
14
14
|
// root to be able to run the lint executor from any subfolder.
|
15
15
|
process.chdir(systemRoot);
|
16
16
|
const projectName = context.projectName || '<???>';
|
17
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
17
18
|
const printInfo = options.format && !options.silent;
|
18
19
|
if (printInfo) {
|
19
20
|
console.info(`\nLinting ${JSON.stringify(projectName)}...`);
|
20
21
|
}
|
21
|
-
/**
|
22
|
-
* We want users to have the option of not specifying the config path, and let
|
23
|
-
* eslint automatically resolve the `.eslintrc.json` files in each folder.
|
24
|
-
*/
|
25
|
-
let eslintConfigPath = options.eslintConfig
|
26
|
-
? (0, path_1.resolve)(systemRoot, options.eslintConfig)
|
27
|
-
: undefined;
|
28
22
|
options.cacheLocation = options.cacheLocation
|
29
23
|
? (0, devkit_1.joinPathFragments)(options.cacheLocation, projectName)
|
30
24
|
: undefined;
|
@@ -35,6 +29,21 @@ async function run(options, context) {
|
|
35
29
|
* their root ESLint config to use eslint.config.js
|
36
30
|
*/
|
37
31
|
const hasFlatConfig = (0, fs_1.existsSync)((0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, 'eslint.config.js'));
|
32
|
+
// while standard eslint uses by default closest config to the file, if otherwise not specified,
|
33
|
+
// the flat config would always use the root config, so we need to explicitly set it to the local one
|
34
|
+
if (hasFlatConfig && !normalizedOptions.eslintConfig) {
|
35
|
+
const eslintConfigPath = (0, devkit_1.joinPathFragments)(projectRoot, 'eslint.config.js');
|
36
|
+
if ((0, fs_1.existsSync)(eslintConfigPath)) {
|
37
|
+
normalizedOptions.eslintConfig = eslintConfigPath;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
/**
|
41
|
+
* We want users to have the option of not specifying the config path, and let
|
42
|
+
* eslint automatically resolve the `.eslintrc.json` files in each folder.
|
43
|
+
*/
|
44
|
+
let eslintConfigPath = normalizedOptions.eslintConfig
|
45
|
+
? (0, path_1.resolve)(systemRoot, normalizedOptions.eslintConfig)
|
46
|
+
: undefined;
|
38
47
|
const { eslint, ESLint } = await (0, eslint_utils_1.resolveAndInstantiateESLint)(eslintConfigPath, normalizedOptions, hasFlatConfig);
|
39
48
|
const version = ESLint.version?.split('.');
|
40
49
|
if (!version ||
|
@@ -62,7 +71,7 @@ async function run(options, context) {
|
|
62
71
|
const normalizedLintFilePatterns = normalizedOptions.lintFilePatterns.map((pattern) => {
|
63
72
|
return (0, utils_1.interpolate)(pattern, {
|
64
73
|
workspaceRoot: '',
|
65
|
-
projectRoot
|
74
|
+
projectRoot,
|
66
75
|
projectName: context.projectName,
|
67
76
|
});
|
68
77
|
});
|