@angular-eslint/builder 20.5.3-alpha.2 → 20.5.3-alpha.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/dist/lint.impl.d.ts.map +1 -1
- package/dist/lint.impl.js +28 -6
- package/dist/schema.json +1 -1
- package/package.json +1 -1
package/dist/lint.impl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lint.impl.d.ts","sourceRoot":"","sources":["../src/lint.impl.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;;AAMvC,
|
|
1
|
+
{"version":3,"file":"lint.impl.d.ts","sourceRoot":"","sources":["../src/lint.impl.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;;AAMvC,wBA2OE"}
|
package/dist/lint.impl.js
CHANGED
|
@@ -11,7 +11,19 @@ exports.default = (0, architect_1.createBuilder)(async (options, context) => {
|
|
|
11
11
|
// We want these paths to always be resolved relative to the workspace
|
|
12
12
|
// root to be able to run the lint executor from any subfolder.
|
|
13
13
|
process.chdir(systemRoot);
|
|
14
|
-
|
|
14
|
+
// Resolve all relevant project metadata from the context
|
|
15
|
+
let projectName = '<???>';
|
|
16
|
+
let projectMetadata;
|
|
17
|
+
let projectRoot = '';
|
|
18
|
+
try {
|
|
19
|
+
projectMetadata = await context.getProjectMetadata(context.target?.project ?? '');
|
|
20
|
+
projectRoot = projectMetadata?.root ?? '';
|
|
21
|
+
projectName =
|
|
22
|
+
projectMetadata?.name ?? context.target?.project ?? '<???>';
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
/* empty */
|
|
26
|
+
}
|
|
15
27
|
const printInfo = options.format && !options.silent;
|
|
16
28
|
if (printInfo) {
|
|
17
29
|
console.info(`\nLinting ${JSON.stringify(projectName)}...`);
|
|
@@ -44,11 +56,9 @@ exports.default = (0, architect_1.createBuilder)(async (options, context) => {
|
|
|
44
56
|
if (err instanceof Error &&
|
|
45
57
|
err.message.includes('You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser')) {
|
|
46
58
|
let eslintConfigPathForError = `for ${projectName}`;
|
|
47
|
-
|
|
48
|
-
if (projectMetadata?.root) {
|
|
49
|
-
const { root } = projectMetadata;
|
|
59
|
+
if (projectRoot) {
|
|
50
60
|
eslintConfigPathForError =
|
|
51
|
-
resolveESLintConfigPath(
|
|
61
|
+
resolveESLintConfigPath(projectRoot) ?? '';
|
|
52
62
|
}
|
|
53
63
|
console.error(`
|
|
54
64
|
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}
|
|
@@ -110,7 +120,19 @@ For full guidance on how to resolve this issue, please see https://github.com/an
|
|
|
110
120
|
*/
|
|
111
121
|
const formattedResults = await formatter.format(finalLintResults);
|
|
112
122
|
if (options.outputFile) {
|
|
113
|
-
|
|
123
|
+
// Interpolate placeholders in outputFile path
|
|
124
|
+
let interpolatedOutputFile = options.outputFile;
|
|
125
|
+
if (interpolatedOutputFile.includes('{projectName}')) {
|
|
126
|
+
interpolatedOutputFile = interpolatedOutputFile.replace(/{projectName}/g, projectName);
|
|
127
|
+
}
|
|
128
|
+
if (interpolatedOutputFile.includes('{projectRoot}')) {
|
|
129
|
+
interpolatedOutputFile = interpolatedOutputFile.replace(/{projectRoot}/g, projectRoot);
|
|
130
|
+
}
|
|
131
|
+
// Clean up any resulting double slashes or leading slashes from empty replacements
|
|
132
|
+
interpolatedOutputFile = interpolatedOutputFile
|
|
133
|
+
.replace(/\/+/g, '/')
|
|
134
|
+
.replace(/^\//, '');
|
|
135
|
+
const pathToOutputFile = (0, path_1.join)(systemRoot, interpolatedOutputFile);
|
|
114
136
|
(0, fs_1.mkdirSync)((0, path_1.dirname)(pathToOutputFile), { recursive: true });
|
|
115
137
|
(0, fs_1.writeFileSync)(pathToOutputFile, formattedResults);
|
|
116
138
|
}
|
package/dist/schema.json
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"outputFile": {
|
|
26
26
|
"type": "string",
|
|
27
|
-
"description": "File to write report to instead of the console."
|
|
27
|
+
"description": "File to write report to instead of the console. Supports placeholders: {projectName} will be replaced with the project name, {projectRoot} will be replaced with the project root path."
|
|
28
28
|
},
|
|
29
29
|
"stats": {
|
|
30
30
|
"type": "boolean",
|