@nx/eslint 17.2.0-beta.12 → 17.2.0-beta.14
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.2.0-beta.
|
|
3
|
+
"version": "17.2.0-beta.14",
|
|
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.2.0-beta.
|
|
38
|
-
"@nx/js": "17.2.0-beta.
|
|
37
|
+
"@nx/devkit": "17.2.0-beta.14",
|
|
38
|
+
"@nx/js": "17.2.0-beta.14",
|
|
39
39
|
"tslib": "^2.3.0",
|
|
40
40
|
"typescript": "~5.2.2",
|
|
41
|
-
"@nx/linter": "17.2.0-beta.
|
|
41
|
+
"@nx/linter": "17.2.0-beta.14"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"eslint": {
|
|
@@ -71,13 +71,14 @@ async function run(options, context) {
|
|
|
71
71
|
}
|
|
72
72
|
catch (err) {
|
|
73
73
|
if (err.message.includes('You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser')) {
|
|
74
|
+
const ruleName = err.message.match(/rule '([^']+)':/)?.[1];
|
|
74
75
|
let eslintConfigPathForError = `for ${projectName}`;
|
|
75
76
|
if (context.projectsConfigurations?.projects?.[projectName]?.root) {
|
|
76
77
|
const { root } = context.projectsConfigurations.projects[projectName];
|
|
77
78
|
eslintConfigPathForError = `\`${root}/.eslintrc.json\``;
|
|
78
79
|
}
|
|
79
80
|
console.error(`
|
|
80
|
-
Error: You have attempted to use a lint rule which requires the full TypeScript type-checker to be available, but you do not have \`parserOptions.project\` configured to point at your project tsconfig.json files in the relevant TypeScript file "overrides" block of your project ESLint config ${eslintConfigPath || eslintConfigPathForError}
|
|
81
|
+
Error: You have attempted to use ${ruleName ? `the lint rule ${ruleName}` : 'a lint rule'} which requires the full TypeScript type-checker to be available, but you do not have \`parserOptions.project\` configured to point at your project tsconfig.json files in the relevant TypeScript file "overrides" block of your project ESLint config ${eslintConfigPath || eslintConfigPathForError}
|
|
81
82
|
|
|
82
83
|
Please see https://nx.dev/guides/eslint for full guidance on how to resolve this issue.
|
|
83
84
|
`);
|
|
@@ -5,6 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const versions_1 = require("../../utils/versions");
|
|
6
6
|
const eslint_file_1 = require("../utils/eslint-file");
|
|
7
7
|
const global_eslint_config_1 = require("./global-eslint-config");
|
|
8
|
+
const plugin_1 = require("../utils/plugin");
|
|
8
9
|
function updateProductionFileset(tree) {
|
|
9
10
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
10
11
|
const productionFileSet = nxJson.namedInputs?.production;
|
|
@@ -63,7 +64,14 @@ function updateVSCodeExtensions(tree) {
|
|
|
63
64
|
* Initializes ESLint configuration in a workspace and adds necessary dependencies.
|
|
64
65
|
*/
|
|
65
66
|
function initEsLint(tree, options) {
|
|
66
|
-
|
|
67
|
+
const addPlugins = process.env.NX_PCV3 === 'true';
|
|
68
|
+
const hasPlugin = (0, plugin_1.hasEslintPlugin)(tree);
|
|
69
|
+
const rootEslintFile = (0, eslint_file_1.findEslintFile)(tree);
|
|
70
|
+
if (rootEslintFile && addPlugins && !hasPlugin) {
|
|
71
|
+
addPlugin(tree);
|
|
72
|
+
return () => { };
|
|
73
|
+
}
|
|
74
|
+
if (rootEslintFile) {
|
|
67
75
|
return () => { };
|
|
68
76
|
}
|
|
69
77
|
if (!options.skipPackageJson) {
|
|
@@ -72,7 +80,6 @@ function initEsLint(tree, options) {
|
|
|
72
80
|
(0, devkit_1.writeJson)(tree, '.eslintrc.json', (0, global_eslint_config_1.getGlobalEsLintConfiguration)(options.unitTestRunner, options.rootProject));
|
|
73
81
|
tree.write('.eslintignore', 'node_modules\n');
|
|
74
82
|
updateProductionFileset(tree);
|
|
75
|
-
const addPlugins = process.env.NX_PCV3 === 'true';
|
|
76
83
|
if (addPlugins) {
|
|
77
84
|
addPlugin(tree);
|
|
78
85
|
}
|
|
@@ -10,6 +10,7 @@ const project_configuration_1 = require("nx/src/generators/utils/project-configu
|
|
|
10
10
|
const flat_config_1 = require("../../utils/flat-config");
|
|
11
11
|
const ast_utils_1 = require("../utils/flat-config/ast-utils");
|
|
12
12
|
const config_file_1 = require("../../utils/config-file");
|
|
13
|
+
const plugin_1 = require("../utils/plugin");
|
|
13
14
|
async function lintProjectGenerator(tree, options) {
|
|
14
15
|
const installTask = (0, init_1.lintInitGenerator)(tree, {
|
|
15
16
|
linter: options.linter,
|
|
@@ -28,10 +29,7 @@ async function lintProjectGenerator(tree, options) {
|
|
|
28
29
|
isBuildableLibraryProject(projectConfig)) {
|
|
29
30
|
lintFilePatterns.push(`{projectRoot}/package.json`);
|
|
30
31
|
}
|
|
31
|
-
const
|
|
32
|
-
const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
|
|
33
|
-
? p === '@nx/eslint/plugin'
|
|
34
|
-
: p.plugin === '@nx/eslint/plugin');
|
|
32
|
+
const hasPlugin = (0, plugin_1.hasEslintPlugin)(tree);
|
|
35
33
|
if (hasPlugin) {
|
|
36
34
|
if (lintFilePatterns &&
|
|
37
35
|
lintFilePatterns.length &&
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasEslintPlugin = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function hasEslintPlugin(tree) {
|
|
6
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
|
+
return nxJson.plugins?.some((p) => typeof p === 'string'
|
|
8
|
+
? p === '@nx/eslint/plugin'
|
|
9
|
+
: p.plugin === '@nx/eslint/plugin');
|
|
10
|
+
}
|
|
11
|
+
exports.hasEslintPlugin = hasEslintPlugin;
|