@nx/eslint 21.1.2 → 21.1.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<p style="text-align: center;">
|
2
2
|
<picture>
|
3
3
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
|
4
|
-
<img alt="Nx - Smart
|
4
|
+
<img alt="Nx - Smart Repos · Fast Builds" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
|
5
5
|
</picture>
|
6
6
|
</p>
|
7
7
|
|
@@ -20,9 +20,9 @@
|
|
20
20
|
|
21
21
|
<hr>
|
22
22
|
|
23
|
-
# Nx: Smart
|
23
|
+
# Nx: Smart Repos · Fast Builds
|
24
24
|
|
25
|
-
|
25
|
+
An AI-first build platform that connects everything from your editor to CI. Helping you deliver fast, without breaking things.
|
26
26
|
|
27
27
|
## Getting Started
|
28
28
|
|
@@ -62,5 +62,5 @@ npx nx@latest init
|
|
62
62
|
- [Blog Posts About Nx](https://nx.dev/blog)
|
63
63
|
|
64
64
|
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
|
65
|
-
width="100%" alt="Nx - Smart
|
65
|
+
width="100%" alt="Nx - Smart Repos · Fast Builds"></a></p>
|
66
66
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/eslint",
|
3
|
-
"version": "21.1.
|
3
|
+
"version": "21.1.3",
|
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": {
|
@@ -35,8 +35,8 @@
|
|
35
35
|
"eslint": "^8.0.0 || ^9.0.0"
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
|
-
"@nx/devkit": "21.1.
|
39
|
-
"@nx/js": "21.1.
|
38
|
+
"@nx/devkit": "21.1.3",
|
39
|
+
"@nx/js": "21.1.3",
|
40
40
|
"semver": "^7.5.3",
|
41
41
|
"tslib": "^2.3.0",
|
42
42
|
"typescript": "~5.7.2"
|
@@ -91,7 +91,7 @@ function convertEslintJsonToFlatConfig(tree, root, config, ignorePaths, format)
|
|
91
91
|
if (tree.exists(ignorePath)) {
|
92
92
|
const patterns = tree
|
93
93
|
.read(ignorePath, 'utf-8')
|
94
|
-
.split(
|
94
|
+
.split(/\r\n|\r|\n/)
|
95
95
|
.filter((line) => line.length > 0 && line !== 'node_modules')
|
96
96
|
.map((path) => (0, path_utils_1.mapFilePath)(path));
|
97
97
|
if (patterns.length > 0) {
|
package/src/plugins/plugin.js
CHANGED
@@ -107,11 +107,8 @@ const internalCreateNodes = async (configFilePath, options, context, projectsCac
|
|
107
107
|
projects,
|
108
108
|
};
|
109
109
|
};
|
110
|
-
const internalCreateNodesV2 = async (configFilePath, options, context, projectRootsByEslintRoots, lintableFilesPerProjectRoot, projectsCache, hashByRoot) => {
|
110
|
+
const internalCreateNodesV2 = async (ESLint, configFilePath, options, context, projectRootsByEslintRoots, lintableFilesPerProjectRoot, projectsCache, hashByRoot) => {
|
111
111
|
const configDir = (0, posix_1.dirname)(configFilePath);
|
112
|
-
const ESLint = await (0, resolve_eslint_class_1.resolveESLintClass)({
|
113
|
-
useFlatConfigOverrideVal: (0, config_file_1.isFlatConfig)(configFilePath),
|
114
|
-
});
|
115
112
|
const eslintVersion = ESLint.version;
|
116
113
|
const projects = {};
|
117
114
|
await Promise.all(projectRootsByEslintRoots.get(configDir).map(async (projectRoot) => {
|
@@ -121,16 +118,21 @@ const internalCreateNodesV2 = async (configFilePath, options, context, projectRo
|
|
121
118
|
Object.assign(projects, projectsCache[hash]);
|
122
119
|
return;
|
123
120
|
}
|
124
|
-
const eslint = new ESLint({
|
125
|
-
cwd: (0, posix_1.join)(context.workspaceRoot, projectRoot),
|
126
|
-
});
|
127
121
|
let hasNonIgnoredLintableFiles = false;
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
122
|
+
if (configDir !== projectRoot || projectRoot === '.') {
|
123
|
+
const eslint = new ESLint({
|
124
|
+
cwd: (0, posix_1.join)(context.workspaceRoot, projectRoot),
|
125
|
+
});
|
126
|
+
for (const file of lintableFilesPerProjectRoot.get(projectRoot) ?? []) {
|
127
|
+
if (!(await eslint.isPathIgnored((0, posix_1.join)(context.workspaceRoot, file)))) {
|
128
|
+
hasNonIgnoredLintableFiles = true;
|
129
|
+
break;
|
130
|
+
}
|
132
131
|
}
|
133
132
|
}
|
133
|
+
else {
|
134
|
+
hasNonIgnoredLintableFiles = true;
|
135
|
+
}
|
134
136
|
if (!hasNonIgnoredLintableFiles) {
|
135
137
|
// No lintable files in the project, store in the cache and skip further processing
|
136
138
|
projectsCache[hash] = {};
|
@@ -166,7 +168,13 @@ exports.createNodesV2 = [
|
|
166
168
|
}));
|
167
169
|
const hashByRoot = new Map(projectRoots.map((r, i) => [r, hashes[i]]));
|
168
170
|
try {
|
169
|
-
|
171
|
+
if (eslintConfigFiles.length === 0) {
|
172
|
+
return [];
|
173
|
+
}
|
174
|
+
const ESLint = await (0, resolve_eslint_class_1.resolveESLintClass)({
|
175
|
+
useFlatConfigOverrideVal: (0, config_file_1.isFlatConfig)(eslintConfigFiles[0]),
|
176
|
+
});
|
177
|
+
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => internalCreateNodesV2(ESLint, configFile, options, context, projectRootsByEslintRoots, lintableFilesPerProjectRoot, targetsCache, hashByRoot), eslintConfigFiles, options, context);
|
170
178
|
}
|
171
179
|
finally {
|
172
180
|
writeTargetsToCache(cachePath, targetsCache);
|