@nrwl/linter 16.0.0-beta.0 → 16.0.0-beta.1

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.
Files changed (110) hide show
  1. package/executors.json +5 -5
  2. package/generators.json +2 -28
  3. package/index.d.ts +1 -5
  4. package/index.js +1 -13
  5. package/index.js.map +1 -1
  6. package/package.json +7 -20
  7. package/README.md +0 -61
  8. package/migrations.json +0 -226
  9. package/src/executors/eslint/compat.d.ts +0 -2
  10. package/src/executors/eslint/compat.js +0 -6
  11. package/src/executors/eslint/compat.js.map +0 -1
  12. package/src/executors/eslint/hasher.d.ts +0 -7
  13. package/src/executors/eslint/hasher.js +0 -47
  14. package/src/executors/eslint/hasher.js.map +0 -1
  15. package/src/executors/eslint/lint.impl.d.ts +0 -5
  16. package/src/executors/eslint/lint.impl.js +0 -116
  17. package/src/executors/eslint/lint.impl.js.map +0 -1
  18. package/src/executors/eslint/schema.d.ts +0 -38
  19. package/src/executors/eslint/schema.json +0 -139
  20. package/src/executors/eslint/utility/eslint-utils.d.ts +0 -4
  21. package/src/executors/eslint/utility/eslint-utils.js +0 -52
  22. package/src/executors/eslint/utility/eslint-utils.js.map +0 -1
  23. package/src/generators/init/global-eslint-config.d.ts +0 -36
  24. package/src/generators/init/global-eslint-config.js +0 -77
  25. package/src/generators/init/global-eslint-config.js.map +0 -1
  26. package/src/generators/init/init-migration.d.ts +0 -3
  27. package/src/generators/init/init-migration.js +0 -68
  28. package/src/generators/init/init-migration.js.map +0 -1
  29. package/src/generators/init/init.d.ts +0 -9
  30. package/src/generators/init/init.js +0 -63
  31. package/src/generators/init/init.js.map +0 -1
  32. package/src/generators/lint-project/lint-project.d.ts +0 -16
  33. package/src/generators/lint-project/lint-project.js +0 -137
  34. package/src/generators/lint-project/lint-project.js.map +0 -1
  35. package/src/generators/utils/eslint-file.d.ts +0 -4
  36. package/src/generators/utils/eslint-file.js +0 -27
  37. package/src/generators/utils/eslint-file.js.map +0 -1
  38. package/src/generators/utils/eslint-targets.d.ts +0 -2
  39. package/src/generators/utils/eslint-targets.js +0 -13
  40. package/src/generators/utils/eslint-targets.js.map +0 -1
  41. package/src/generators/utils/linter.d.ts +0 -4
  42. package/src/generators/utils/linter.js +0 -9
  43. package/src/generators/utils/linter.js.map +0 -1
  44. package/src/generators/workspace-rule/files/__name__.spec.ts__tmpl__ +0 -11
  45. package/src/generators/workspace-rule/files/__name__.ts__tmpl__ +0 -37
  46. package/src/generators/workspace-rule/schema.json +0 -26
  47. package/src/generators/workspace-rule/workspace-rule.d.ts +0 -7
  48. package/src/generators/workspace-rule/workspace-rule.js +0 -79
  49. package/src/generators/workspace-rule/workspace-rule.js.map +0 -1
  50. package/src/generators/workspace-rules-project/files/index.ts__tmpl__ +0 -27
  51. package/src/generators/workspace-rules-project/files/tsconfig.json__tmpl__ +0 -13
  52. package/src/generators/workspace-rules-project/files/tsconfig.lint.json__tmpl__ +0 -9
  53. package/src/generators/workspace-rules-project/schema.json +0 -23
  54. package/src/generators/workspace-rules-project/workspace-rules-project.d.ts +0 -8
  55. package/src/generators/workspace-rules-project/workspace-rules-project.js +0 -86
  56. package/src/generators/workspace-rules-project/workspace-rules-project.js.map +0 -1
  57. package/src/migrations/update-12-4-0/remove-eslint-project-config-if-no-type-checking-rules.d.ts +0 -2
  58. package/src/migrations/update-12-4-0/remove-eslint-project-config-if-no-type-checking-rules.js +0 -32
  59. package/src/migrations/update-12-4-0/remove-eslint-project-config-if-no-type-checking-rules.js.map +0 -1
  60. package/src/migrations/update-12-9-0/add-outputs.d.ts +0 -2
  61. package/src/migrations/update-12-9-0/add-outputs.js +0 -23
  62. package/src/migrations/update-12-9-0/add-outputs.js.map +0 -1
  63. package/src/migrations/update-13-3-0/eslint-8-updates.d.ts +0 -2
  64. package/src/migrations/update-13-3-0/eslint-8-updates.js +0 -44
  65. package/src/migrations/update-13-3-0/eslint-8-updates.js.map +0 -1
  66. package/src/migrations/update-14-1-9/add-swc-deps-if-needed.d.ts +0 -2
  67. package/src/migrations/update-14-1-9/add-swc-deps-if-needed.js +0 -20
  68. package/src/migrations/update-14-1-9/add-swc-deps-if-needed.js.map +0 -1
  69. package/src/migrations/update-14-4-4/experimental-to-utils-deps.d.ts +0 -2
  70. package/src/migrations/update-14-4-4/experimental-to-utils-deps.js +0 -30
  71. package/src/migrations/update-14-4-4/experimental-to-utils-deps.js.map +0 -1
  72. package/src/migrations/update-14-4-4/experimental-to-utils-rules.d.ts +0 -2
  73. package/src/migrations/update-14-4-4/experimental-to-utils-rules.js +0 -38
  74. package/src/migrations/update-14-4-4/experimental-to-utils-rules.js.map +0 -1
  75. package/src/migrations/update-15-0-0/add-eslint-inputs.d.ts +0 -2
  76. package/src/migrations/update-15-0-0/add-eslint-inputs.js +0 -33
  77. package/src/migrations/update-15-0-0/add-eslint-inputs.js.map +0 -1
  78. package/src/migrations/update-15-7-1/add-eslint-ignore.d.ts +0 -2
  79. package/src/migrations/update-15-7-1/add-eslint-ignore.js +0 -42
  80. package/src/migrations/update-15-7-1/add-eslint-ignore.js.map +0 -1
  81. package/src/utils/convert-tslint-to-eslint/convert-nx-enforce-module-boundaries-rule.d.ts +0 -5
  82. package/src/utils/convert-tslint-to-eslint/convert-nx-enforce-module-boundaries-rule.js +0 -57
  83. package/src/utils/convert-tslint-to-eslint/convert-nx-enforce-module-boundaries-rule.js.map +0 -1
  84. package/src/utils/convert-tslint-to-eslint/convert-to-eslint-config.d.ts +0 -9
  85. package/src/utils/convert-tslint-to-eslint/convert-to-eslint-config.js +0 -152
  86. package/src/utils/convert-tslint-to-eslint/convert-to-eslint-config.js.map +0 -1
  87. package/src/utils/convert-tslint-to-eslint/example-tslint-configs.d.ts +0 -326
  88. package/src/utils/convert-tslint-to-eslint/example-tslint-configs.js +0 -325
  89. package/src/utils/convert-tslint-to-eslint/example-tslint-configs.js.map +0 -1
  90. package/src/utils/convert-tslint-to-eslint/index.d.ts +0 -2
  91. package/src/utils/convert-tslint-to-eslint/index.js +0 -9
  92. package/src/utils/convert-tslint-to-eslint/index.js.map +0 -1
  93. package/src/utils/convert-tslint-to-eslint/project-converter.d.ts +0 -72
  94. package/src/utils/convert-tslint-to-eslint/project-converter.js +0 -396
  95. package/src/utils/convert-tslint-to-eslint/project-converter.js.map +0 -1
  96. package/src/utils/convert-tslint-to-eslint/utils.d.ts +0 -10
  97. package/src/utils/convert-tslint-to-eslint/utils.js +0 -91
  98. package/src/utils/convert-tslint-to-eslint/utils.js.map +0 -1
  99. package/src/utils/rules-requiring-type-checking.d.ts +0 -3
  100. package/src/utils/rules-requiring-type-checking.js +0 -88
  101. package/src/utils/rules-requiring-type-checking.js.map +0 -1
  102. package/src/utils/testing.d.ts +0 -2
  103. package/src/utils/testing.js +0 -13
  104. package/src/utils/testing.js.map +0 -1
  105. package/src/utils/versions.d.ts +0 -5
  106. package/src/utils/versions.js +0 -9
  107. package/src/utils/versions.js.map +0 -1
  108. package/src/utils/workspace-lint-rules.d.ts +0 -1
  109. package/src/utils/workspace-lint-rules.js +0 -6
  110. package/src/utils/workspace-lint-rules.js.map +0 -1
@@ -1,38 +0,0 @@
1
- import type { JsonObject } from '@angular-devkit/core';
2
- import type { Linter } from 'eslint';
3
-
4
- export interface Schema extends JsonObject {
5
- eslintConfig: string | null;
6
- lintFilePatterns: string[];
7
- format: Formatter;
8
- force: boolean;
9
- silent: boolean;
10
- fix: boolean;
11
- cache: boolean;
12
- noEslintrc: boolean;
13
- outputFile: string | null;
14
- cacheLocation: string | null;
15
- maxWarnings: number;
16
- quiet: boolean;
17
- ignorePath: string | null;
18
- hasTypeAwareRules: boolean;
19
- cacheStrategy: 'content' | 'metadata' | null;
20
- rulesdir: string[];
21
- resolvePluginsRelativeTo: string | null;
22
- reportUnusedDisableDirectives: Linter.RuleLevel | null;
23
- }
24
-
25
- type Formatter =
26
- | 'stylish'
27
- | 'compact'
28
- | 'codeframe'
29
- | 'unix'
30
- | 'visualstudio'
31
- | 'table'
32
- | 'checkstyle'
33
- | 'html'
34
- | 'jslint-xml'
35
- | 'json'
36
- | 'json-with-metadata'
37
- | 'junit'
38
- | 'tap';
@@ -1,139 +0,0 @@
1
- {
2
- "version": 2,
3
- "outputCapture": "direct-nodejs",
4
- "$schema": "http://json-schema.org/schema",
5
- "title": "ESLint Lint Target",
6
- "description": "ESLint Lint Target.",
7
- "cli": "nx",
8
- "type": "object",
9
- "properties": {
10
- "eslintConfig": {
11
- "type": "string",
12
- "description": "The name of the ESLint configuration file.",
13
- "x-completion-type": "file",
14
- "x-completion-glob": ".eslintrc?(.json)",
15
- "x-priority": "important"
16
- },
17
- "lintFilePatterns": {
18
- "type": "array",
19
- "description": "One or more files/dirs/globs to pass directly to ESLint's `lintFiles()` method.",
20
- "default": [],
21
- "items": {
22
- "type": "string"
23
- }
24
- },
25
- "format": {
26
- "type": "string",
27
- "description": "ESLint Output formatter (https://eslint.org/docs/user-guide/formatters).",
28
- "default": "stylish",
29
- "anyOf": [
30
- {
31
- "enum": [
32
- "stylish",
33
- "compact",
34
- "codeframe",
35
- "unix",
36
- "visualstudio",
37
- "table",
38
- "checkstyle",
39
- "html",
40
- "jslint-xml",
41
- "json",
42
- "json-with-metadata",
43
- "junit",
44
- "tap"
45
- ]
46
- },
47
- {
48
- "minLength": 1
49
- }
50
- ],
51
- "x-priority": "important"
52
- },
53
- "force": {
54
- "type": "boolean",
55
- "description": "Succeeds even if there was linting errors.",
56
- "default": false
57
- },
58
- "silent": {
59
- "type": "boolean",
60
- "description": "Hide output text.",
61
- "default": false
62
- },
63
- "fix": {
64
- "type": "boolean",
65
- "description": "Fixes linting errors (may overwrite linted files).",
66
- "default": false,
67
- "x-priority": "important"
68
- },
69
- "cache": {
70
- "type": "boolean",
71
- "description": "Only check changed files.",
72
- "default": false
73
- },
74
- "cacheLocation": {
75
- "type": "string",
76
- "description": "Path to the cache file or directory.",
77
- "x-completion-type": "directory",
78
- "x-completion-glob": "tsconfig.*.json"
79
- },
80
- "outputFile": {
81
- "type": "string",
82
- "description": "File to write report to.",
83
- "x-completion-type": "file"
84
- },
85
- "maxWarnings": {
86
- "type": "number",
87
- "description": "Number of warnings to trigger nonzero exit code - default: `-1`.",
88
- "default": -1
89
- },
90
- "quiet": {
91
- "type": "boolean",
92
- "description": "Report errors only - default: `false`.",
93
- "default": false,
94
- "x-priority": "important"
95
- },
96
- "ignorePath": {
97
- "type": "string",
98
- "description": "The path of the `.eslintignore` file.",
99
- "x-completion-type": "file",
100
- "x-completion-glob": ".eslintignore"
101
- },
102
- "noEslintrc": {
103
- "type": "boolean",
104
- "description": "The equivalent of the `--no-eslintrc` flag on the ESLint CLI, it is `false` by default.",
105
- "default": false
106
- },
107
- "hasTypeAwareRules": {
108
- "type": "boolean",
109
- "description": "When set to `true`, the linter will invalidate its cache when any of its dependencies changes."
110
- },
111
- "cacheStrategy": {
112
- "type": "string",
113
- "description": "Strategy to use for detecting changed files in the cache.",
114
- "default": "metadata",
115
- "enum": ["metadata", "content"]
116
- },
117
- "rulesdir": {
118
- "type": "array",
119
- "description": "The equivalent of the `--rulesdir` flag on the ESLint CLI.",
120
- "default": [],
121
- "items": {
122
- "type": "string",
123
- "x-completion-type": "directory"
124
- }
125
- },
126
- "resolvePluginsRelativeTo": {
127
- "type": "string",
128
- "description": "The equivalent of the `--resolve-plugins-relative-to` flag on the ESLint CLI.",
129
- "x-completion-type": "directory"
130
- },
131
- "reportUnusedDisableDirectives": {
132
- "type": "string",
133
- "enum": ["off", "warn", "error"],
134
- "description": "The equivalent of the `--report-unused-disable-directives` flag on the ESLint CLI."
135
- }
136
- },
137
- "required": ["lintFilePatterns"],
138
- "examplesFile": "../../../docs/eslint-examples.md"
139
- }
@@ -1,4 +0,0 @@
1
- import { ESLint } from 'eslint';
2
- import type { Schema } from '../schema';
3
- export declare function loadESLint(): Promise<any>;
4
- export declare function lint(eslintConfigPath: string | undefined, options: Schema): Promise<ESLint.LintResult[]>;
@@ -1,52 +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
- function loadESLint() {
6
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
7
- let eslint;
8
- try {
9
- eslint = yield Promise.resolve().then(() => require('eslint'));
10
- return eslint;
11
- }
12
- catch (_a) {
13
- throw new Error('Unable to find ESLint. Ensure ESLint is installed.');
14
- }
15
- });
16
- }
17
- exports.loadESLint = loadESLint;
18
- function lint(eslintConfigPath, options) {
19
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
20
- const projectESLint = yield loadESLint();
21
- const eslint = new projectESLint.ESLint({
22
- /**
23
- * If "noEslintrc" is set to `true` (and therefore here "useEslintrc" will be `false`), then ESLint will not
24
- * merge the provided config with others it finds automatically.
25
- */
26
- useEslintrc: !options.noEslintrc,
27
- overrideConfigFile: eslintConfigPath,
28
- ignorePath: options.ignorePath || undefined,
29
- fix: !!options.fix,
30
- cache: !!options.cache,
31
- cacheLocation: options.cacheLocation || undefined,
32
- cacheStrategy: options.cacheStrategy || undefined,
33
- resolvePluginsRelativeTo: options.resolvePluginsRelativeTo || undefined,
34
- rulePaths: options.rulesdir || [],
35
- /**
36
- * Default is `true` and if not overridden the eslint.lintFiles() method will throw an error
37
- * when no target files are found.
38
- *
39
- * We don't want ESLint to throw an error if a user has only just created
40
- * a project and therefore doesn't necessarily have matching files, for example.
41
- *
42
- * An angular generator creates lint pattern for `html` files, but there may
43
- * not be any html files in the project, so keeping it true would break linting everytime
44
- */
45
- errorOnUnmatchedPattern: false,
46
- reportUnusedDisableDirectives: options.reportUnusedDisableDirectives || undefined,
47
- });
48
- return yield eslint.lintFiles(options.lintFilePatterns);
49
- });
50
- }
51
- exports.lint = lint;
52
- //# sourceMappingURL=eslint-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eslint-utils.js","sourceRoot":"","sources":["../../../../../../../packages/linter/src/executors/eslint/utility/eslint-utils.ts"],"names":[],"mappings":";;;;AAGA,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,SAAsB,IAAI,CACxB,gBAAoC,EACpC,OAAe;;QAEf,MAAM,aAAa,GAA8B,MAAM,UAAU,EAAE,CAAC;QAEpE,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC;YACtC;;;eAGG;YACH,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU;YAChC,kBAAkB,EAAE,gBAAgB;YACpC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,SAAS;YAC3C,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG;YAClB,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK;YACtB,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,SAAS;YACjD,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,SAAS;YACjD,wBAAwB,EAAE,OAAO,CAAC,wBAAwB,IAAI,SAAS;YACvE,SAAS,EAAE,OAAO,CAAC,QAAQ,IAAI,EAAE;YACjC;;;;;;;;;eASG;YACH,uBAAuB,EAAE,KAAK;YAC9B,6BAA6B,EAC3B,OAAO,CAAC,6BAA6B,IAAI,SAAS;SACrD,CAAC,CAAC;QAEH,OAAO,MAAM,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC1D,CAAC;CAAA;AApCD,oBAoCC"}
@@ -1,36 +0,0 @@
1
- import { ESLint, Linter as LinterType } from 'eslint';
2
- /**
3
- * This configuration is intended to apply to all TypeScript source files.
4
- * See the eslint-plugin-nx package for what is in the referenced shareable config.
5
- */
6
- export declare const globalTypeScriptOverrides: {
7
- files: string[];
8
- extends: string[];
9
- /**
10
- * Having an empty rules object present makes it more obvious to the user where they would
11
- * extend things from if they needed to
12
- */
13
- rules: {};
14
- };
15
- /**
16
- * This configuration is intended to apply to all JavaScript source files.
17
- * See the eslint-plugin-nx package for what is in the referenced shareable config.
18
- */
19
- export declare const globalJavaScriptOverrides: {
20
- files: string[];
21
- extends: string[];
22
- /**
23
- * Having an empty rules object present makes it more obvious to the user where they would
24
- * extend things from if they needed to
25
- */
26
- rules: {};
27
- };
28
- /**
29
- * This configuration is intended to apply to all "source code" (but not
30
- * markup like HTML, or other custom file types like GraphQL)
31
- */
32
- export declare const moduleBoundariesOverride: {
33
- files: string[];
34
- rules: LinterType.RulesRecord;
35
- };
36
- export declare const getGlobalEsLintConfiguration: (unitTestRunner?: string, rootProject?: boolean) => ESLint.ConfigData<LinterType.RulesRecord>;
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGlobalEsLintConfiguration = exports.moduleBoundariesOverride = exports.globalJavaScriptOverrides = exports.globalTypeScriptOverrides = void 0;
4
- /**
5
- * This configuration is intended to apply to all TypeScript source files.
6
- * See the eslint-plugin-nx package for what is in the referenced shareable config.
7
- */
8
- exports.globalTypeScriptOverrides = {
9
- files: ['*.ts', '*.tsx'],
10
- extends: ['plugin:@nrwl/nx/typescript'],
11
- /**
12
- * Having an empty rules object present makes it more obvious to the user where they would
13
- * extend things from if they needed to
14
- */
15
- rules: {},
16
- };
17
- /**
18
- * This configuration is intended to apply to all JavaScript source files.
19
- * See the eslint-plugin-nx package for what is in the referenced shareable config.
20
- */
21
- exports.globalJavaScriptOverrides = {
22
- files: ['*.js', '*.jsx'],
23
- extends: ['plugin:@nrwl/nx/javascript'],
24
- /**
25
- * Having an empty rules object present makes it more obvious to the user where they would
26
- * extend things from if they needed to
27
- */
28
- rules: {},
29
- };
30
- /**
31
- * This configuration is intended to apply to all "source code" (but not
32
- * markup like HTML, or other custom file types like GraphQL)
33
- */
34
- exports.moduleBoundariesOverride = {
35
- files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
36
- rules: {
37
- '@nrwl/nx/enforce-module-boundaries': [
38
- 'error',
39
- {
40
- enforceBuildableLibDependency: true,
41
- allow: [],
42
- depConstraints: [{ sourceTag: '*', onlyDependOnLibsWithTags: ['*'] }],
43
- },
44
- ],
45
- },
46
- };
47
- const getGlobalEsLintConfiguration = (unitTestRunner, rootProject) => {
48
- const config = {
49
- root: true,
50
- ignorePatterns: rootProject ? ['!**/*'] : ['**/*'],
51
- plugins: ['@nrwl/nx'],
52
- /**
53
- * We leverage ESLint's "overrides" capability so that we can set up a root config which will support
54
- * all permutations of Nx workspaces across all frameworks, libraries and tools.
55
- *
56
- * The key point is that we need entirely different ESLint config to apply to different types of files,
57
- * but we still want to share common config where possible.
58
- */
59
- overrides: [
60
- ...(rootProject ? [] : [exports.moduleBoundariesOverride]),
61
- exports.globalTypeScriptOverrides,
62
- exports.globalJavaScriptOverrides,
63
- ],
64
- };
65
- if (unitTestRunner === 'jest') {
66
- config.overrides.push({
67
- files: ['*.spec.ts', '*.spec.tsx', '*.spec.js', '*.spec.jsx'],
68
- env: {
69
- jest: true,
70
- },
71
- rules: {},
72
- });
73
- }
74
- return config;
75
- };
76
- exports.getGlobalEsLintConfiguration = getGlobalEsLintConfiguration;
77
- //# sourceMappingURL=global-eslint-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"global-eslint-config.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/generators/init/global-eslint-config.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACU,QAAA,yBAAyB,GAAG;IACvC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,CAAC,4BAA4B,CAAC;IACvC;;;OAGG;IACH,KAAK,EAAE,EAAE;CACV,CAAC;AAEF;;;GAGG;AACU,QAAA,yBAAyB,GAAG;IACvC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,CAAC,4BAA4B,CAAC;IACvC;;;OAGG;IACH,KAAK,EAAE,EAAE;CACV,CAAC;AAEF;;;GAGG;AACU,QAAA,wBAAwB,GAAG;IACtC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;IACzC,KAAK,EAAE;QACL,oCAAoC,EAAE;YACpC,OAAO;YACP;gBACE,6BAA6B,EAAE,IAAI;gBACnC,KAAK,EAAE,EAAE;gBACT,cAAc,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,wBAAwB,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;aACtE;SACF;KACwB;CAC5B,CAAC;AAEK,MAAM,4BAA4B,GAAG,CAC1C,cAAuB,EACvB,WAAqB,EACrB,EAAE;IACF,MAAM,MAAM,GAAsB;QAChC,IAAI,EAAE,IAAI;QACV,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAClD,OAAO,EAAE,CAAC,UAAU,CAAC;QACrB;;;;;;WAMG;QACH,SAAS,EAAE;YACT,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,gCAAwB,CAAC,CAAC;YAClD,iCAAyB;YACzB,iCAAyB;SAC1B;KACF,CAAC;IACF,IAAI,cAAc,KAAK,MAAM,EAAE;QAC7B,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;YACpB,KAAK,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,CAAC;YAC7D,GAAG,EAAE;gBACH,IAAI,EAAE,IAAI;aACX;YACD,KAAK,EAAE,EAAE;SACV,CAAC,CAAC;KACJ;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA/BW,QAAA,4BAA4B,gCA+BvC"}
@@ -1,3 +0,0 @@
1
- import { ProjectConfiguration, TargetConfiguration, Tree } from '@nrwl/devkit';
2
- export declare function migrateConfigToMonorepoStyle(projects: ProjectConfiguration[], tree: Tree, unitTestRunner: string): void;
3
- export declare function findLintTarget(project: ProjectConfiguration): TargetConfiguration;
@@ -1,68 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findLintTarget = exports.migrateConfigToMonorepoStyle = void 0;
4
- const devkit_1 = require("@nrwl/devkit");
5
- const path_1 = require("path");
6
- const eslint_file_1 = require("../utils/eslint-file");
7
- const global_eslint_config_1 = require("./global-eslint-config");
8
- function migrateConfigToMonorepoStyle(projects, tree, unitTestRunner) {
9
- (0, devkit_1.writeJson)(tree, '.eslintrc.base.json', (0, global_eslint_config_1.getGlobalEsLintConfiguration)(unitTestRunner));
10
- // update extens in all projects' eslint configs
11
- projects.forEach((project) => {
12
- const lintTarget = findLintTarget(project);
13
- if (lintTarget) {
14
- const projectEslintPath = (0, devkit_1.joinPathFragments)(project.root, lintTarget.options.eslintConfig || (0, eslint_file_1.findEslintFile)(tree, project.root));
15
- migrateEslintFile(projectEslintPath, tree);
16
- }
17
- });
18
- }
19
- exports.migrateConfigToMonorepoStyle = migrateConfigToMonorepoStyle;
20
- function findLintTarget(project) {
21
- var _a, _b;
22
- return (_b = Object.entries((_a = project.targets) !== null && _a !== void 0 ? _a : {}).find(([name, target]) => name === 'lint' || target.executor === '@nrwl/linter:eslint')) === null || _b === void 0 ? void 0 : _b[1];
23
- }
24
- exports.findLintTarget = findLintTarget;
25
- function migrateEslintFile(projectEslintPath, tree) {
26
- if (projectEslintPath.endsWith('.json') ||
27
- projectEslintPath.endsWith('.eslintrc')) {
28
- (0, devkit_1.updateJson)(tree, projectEslintPath, (json) => {
29
- // we have a new root now
30
- delete json.root;
31
- // remove nrwl/nx plugins
32
- if (json.plugins) {
33
- json.plugins = json.plugins.filter((p) => p !== '@nrwl/nx');
34
- if (json.plugins.length === 0) {
35
- delete json.plugins;
36
- }
37
- }
38
- // add extends
39
- json.extends = json.extends || [];
40
- const pathToRootConfig = `${(0, devkit_1.offsetFromRoot)((0, path_1.dirname)(projectEslintPath))}.eslintrc.base.json`;
41
- if (json.extends.indexOf(pathToRootConfig) === -1) {
42
- json.extends.push(pathToRootConfig);
43
- }
44
- // cleanup overrides
45
- if (json.overrides) {
46
- json.overrides.forEach((override) => {
47
- if (override.extends) {
48
- override.extends = override.extends.filter((ext) => ext !== 'plugin:@nrwl/nx/typescript' &&
49
- ext !== 'plugin:@nrwl/nx/javascript');
50
- if (override.extends.length === 0) {
51
- delete override.extends;
52
- }
53
- }
54
- });
55
- }
56
- return json;
57
- });
58
- return;
59
- }
60
- if (projectEslintPath.endsWith('.yml') ||
61
- projectEslintPath.endsWith('.yaml')) {
62
- console.warn('YAML eslint config is not supported yet for migration');
63
- }
64
- if (projectEslintPath.endsWith('.js') || projectEslintPath.endsWith('.cjs')) {
65
- console.warn('YAML eslint config is not supported yet for migration');
66
- }
67
- }
68
- //# sourceMappingURL=init-migration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init-migration.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/generators/init/init-migration.ts"],"names":[],"mappings":";;;AAAA,yCAQsB;AACtB,+BAA+B;AAC/B,sDAAsD;AACtD,iEAAsE;AAEtE,SAAgB,4BAA4B,CAC1C,QAAgC,EAChC,IAAU,EACV,cAAsB;IAEtB,IAAA,kBAAS,EACP,IAAI,EACJ,qBAAqB,EACrB,IAAA,mDAA4B,EAAC,cAAc,CAAC,CAC7C,CAAC;IAEF,gDAAgD;IAChD,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3B,MAAM,UAAU,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;QAC3C,IAAI,UAAU,EAAE;YACd,MAAM,iBAAiB,GAAG,IAAA,0BAAiB,EACzC,OAAO,CAAC,IAAI,EACZ,UAAU,CAAC,OAAO,CAAC,YAAY,IAAI,IAAA,4BAAc,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CACtE,CAAC;YACF,iBAAiB,CAAC,iBAAiB,EAAE,IAAI,CAAC,CA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C,IAAI,CAAC,gBAAgB,CAAC,CAAC;aACrC;YACD,oBAAoB;YACpB,IAAI,IAAI,CAAC,SAAS,EAAE;gBAClB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;oBAClC,IAAI,QAAQ,CAAC,OAAO,EAAE;wBACpB,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CACxC,CAAC,GAAG,EAAE,EAAE,CACN,GAAG,KAAK,4BAA4B;4BACpC,GAAG,KAAK,4BAA4B,CACvC,CAAC;wBACF,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;4BACjC,OAAO,QAAQ,CAAC,OAAO,CAAC;yBACzB;qBACF;gBACH,CAAC,CAAC,CAAC;aACJ;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QACH,OAAO;KACR;IACD,IACE,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC;QAClC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,EACnC;QACA,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;KACvE;IACD,IAAI,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAC3E,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;KACvE;AACH,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { GeneratorCallback, Tree } from '@nrwl/devkit';
2
- import { Linter } from '../utils/linter';
3
- export interface LinterInitOptions {
4
- linter?: Linter;
5
- unitTestRunner?: string;
6
- skipPackageJson?: boolean;
7
- rootProject?: boolean;
8
- }
9
- export declare function lintInitGenerator(tree: Tree, options: LinterInitOptions): GeneratorCallback;
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lintInitGenerator = void 0;
4
- const devkit_1 = require("@nrwl/devkit");
5
- const versions_1 = require("../../utils/versions");
6
- const eslint_file_1 = require("../utils/eslint-file");
7
- const global_eslint_config_1 = require("./global-eslint-config");
8
- function addTargetDefaults(tree) {
9
- var _a, _b, _c, _d;
10
- var _e, _f;
11
- const nxJson = (0, devkit_1.readNxJson)(tree);
12
- const productionFileSet = (_a = nxJson.namedInputs) === null || _a === void 0 ? void 0 : _a.production;
13
- if (productionFileSet) {
14
- // Remove .eslintrc.json
15
- productionFileSet.push('!{projectRoot}/.eslintrc.json');
16
- // Dedupe and set
17
- nxJson.namedInputs.production = Array.from(new Set(productionFileSet));
18
- }
19
- (_b = nxJson.targetDefaults) !== null && _b !== void 0 ? _b : (nxJson.targetDefaults = {});
20
- (_c = (_e = nxJson.targetDefaults).lint) !== null && _c !== void 0 ? _c : (_e.lint = {});
21
- (_d = (_f = nxJson.targetDefaults.lint).inputs) !== null && _d !== void 0 ? _d : (_f.inputs = [
22
- 'default',
23
- `{workspaceRoot}/.eslintrc.json`,
24
- `{workspaceRoot}/.eslintignore`,
25
- ]);
26
- (0, devkit_1.updateNxJson)(tree, nxJson);
27
- }
28
- function initEsLint(tree, options) {
29
- if ((0, eslint_file_1.findEslintFile)(tree)) {
30
- return () => { };
31
- }
32
- if (!options.skipPackageJson) {
33
- (0, devkit_1.removeDependenciesFromPackageJson)(tree, ['@nrwl/linter'], []);
34
- }
35
- (0, devkit_1.writeJson)(tree, '.eslintrc.json', (0, global_eslint_config_1.getGlobalEsLintConfiguration)(options.unitTestRunner, options.rootProject));
36
- tree.write('.eslintignore', 'node_modules\n');
37
- addTargetDefaults(tree);
38
- if (tree.exists('.vscode/extensions.json')) {
39
- (0, devkit_1.updateJson)(tree, '.vscode/extensions.json', (json) => {
40
- json.recommendations || (json.recommendations = []);
41
- const extension = 'dbaeumer.vscode-eslint';
42
- if (!json.recommendations.includes(extension)) {
43
- json.recommendations.push(extension);
44
- }
45
- return json;
46
- });
47
- }
48
- return !options.skipPackageJson
49
- ? (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
50
- '@nrwl/linter': versions_1.nxVersion,
51
- '@nrwl/eslint-plugin-nx': versions_1.nxVersion,
52
- '@typescript-eslint/parser': versions_1.typescriptESLintVersion,
53
- '@typescript-eslint/eslint-plugin': versions_1.typescriptESLintVersion,
54
- eslint: versions_1.eslintVersion,
55
- 'eslint-config-prettier': versions_1.eslintConfigPrettierVersion,
56
- })
57
- : () => { };
58
- }
59
- function lintInitGenerator(tree, options) {
60
- return initEsLint(tree, options);
61
- }
62
- exports.lintInitGenerator = lintInitGenerator;
63
- //# sourceMappingURL=init.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/generators/init/init.ts"],"names":[],"mappings":";;;AACA,yCAOsB;AACtB,mDAK8B;AAG9B,sDAAsD;AACtD,iEAAsE;AAStE,SAAS,iBAAiB,CAAC,IAAU;;;IACnC,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC;IAEhC,MAAM,iBAAiB,GAAG,MAAA,MAAM,CAAC,WAAW,0CAAE,UAAU,CAAC;IACzD,IAAI,iBAAiB,EAAE;QACrB,wBAAwB;QACxB,iBAAiB,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QACxD,iBAAiB;QACjB,MAAM,CAAC,WAAW,CAAC,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;KACxE;IAED,MAAA,MAAM,CAAC,cAAc,oCAArB,MAAM,CAAC,cAAc,GAAK,EAAE,EAAC;IAE7B,YAAA,MAAM,CAAC,cAAc,EAAC,IAAI,uCAAJ,IAAI,GAAK,EAAE,EAAC;IAClC,YAAA,MAAM,CAAC,cAAc,CAAC,IAAI,EAAC,MAAM,uCAAN,MAAM,GAAK;QACpC,SAAS;QACT,gCAAgC;QAChC,+BAA+B;KAChC,EAAC;IACF,IAAA,qBAAY,EAAC,IAAI,EAAE,MAAM,C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F;QACH,CAAC,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;AACf,CAAC;AAED,SAAgB,iBAAiB,CAAC,IAAU,EAAE,OAA0B;IACtE,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnC,CAAC;AAFD,8CAEC"}
@@ -1,16 +0,0 @@
1
- import type { Tree } from '@nrwl/devkit';
2
- import { Linter } from '../utils/linter';
3
- interface LintProjectOptions {
4
- project: string;
5
- linter?: Linter;
6
- eslintFilePatterns?: string[];
7
- tsConfigPaths?: string[];
8
- skipFormat: boolean;
9
- setParserOptionsProject?: boolean;
10
- skipPackageJson?: boolean;
11
- unitTestRunner?: string;
12
- rootProject?: boolean;
13
- }
14
- export declare function mapLintPattern(projectRoot: string, extension: string, rootProject?: boolean): string;
15
- export declare function lintProjectGenerator(tree: Tree, options: LintProjectOptions): Promise<import("@nrwl/devkit").GeneratorCallback>;
16
- export {};