@nrwl/linter 13.2.3 → 13.3.0-beta.13

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/migrations.json CHANGED
@@ -58,6 +58,12 @@
58
58
  "version": "12.9.0-beta.0",
59
59
  "description": "Remove ESLint parserOptions.project config if no rules requiring type-checking are in use",
60
60
  "factory": "./src/migrations/update-12-4-0/remove-eslint-project-config-if-no-type-checking-rules"
61
+ },
62
+ "eslint-8-updates": {
63
+ "cli": "nx",
64
+ "version": "13.3.0-beta.0",
65
+ "description": "Update eslint-rules jest.config.js in order to support ESLint v8 exports mapping, remove category field",
66
+ "factory": "./src/migrations/update-13-3-0/eslint-8-updates"
61
67
  }
62
68
  },
63
69
  "packageJsonUpdates": {
@@ -145,6 +151,23 @@
145
151
  "version": "7.32.0"
146
152
  }
147
153
  }
154
+ },
155
+ "13.3.0": {
156
+ "version": "13.3.0-beta.0",
157
+ "packages": {
158
+ "@typescript-eslint/parser": {
159
+ "version": "~5.3.0"
160
+ },
161
+ "@typescript-eslint/eslint-plugin": {
162
+ "version": "~5.3.0"
163
+ },
164
+ "@typescript-eslint/experimental-utils": {
165
+ "version": "~5.3.0"
166
+ },
167
+ "eslint": {
168
+ "version": "8.2.0"
169
+ }
170
+ }
148
171
  }
149
172
  }
150
173
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/linter",
3
- "version": "13.2.3",
3
+ "version": "13.3.0-beta.13",
4
4
  "description": "Lint Plugin for Nx",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,9 +30,9 @@
30
30
  "builders": "./executors.json",
31
31
  "schematics": "./generators.json",
32
32
  "dependencies": {
33
- "@nrwl/devkit": "13.2.3",
34
- "@nrwl/jest": "13.2.3",
35
- "eslint": "7.32.0",
33
+ "@nrwl/devkit": "13.3.0-beta.13",
34
+ "@nrwl/jest": "13.3.0-beta.13",
35
+ "eslint": "8.2.0",
36
36
  "glob": "7.1.4",
37
37
  "minimatch": "3.0.4",
38
38
  "tmp": "~0.2.1",
@@ -1,6 +1,2 @@
1
- import type { Schema } from './schema';
2
1
  import type { ExecutorContext } from '@nrwl/devkit';
3
- /**
4
- * Adapted from @angular-eslint/builder source
5
- */
6
- export default function run(options: Schema, context: ExecutorContext): Promise<any>;
2
+ export default function run(_options: any, _context: ExecutorContext): Promise<any>;
@@ -1,108 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const fs_1 = require("fs");
5
- const path = require("path");
6
- const ts_utils_1 = require("./utility/ts-utils");
7
- const eslint_utils_1 = require("./utility/eslint-utils");
8
- const create_directory_1 = require("../eslint/utility/create-directory");
9
- /**
10
- * Adapted from @angular-eslint/builder source
11
- */
12
- function run(options, context) {
4
+ function run(_options, _context) {
13
5
  return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
14
- if (options.linter === 'tslint') {
15
- throw new Error(`'tslint' option is no longer supported. Update your angular.json to use "@nrwl/linter:eslint" builder.`);
16
- }
17
- const systemRoot = context.root;
18
- process.chdir(context.cwd);
19
- const projectName = context.projectName || '<???>';
20
- const printInfo = options.format && !options.silent;
21
- if (printInfo) {
22
- console.info(`\nLinting ${JSON.stringify(projectName)}...`);
23
- }
24
- const projectESLint = yield (0, eslint_utils_1.loadESLint)();
25
- const version = projectESLint.Linter.version &&
26
- projectESLint.Linter.version.split('.');
27
- if (!version ||
28
- version.length < 2 ||
29
- Number(version[0]) < 6 ||
30
- (Number(version[0]) === 6 && Number(version[1]) < 1)) {
31
- throw new Error('ESLint must be version 6.1 or higher.');
32
- }
33
- // We want users to have the option of not specifying the config path, and let
34
- // eslint automatically resolve the `.eslintrc.json` files in each folder.
35
- const eslintConfigPath = options.config
36
- ? path.resolve(systemRoot, options.config)
37
- : undefined;
38
- let lintReports = [];
39
- const lintedFiles = new Set();
40
- if (options.tsConfig) {
41
- const tsConfigs = Array.isArray(options.tsConfig)
42
- ? options.tsConfig
43
- : [options.tsConfig];
44
- const allPrograms = tsConfigs.map((tsConfig) => (0, ts_utils_1.createProgram)(path.resolve(systemRoot, tsConfig)));
45
- for (const program of allPrograms) {
46
- lintReports = [
47
- ...lintReports,
48
- ...(yield (0, eslint_utils_1.lint)(systemRoot, eslintConfigPath, options, lintedFiles, program, allPrograms)),
49
- ];
50
- }
51
- }
52
- else {
53
- lintReports = [
54
- ...lintReports,
55
- ...(yield (0, eslint_utils_1.lint)(systemRoot, eslintConfigPath, options, lintedFiles)),
56
- ];
57
- }
58
- if (lintReports.length === 0) {
59
- throw new Error('Invalid lint configuration. Nothing to lint.');
60
- }
61
- const formatter = projectESLint.CLIEngine.getFormatter(options.format);
62
- const bundledReport = {
63
- errorCount: 0,
64
- fixableErrorCount: 0,
65
- fixableWarningCount: 0,
66
- warningCount: 0,
67
- results: [],
68
- usedDeprecatedRules: [],
69
- };
70
- for (const report of lintReports) {
71
- // output fixes to disk
72
- projectESLint.CLIEngine.outputFixes(report);
73
- if (report.errorCount || report.warningCount) {
74
- bundledReport.errorCount += report.errorCount;
75
- bundledReport.warningCount += report.warningCount;
76
- bundledReport.fixableErrorCount += report.fixableErrorCount;
77
- bundledReport.fixableWarningCount += report.fixableWarningCount;
78
- bundledReport.results.push(...report.results);
79
- bundledReport.usedDeprecatedRules.push(...report.usedDeprecatedRules);
80
- }
81
- }
82
- const formattedResults = formatter(bundledReport.results);
83
- console.info(formattedResults);
84
- if (options.outputFile) {
85
- const pathToFile = path.join(context.root, options.outputFile);
86
- (0, create_directory_1.createDirectory)(path.dirname(pathToFile));
87
- (0, fs_1.writeFileSync)(pathToFile, formattedResults);
88
- }
89
- if (bundledReport.warningCount > 0 && printInfo) {
90
- console.warn('Lint warnings found in the listed files.\n');
91
- }
92
- if (bundledReport.errorCount > 0 && printInfo) {
93
- console.error('Lint errors found in the listed files.\n');
94
- }
95
- if (bundledReport.warningCount === 0 &&
96
- bundledReport.errorCount === 0 &&
97
- printInfo) {
98
- console.info('All files pass linting.\n');
99
- }
100
- return {
101
- success: options.force ||
102
- (bundledReport.errorCount === 0 &&
103
- (options.maxWarnings === -1 ||
104
- bundledReport.warningCount <= options.maxWarnings)),
105
- };
6
+ throw new Error(`"@nrwl/linter:lint" was deprecated in v10 and is no longer supported. Update your angular.json to use "@nrwl/linter:eslint" builder instead.`);
106
7
  });
107
8
  }
108
9
  exports.default = run;
@@ -1 +1 @@
1
- {"version":3,"file":"lint.impl.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/executors/lint/lint.impl.ts"],"names":[],"mappings":";;;AACA,2BAAmC;AACnC,6BAA6B;AAE7B,iDAAmD;AACnD,yDAA0D;AAC1D,yEAAqE;AAGrE;;GAEG;AACH,SAA8B,GAAG,CAC/B,OAAe,EACf,OAAwB;;QAExB,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE;YAC/B,MAAM,IAAI,KAAK,CACb,wGAAwG,CACzG,CAAC;SACH;QAED,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3B,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC;QAEnD,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QAEpD,IAAI,SAAS,EAAE;YACb,OAAO,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;SAC7D;QAED,MAAM,aAAa,GAAG,MAAM,IAAA,yBAAU,GAAE,CAAC;QACzC,MAAM,OAAO,GACV,aAAa,CAAC,MAAc,CAAC,OAAO;YACpC,aAAa,CAAC,MAAc,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnD,IACE,CAAC,OAAO;YACR,OAAO,CAAC,MAAM,GAAG,CAAC;YAClB,MAAM,CAAC,OAAO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AU,CAAC,CAAC;YAC/D,IAAA,kCAAe,EAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;YAC1C,IAAA,kBAAa,EAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;SAC7C;QACD,IAAI,aAAa,CAAC,YAAY,GAAG,CAAC,IAAI,SAAS,EAAE;YAC/C,OAAO,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;SAC5D;QAED,IAAI,aAAa,CAAC,UAAU,GAAG,CAAC,IAAI,SAAS,EAAE;YAC7C,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;SAC3D;QAED,IACE,aAAa,CAAC,YAAY,KAAK,CAAC;YAChC,aAAa,CAAC,UAAU,KAAK,CAAC;YAC9B,SAAS,EACT;YACA,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;SAC3C;QAED,OAAO;YACL,OAAO,EACL,OAAO,CAAC,KAAK;gBACb,CAAC,aAAa,CAAC,UAAU,KAAK,CAAC;oBAC7B,CAAC,OAAO,CAAC,WAAW,KAAK,CAAC,CAAC;wBACzB,aAAa,CAAC,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;SAC1D,CAAC;IACJ,CAAC;CAAA;AAnID,sBAmIC"}
1
+ {"version":3,"file":"lint.impl.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/executors/lint/lint.impl.ts"],"names":[],"mappings":";;;AAEA,SAA8B,GAAG,CAC/B,QAAa,EACb,QAAyB;;QAEzB,MAAM,IAAI,KAAK,CACb,8IAA8I,CAC/I,CAAC;IACJ,CAAC;CAAA;AAPD,sBAOC"}
@@ -25,7 +25,6 @@ export const rule = ESLintUtils.RuleCreator(() => __filename)({
25
25
  type: 'problem',
26
26
  docs: {
27
27
  description: ``,
28
- category: 'Possible Errors',
29
28
  recommended: 'error',
30
29
  },
31
30
  schema: [],
@@ -34,13 +34,19 @@ function lintWorkspaceRulesProjectGenerator(tree) {
34
34
  const workspaceConfig = (0, devkit_1.readWorkspaceConfiguration)(tree);
35
35
  (0, devkit_1.updateWorkspaceConfiguration)(tree, Object.assign(Object.assign({}, workspaceConfig), { implicitDependencies: Object.assign(Object.assign({}, workspaceConfig.implicitDependencies), { [`${WORKSPACE_PLUGIN_DIR}/**/*`]: '*' }) }));
36
36
  // Add jest to the project and return installation task
37
- return yield (0, jest_1.jestProjectGenerator)(tree, {
37
+ const jestInstallationTask = yield (0, jest_1.jestProjectGenerator)(tree, {
38
38
  project: exports.WORKSPACE_RULES_PROJECT_NAME,
39
39
  supportTsx: false,
40
40
  skipSerializers: true,
41
41
  setupFile: 'none',
42
42
  babelJest: false,
43
43
  });
44
+ // Add extra config to the jest.config.js file to allow ESLint 8 exports mapping to work with jest
45
+ (0, jest_1.addPropertyToJestConfig)(tree, (0, devkit_1.joinPathFragments)(WORKSPACE_PLUGIN_DIR, 'jest.config.js'), 'moduleNameMapper', {
46
+ '@eslint/eslintrc': '@eslint/eslintrc/dist/eslintrc-universal.cjs',
47
+ });
48
+ yield (0, devkit_1.formatFiles)(tree);
49
+ return jestInstallationTask;
44
50
  });
45
51
  }
46
52
  exports.lintWorkspaceRulesProjectGenerator = lintWorkspaceRulesProjectGenerator;
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-rules-project.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/generators/workspace-rules-project/workspace-rules-project.ts"],"names":[],"mappings":";;;;AAAA,yCASsB;AACtB,qCAAkD;AAClD,+BAA4B;AAC5B,2EAA0E;AAE7D,QAAA,4BAA4B,GAAG,cAAc,CAAC;AAE3D,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAElD,SAAsB,kCAAkC,CAAC,IAAU;;QACjE,qDAAqD;QACrD,IAAI;YACF,IAAA,iCAAwB,EAAC,IAAI,EAAE,oCAA4B,CAAC,CAAC;YAC7D,OAAO;SACR;QAAC,WAAM,GAAE;QAEV,2EAA2E;QAC3E,IAAA,gCAAuB,EAAC,IAAI,EAAE,oCAA4B,EAAE;YAC1D,IAAI,EAAE,oBAAoB;YAC1B,UAAU,EAAE,oBAAoB;YAChC,OAAO,EAAE,EAAE;SACZ,CAAC,CAAC;QAEH,8BAA8B;QAC9B,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,OAAO,CAAC,EAAE,6CAAsB,EAAE;YACpE,IAAI,EAAE,EAAE;YACR,cAAc,EAAE,IAAA,uBAAc,EAAC,oBAAoB,CAAC;SACrD,CAAC,CAAC;QAEH;;;WAGG;QACH,MAAM,eAAe,GAAG,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC;QACzD,IAAA,qCAA4B,EAAC,IAAI,kCAC5B,eAAe,KAClB,oBAAoB,kCACf,eAAe,CAAC,oBAAoB,KACvC,CAAC,GAAG,oBAAoB,OAAO,CAAC,EAAE,GAAG,OAEvC,CAAC;QAEH,uDAAuD;QACvD,OAAO,MAAM,IAAA,2BAAoB,EAAC,IAAI,EAAE;YACtC,OAAO,EAAE,oCAA4B;YACrC,UAAU,EAAE,KAAK;YACjB,eAAe,EAAE,IAAI;YACrB,SAAS,EAAE,MAAM;YACjB,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;IACL,CAAC;CAAA;AAzCD,gFAyCC;AAEY,QAAA,kCAAkC,GAAG,IAAA,2BAAkB,EAClE,kCAAkC,CACnC,CAAC"}
1
+ {"version":3,"file":"workspace-rules-project.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/generators/workspace-rules-project/workspace-rules-project.ts"],"names":[],"mappings":";;;;AAAA,yCAWsB;AACtB,qCAA2E;AAC3E,+BAA4B;AAC5B,2EAA0E;AAE7D,QAAA,4BAA4B,GAAG,cAAc,CAAC;AAE3D,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAElD,SAAsB,kCAAkC,CAAC,IAAU;;QACjE,qDAAqD;QACrD,IAAI;YACF,IAAA,iCAAwB,EAAC,IAAI,EAAE,oCAA4B,CAAC,CAAC;YAC7D,OAAO;SAC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devkit';
2
+ export default function eslint8Updates(tree: Tree): Promise<void>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nrwl/devkit");
5
+ const jest_1 = require("@nrwl/jest");
6
+ const tsquery_1 = require("@phenomnomnominal/tsquery");
7
+ function eslint8Updates(tree) {
8
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
9
+ try {
10
+ const existingJestConfigPath = (0, devkit_1.normalizePath)('tools/eslint-rules/jest.config.js');
11
+ // Add extra config to the jest.config.js file to allow ESLint 8 exports mapping to work with jest
12
+ (0, jest_1.addPropertyToJestConfig)(tree, existingJestConfigPath, 'moduleNameMapper', {
13
+ '@eslint/eslintrc': '@eslint/eslintrc/dist/eslintrc-universal.cjs',
14
+ });
15
+ (0, devkit_1.visitNotIgnoredFiles)(tree, 'tools/eslint-rules', (path) => {
16
+ if (!path.endsWith('.ts')) {
17
+ return;
18
+ }
19
+ const fileContents = tree.read(path).toString('utf-8');
20
+ const fileAst = tsquery_1.tsquery.ast(fileContents);
21
+ const isESLintRuleFile = (0, tsquery_1.tsquery)(fileAst, 'PropertyAccessExpression[expression.escapedText=ESLintUtils][name.escapedText=RuleCreator]').length > 0;
22
+ if (!isESLintRuleFile) {
23
+ return;
24
+ }
25
+ const categoryPropertyAssignmentNode = (0, tsquery_1.tsquery)(fileAst, 'PropertyAssignment[name.escapedText=meta] PropertyAssignment[name.escapedText=docs] PropertyAssignment[name.escapedText=category]')[0];
26
+ if (!categoryPropertyAssignmentNode) {
27
+ return;
28
+ }
29
+ let end = categoryPropertyAssignmentNode.getEnd();
30
+ if (fileContents.substring(end, end + 1) === ',') {
31
+ end++;
32
+ }
33
+ const updatedContents = fileContents.slice(0, categoryPropertyAssignmentNode.getFullStart()) +
34
+ fileContents.slice(end);
35
+ tree.write(path, updatedContents);
36
+ });
37
+ yield (0, devkit_1.formatFiles)(tree);
38
+ }
39
+ catch (_a) { }
40
+ });
41
+ }
42
+ exports.default = eslint8Updates;
43
+ //# sourceMappingURL=eslint-8-updates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eslint-8-updates.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/migrations/update-13-3-0/eslint-8-updates.ts"],"names":[],"mappings":";;;AAAA,yCAKsB;AACtB,qCAAqD;AACrD,uDAAoD;AAEpD,SAA8B,cAAc,CAAC,IAAU;;QACrD,IAAI;YACF,MAAM,sBAAsB,GAAG,IAAA,sBAAa,EAC1C,mCAAmC,CACpC,CAAC;YAEF,kGAAkG;YAClG,IAAA,8BAAuB,EAAC,IAAI,EAAE,sBAAsB,EAAE,kBAAkB,EAAE;gBACxE,kBAAkB,EAAE,8CAA8C;aACnE,CAAC,CAAC;YAEH,IAAA,6BAAoB,EAAC,IAAI,EAAE,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE;gBACxD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;oBACzB,OAAO;iBACR;gBACD,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;gBACvD,MAAM,OAAO,GAAG,iBAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAC1C,MAAM,gBAAgB,GACpB,IAAA,iBAAO,EACL,OAAO,EACP,4FAA4F,CAC7F,CAAC,MAAM,GAAG,CAAC,CAAC;gBACf,IAAI,CAAC,gBAAgB,EAAE;oBACrB,OAAO;iBACR;gBACD,MAAM,8BAA8B,GAAG,IAAA,iBAAO,EAC5C,OAAO,EACP,oIAAoI,CACrI,CAAC,CAAC,CAAC,CAAC;gBACL,IAAI,CAAC,8BAA8B,EAAE;oBACnC,OAAO;iBACR;gBACD,IAAI,GAAG,GAAG,8BAA8B,CAAC,MAAM,EAAE,CAAC;gBAClD,IAAI,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;oBAChD,GAAG,EAAE,CAAC;iBACP;gBACD,MAAM,eAAe,GACnB,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,8BAA8B,CAAC,YAAY,EAAE,CAAC;oBACpE,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC1B,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;YAEH,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAAC,WAAM,GAAE;IACZ,CAAC;CAAA;AA5CD,iCA4CC"}
@@ -2,6 +2,6 @@ export declare const nxVersion = "*";
2
2
  export declare const tslintVersion = "~6.1.0";
3
3
  export declare const tslintToEslintConfigVersion = "^2.4.0";
4
4
  export declare const buildAngularVersion = "~13.0.0";
5
- export declare const typescriptESLintVersion = "~4.33.0";
6
- export declare const eslintVersion = "7.32.0";
5
+ export declare const typescriptESLintVersion = "~5.3.0";
6
+ export declare const eslintVersion = "8.2.0";
7
7
  export declare const eslintConfigPrettierVersion = "8.1.0";
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.eslintConfigPrettierVersion = exports.eslintVersion = exports.typescriptESLintVersion = exports.buildAngularVersion = exports.tslintToEslintConfigVersion = exports.tslintVersion = exports.nxVersion = void 0;
4
- exports.nxVersion = '13.2.3';
4
+ exports.nxVersion = '13.3.0-beta.13';
5
5
  exports.tslintVersion = '~6.1.0';
6
6
  exports.tslintToEslintConfigVersion = '^2.4.0';
7
7
  exports.buildAngularVersion = '~13.0.0';
8
- exports.typescriptESLintVersion = '~4.33.0';
9
- exports.eslintVersion = '7.32.0';
8
+ exports.typescriptESLintVersion = '~5.3.0';
9
+ exports.eslintVersion = '8.2.0';
10
10
  exports.eslintConfigPrettierVersion = '8.1.0';
11
11
  //# sourceMappingURL=versions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/linter/src/utils/versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,GAAG,CAAC;AAEhB,QAAA,aAAa,GAAG,QAAQ,CAAC;AACzB,QAAA,2BAA2B,GAAG,QAAQ,CAAC;AACvC,QAAA,mBAAmB,GAAG,SAAS,CAAC;AAEhC,QAAA,uBAAuB,GAAG,SAAS,CAAC;AACpC,QAAA,aAAa,GAAG,QAAQ,CAAC;AACzB,QAAA,2BAA2B,GAAG,OAAO,CAAC"}
1
+ {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/linter/src/utils/versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,GAAG,CAAC;AAEhB,QAAA,aAAa,GAAG,QAAQ,CAAC;AACzB,QAAA,2BAA2B,GAAG,QAAQ,CAAC;AACvC,QAAA,mBAAmB,GAAG,SAAS,CAAC;AAEhC,QAAA,uBAAuB,GAAG,QAAQ,CAAC;AACnC,QAAA,aAAa,GAAG,OAAO,CAAC;AACxB,QAAA,2BAA2B,GAAG,OAAO,CAAC"}
@@ -1,31 +0,0 @@
1
- export interface Schema {
2
- linter: 'eslint' | 'tslint';
3
- config: string;
4
- tsConfig?: string | string[];
5
- format: Formatter;
6
- exclude: string[];
7
- files: string[];
8
- force?: boolean;
9
- silent?: boolean;
10
- fix?: boolean;
11
- cache?: boolean;
12
- outputFile?: string;
13
- cacheLocation?: string;
14
- maxWarnings: number;
15
- quiet?: boolean;
16
- }
17
-
18
- type Formatter =
19
- | 'stylish'
20
- | 'compact'
21
- | 'codeframe'
22
- | 'unix'
23
- | 'visualstudio'
24
- | 'table'
25
- | 'checkstyle'
26
- | 'html'
27
- | 'jslint-xml'
28
- | 'json'
29
- | 'json-with-metadata'
30
- | 'junit'
31
- | 'tap';
@@ -1,9 +0,0 @@
1
- import type { Schema } from '../schema';
2
- /**
3
- * Copied from @angular-eslint/builder source
4
- */
5
- export declare function loadESLint(): Promise<any>;
6
- /**
7
- * Adapted from @angular-eslint/builder source
8
- */
9
- export declare function lint(systemRoot: string, eslintConfigPath: string, options: Schema, lintedFiles: Set<string>, program?: any, allPrograms?: any[]): Promise<any[]>;
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lint = exports.loadESLint = void 0;
4
- const tslib_1 = require("tslib");
5
- const file_utils_1 = require("./file-utils");
6
- const eslint_1 = require("eslint");
7
- /**
8
- * Copied from @angular-eslint/builder source
9
- */
10
- function loadESLint() {
11
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
12
- let eslint;
13
- try {
14
- eslint = yield Promise.resolve().then(() => require('eslint'));
15
- return eslint;
16
- }
17
- catch (_a) {
18
- throw new Error('Unable to find ESLint. Ensure ESLint is installed.');
19
- }
20
- });
21
- }
22
- exports.loadESLint = loadESLint;
23
- /**
24
- * Adapted from @angular-eslint/builder source
25
- */
26
- function lint(systemRoot, eslintConfigPath, options, lintedFiles, program, allPrograms) {
27
- return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
28
- const files = (0, file_utils_1.getFilesToLint)(systemRoot, options, program);
29
- const projectESLint = yield loadESLint();
30
- const cli = new projectESLint.CLIEngine({
31
- configFile: eslintConfigPath,
32
- useEslintrc: true,
33
- fix: !!options.fix,
34
- cache: !!options.cache,
35
- cacheLocation: options.cacheLocation,
36
- });
37
- const lintReports = [];
38
- for (const file of files) {
39
- if (program && allPrograms) {
40
- // If it cannot be found in ANY program, then this is an error.
41
- if (allPrograms.every((p) => p.getSourceFile(file) === undefined)) {
42
- throw new Error(`File ${JSON.stringify(file)} is not part of a TypeScript project '${options.tsConfig}'.`);
43
- }
44
- else if (program.getSourceFile(file) === undefined) {
45
- // The file exists in some other programs. We will lint it later (or earlier) in the loop.
46
- continue;
47
- }
48
- }
49
- // Already linted the current file, so skip it here...
50
- if (lintedFiles.has(file)) {
51
- continue;
52
- }
53
- // Give some breathing space to other promises that might be waiting.
54
- yield Promise.resolve();
55
- const report = cli.executeOnFiles([file]);
56
- if (options.quiet) {
57
- report.results = eslint_1.CLIEngine.getErrorResults(report.results);
58
- report.errorCount = 0;
59
- }
60
- lintReports.push(report);
61
- lintedFiles.add(file);
62
- }
63
- return lintReports;
64
- });
65
- }
66
- exports.lint = lint;
67
- //# sourceMappingURL=eslint-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eslint-utils.js","sourceRoot":"","sources":["../../../../../../../packages/linter/src/executors/lint/utility/eslint-utils.ts"],"names":[],"mappings":";;;;AAAA,6CAA8C;AAE9C,mCAAmC;AAEnC;;GAEG;AAEH,SAAsB,UAAU;;QAC9B,IAAI,MAAM,CAAC;QACX,IAAI;YACF,MAAM,GAAG,2CAAa,QAAQ,EAAC,CAAC;YAChC,OAAO,MAAM,CAAC;SACf;QAAC,WAAM;YACN,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;SACvE;IACH,CAAC;CAAA;AARD,gCAQC;AAED;;GAEG;AAEH,SAAsB,IAAI,CACxB,UAAkB,EAClB,gBAAwB,EACxB,OAAe,EACf,WAAwB,EACxB,OAAa,EACb,WAAmB;;QAEnB,MAAM,KAAK,GAAG,IAAA,2BAAc,EAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAE3D,MAAM,aAAa,GAAG,MAAM,UAAU,EAAE,CAAC;QACzC,MAAM,GAAG,GAAc,IAAI,aAAa,CAAC,SAAS,CAAC;YACjD,UAAU,EAAE,gBAAgB;YAC5B,WAAW,EAAE,IAAI;YACjB,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG;YAClB,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK;YACtB,aAAa,EAAE,OAAO,CAAC,aAAa;SACrC,CAAC,CAAC;QAEH,MAAM,WAAW,GAA2B,EAAE,CAAC;QAE/C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,IAAI,OAAO,IAAI,WAAW,EAAE;gBAC1B,+DAA+D;gBAC/D,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,EAAE;oBACjE,MAAM,IAAI,KAAK,CACb,QAAQ,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,yCAC1B,OAAO,CAAC,QACV,IAAI,CACL,CAAC;iBACH;qBAAM,IAAI,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE;oBACpD,0FAA0F;oBAC1F,SAAS;iBACV;aACF;YAED,sDAAsD;YACtD,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;gBACzB,SAAS;aACV;YAED,qEAAqE;YACrE,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;YACxB,MAAM,MAAM,GAAG,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YAC1C,IAAI,OAAO,CAAC,KAAK,EAAE;gBACjB,MAAM,CAAC,OAAO,GAAG,kBAAS,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAC3D,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC;aACvB;YACD,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACzB,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACvB;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CAAA;AArDD,oBAqDC"}
@@ -1,5 +0,0 @@
1
- import * as ts from 'typescript';
2
- export declare function getFilesToLint(root: string, options: {
3
- exclude: string[];
4
- files: string[];
5
- }, program?: ts.Program): string[];
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFilesToLint = void 0;
4
- const minimatch_1 = require("minimatch");
5
- const path = require("path");
6
- const glob = require("glob");
7
- /**
8
- * - Copied from TSLint source:
9
- *
10
- * Returns an array of all outputs that are not `undefined`
11
- */
12
- function mapDefined(inputs, getOutput) {
13
- const out = [];
14
- for (const input of inputs) {
15
- const output = getOutput(input);
16
- if (output !== undefined) {
17
- out.push(output);
18
- }
19
- }
20
- return out;
21
- }
22
- /**
23
- * - Adapted from TSLint source:
24
- *
25
- * Returns a list of source file names from a TypeScript program.
26
- * This includes all referenced files and excludes JSON files, to avoid problems with `resolveJsonModule`.
27
- */
28
- function getFileNamesFromProgram(program) {
29
- return mapDefined(program.getSourceFiles(), (file) => file.fileName.endsWith('.json') ||
30
- program.isSourceFileFromExternalLibrary(file)
31
- ? undefined
32
- : file.fileName);
33
- }
34
- function getFilesToLint(root, options, program) {
35
- const ignore = options.exclude;
36
- const files = options.files || [];
37
- if (files.length > 0) {
38
- return files
39
- .map((file) => glob.sync(file, { cwd: root, ignore, nodir: true }))
40
- .reduce((prev, curr) => prev.concat(curr), [])
41
- .map((file) => path.join(root, file));
42
- }
43
- if (!program) {
44
- return [];
45
- }
46
- let programFiles = getFileNamesFromProgram(program);
47
- if (ignore && ignore.length > 0) {
48
- // normalize to support ./ paths
49
- const ignoreMatchers = ignore.map((pattern) => new minimatch_1.Minimatch(path.normalize(pattern), { dot: true }));
50
- programFiles = programFiles.filter((file) => !ignoreMatchers.some((matcher) => matcher.match(path.relative(root, file))));
51
- }
52
- return programFiles;
53
- }
54
- exports.getFilesToLint = getFilesToLint;
55
- //# sourceMappingURL=file-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-utils.js","sourceRoot":"","sources":["../../../../../../../packages/linter/src/executors/lint/utility/file-utils.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AACtC,6BAA6B;AAC7B,6BAA6B;AAE7B;;;;GAIG;AACH,SAAS,UAAU,CACjB,MAAwB,EACxB,SAAsC;IAEtC,MAAM,GAAG,GAAG,EAAE,CAAC;IACf,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;QAC1B,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAA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M,GAAG,CAAC,EAAE;QAC/B,gCAAgC;QAChC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAC/B,CAAC,OAAY,EAAE,EAAE,CAAC,IAAI,qBAAS,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CACxE,CAAC;QAEF,YAAY,GAAG,YAAY,CAAC,MAAM,CAChC,CAAC,IAAS,EAAE,EAAE,CACZ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,OAAY,EAAE,EAAE,CACpC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CACzC,CACJ,CAAC;KACH;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AApCD,wCAoCC"}
@@ -1,7 +0,0 @@
1
- import * as ts from 'typescript';
2
- /**
3
- * - Adapted from TSLint source:
4
- *
5
- * Creates a TypeScript program object from a tsconfig.json file path and optional project directory.
6
- */
7
- export declare function createProgram(configFile: string, projectDirectory?: string): ts.Program;
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createProgram = void 0;
4
- const fs_1 = require("fs");
5
- const ts = require("typescript");
6
- const path = require("path");
7
- /**
8
- * - Copied from TSLint source:
9
- *
10
- * Used to exit the program and display a friendly message without the callstack.
11
- */
12
- class FatalError extends Error {
13
- constructor(message, innerError) {
14
- super(message);
15
- this.message = message;
16
- this.innerError = innerError;
17
- this.name = FatalError.NAME;
18
- // Fix prototype chain for target ES5
19
- Object.setPrototypeOf(this, FatalError.prototype);
20
- }
21
- }
22
- FatalError.NAME = 'FatalError';
23
- /**
24
- * - Adapted from TSLint source:
25
- *
26
- * Creates a TypeScript program object from a tsconfig.json file path and optional project directory.
27
- */
28
- function createProgram(configFile, projectDirectory = path.dirname(configFile)) {
29
- const config = ts.readConfigFile(configFile, ts.sys.readFile);
30
- if (config.error !== undefined) {
31
- throw new FatalError(ts.formatDiagnostics([config.error], {
32
- getCanonicalFileName: (f) => f,
33
- getCurrentDirectory: process.cwd,
34
- getNewLine: () => '\n',
35
- }));
36
- }
37
- const parseConfigHost = {
38
- fileExists: fs_1.existsSync,
39
- readDirectory: ts.sys.readDirectory,
40
- readFile: (file) => (0, fs_1.readFileSync)(file, 'utf8'),
41
- useCaseSensitiveFileNames: true,
42
- };
43
- const parsed = ts.parseJsonConfigFileContent(config.config, parseConfigHost, path.resolve(projectDirectory), { noEmit: true });
44
- if (parsed.errors !== undefined) {
45
- // ignore warnings and 'TS18003: No inputs were found in config file ...'
46
- const errors = parsed.errors.filter((d) => d.category === ts.DiagnosticCategory.Error && d.code !== 18003);
47
- if (errors.length !== 0) {
48
- throw new FatalError(ts.formatDiagnostics(errors, {
49
- getCanonicalFileName: (f) => f,
50
- getCurrentDirectory: process.cwd,
51
- getNewLine: () => '\n',
52
- }));
53
- }
54
- }
55
- const host = ts.createCompilerHost(parsed.options, true);
56
- const program = ts.createProgram(parsed.fileNames, parsed.options, host);
57
- return program;
58
- }
59
- exports.createProgram = createProgram;
60
- //# sourceMappingURL=ts-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ts-utils.js","sourceRoot":"","sources":["../../../../../../../packages/linter/src/executors/lint/utility/ts-utils.ts"],"names":[],"mappings":";;;AAAA,2BAA8C;AAC9C,iCAAiC;AACjC,6BAA6B;AAgB7B;;;;GAIG;AACH,MAAM,UAAW,SAAQ,KAAK;IAE5B,YAAmB,OAAe,EAAS,UAAkB;QAC3D,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,YAAO,GAAP,OAAO,CAAQ;QAAS,eAAU,GAAV,UAAU,CAAQ;QAE3D,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAE5B,qCAAqC;QACrC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;;AAPa,eAAI,GAAG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