@nrwl/linter 15.3.0-beta.2 → 15.3.0-beta.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/CHANGELOG.md CHANGED
@@ -3,6 +3,6 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # [15.3.0-beta.2](https://github.com/nrwl/nx/compare/15.2.0...15.3.0-beta.2) (2022-11-25)
6
+ # [15.3.0-beta.3](https://github.com/nrwl/nx/compare/15.2.0...15.3.0-beta.3) (2022-11-28)
7
7
 
8
8
  **Note:** Version bump only for package @nrwl/linter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/linter",
3
- "version": "15.3.0-beta.2",
3
+ "version": "15.3.0-beta.3",
4
4
  "private": false,
5
5
  "description": "The Linter plugin for Nx contains executors, generators and utilities used for linting JavaScript/TypeScript projects within an Nx workspace.",
6
6
  "repository": {
@@ -30,14 +30,13 @@
30
30
  "builders": "./executors.json",
31
31
  "schematics": "./generators.json",
32
32
  "peerDependencies": {
33
- "eslint": "^8.0.0",
34
- "js-yaml": "4.1.0"
33
+ "eslint": "^8.0.0"
35
34
  },
36
35
  "dependencies": {
37
- "@nrwl/devkit": "15.3.0-beta.2",
38
- "@nrwl/jest": "15.3.0-beta.2",
36
+ "@nrwl/devkit": "15.3.0-beta.3",
37
+ "@nrwl/jest": "15.3.0-beta.3",
39
38
  "@phenomnomnominal/tsquery": "4.1.1",
40
- "nx": "15.3.0-beta.2",
39
+ "nx": "15.3.0-beta.3",
41
40
  "tmp": "~0.2.1",
42
41
  "tslib": "^2.3.0"
43
42
  },
@@ -50,5 +49,5 @@
50
49
  "access": "public"
51
50
  },
52
51
  "types": "./index.d.ts",
53
- "gitHead": "70fa4b9e4127a5f17c084b7f0620dbf65ffd0499"
52
+ "gitHead": "61f6e2d7287beaac1993e32f3fe18703d2c63e41"
54
53
  }
@@ -4,6 +4,5 @@ export interface LinterInitOptions {
4
4
  linter?: Linter;
5
5
  unitTestRunner?: string;
6
6
  skipPackageJson?: boolean;
7
- rootProject?: boolean;
8
7
  }
9
8
  export declare function lintInitGenerator(tree: Tree, options: LinterInitOptions): GeneratorCallback;
@@ -4,7 +4,77 @@ exports.lintInitGenerator = void 0;
4
4
  const devkit_1 = require("@nrwl/devkit");
5
5
  const versions_1 = require("../../utils/versions");
6
6
  const eslint_file_1 = require("../utils/eslint-file");
7
- const global_eslint_config_1 = require("./global-eslint-config");
7
+ const getGlobalEsLintConfiguration = (unitTestRunner) => {
8
+ const config = {
9
+ root: true,
10
+ ignorePatterns: ['**/*'],
11
+ plugins: ['@nrwl/nx'],
12
+ /**
13
+ * We leverage ESLint's "overrides" capability so that we can set up a root config which will support
14
+ * all permutations of Nx workspaces across all frameworks, libraries and tools.
15
+ *
16
+ * The key point is that we need entirely different ESLint config to apply to different types of files,
17
+ * but we still want to share common config where possible.
18
+ */
19
+ overrides: [
20
+ /**
21
+ * This configuration is intended to apply to all "source code" (but not
22
+ * markup like HTML, or other custom file types like GraphQL)
23
+ */
24
+ {
25
+ files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
26
+ rules: {
27
+ '@nrwl/nx/enforce-module-boundaries': [
28
+ 'error',
29
+ {
30
+ enforceBuildableLibDependency: true,
31
+ allow: [],
32
+ depConstraints: [
33
+ { sourceTag: '*', onlyDependOnLibsWithTags: ['*'] },
34
+ ],
35
+ },
36
+ ],
37
+ },
38
+ },
39
+ /**
40
+ * This configuration is intended to apply to all TypeScript source files.
41
+ * See the eslint-plugin-nx package for what is in the referenced shareable config.
42
+ */
43
+ {
44
+ files: ['*.ts', '*.tsx'],
45
+ extends: ['plugin:@nrwl/nx/typescript'],
46
+ /**
47
+ * Having an empty rules object present makes it more obvious to the user where they would
48
+ * extend things from if they needed to
49
+ */
50
+ rules: {},
51
+ },
52
+ /**
53
+ * This configuration is intended to apply to all JavaScript source files.
54
+ * See the eslint-plugin-nx package for what is in the referenced shareable config.
55
+ */
56
+ {
57
+ files: ['*.js', '*.jsx'],
58
+ extends: ['plugin:@nrwl/nx/javascript'],
59
+ /**
60
+ * Having an empty rules object present makes it more obvious to the user where they would
61
+ * extend things from if they needed to
62
+ */
63
+ rules: {},
64
+ },
65
+ ],
66
+ };
67
+ if (unitTestRunner === 'jest') {
68
+ config.overrides.push({
69
+ files: ['*.spec.ts', '*.spec.tsx', '*.spec.js', '*.spec.jsx'],
70
+ env: {
71
+ jest: true,
72
+ },
73
+ rules: {},
74
+ });
75
+ }
76
+ return config;
77
+ };
8
78
  function addTargetDefaults(tree) {
9
79
  var _a, _b, _c, _d;
10
80
  var _e, _f;
@@ -31,7 +101,7 @@ function initEsLint(tree, options) {
31
101
  if (!options.skipPackageJson) {
32
102
  (0, devkit_1.removeDependenciesFromPackageJson)(tree, ['@nrwl/linter'], []);
33
103
  }
34
- (0, devkit_1.writeJson)(tree, '.eslintrc.json', (0, global_eslint_config_1.getGlobalEsLintConfiguration)(options.unitTestRunner, options.rootProject));
104
+ (0, devkit_1.writeJson)(tree, '.eslintrc.json', getGlobalEsLintConfiguration(options.unitTestRunner));
35
105
  addTargetDefaults(tree);
36
106
  if (tree.exists('.vscode/extensions.json')) {
37
107
  (0, devkit_1.updateJson)(tree, '.vscode/extensions.json', (json) => {
@@ -1 +1 @@
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,sBAAsB,GAAG,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC;IAEhE,MAAM,iBAAiB,GAAG,MAAA,sBAAsB,CAAC,WAAW,0CAAE,UAAU,CAAC;IACzE,IAAI,iBAAiB,EAAE;QACrB,wBAAwB;QACxB,iBAAiB,CAAC,IAAI,CAAC,+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CAAC,EAAE;gBAC7C,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aACtC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,CAAC,OAAO,CAAC,eAAe;QAC7B,CAAC,CAAC,IAAA,qCAA4B,EAC1B,IAAI,EACJ,EAAE,EACF;YACE,cAAc,EAAE,oBAAS;YACzB,wBAAwB,EAAE,oBAAS;YACnC,2BAA2B,EAAE,kCAAuB;YACpD,kCAAkC,EAAE,kCAAuB;YAC3D,MAAM,EAAE,wBAAa;YACrB,wBAAwB,EAAE,sCAA2B;SACtD,CACF;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
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/generators/init/init.ts"],"names":[],"mappings":";;;AACA,yCAOsB;AACtB,mDAK8B;AAG9B,sDAAsD;AAStD,MAAM,4BAA4B,GAAG,CAAC,cAAuB,EAAE,EAAE;IAC/D,MAAM,MAAM,GAAsB;QAChC,IAAI,EAAE,IAAI;QACV,cAAc,EAAE,CAAC,MAAM,CAAC;QACxB,OAAO,EAAE,CAAC,UAAU,CAAC;QACrB;;;;;;WAMG;QACH,SAAS,EAAE;YACT;;;eAGG;YACH;gBACE,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;gBACzC,KAAK,EAAE;oBACL,oCAAoC,EAAE;wBACpC,OAAO;wBACP;4BACE,6BAA6B,EAAE,IAAI;4BACnC,KAAK,EAAE,EAAE;4BACT,cAAc,EAAE;gCACd,EAAE,SAAS,EAAE,GAAG,EAAE,wBAAwB,EAAE,CAAC,GAAG,CAAC,EAAE;6BACpD;yBACF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B;SACtD,CACF;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"}
@@ -9,8 +9,6 @@ interface LintProjectOptions {
9
9
  setParserOptionsProject?: boolean;
10
10
  skipPackageJson?: boolean;
11
11
  unitTestRunner?: string;
12
- rootProject?: boolean;
13
12
  }
14
- export declare function mapLintPattern(projectRoot: string, extension: string, rootProject?: boolean): string;
15
13
  export declare function lintProjectGenerator(tree: Tree, options: LintProjectOptions): Promise<import("@nrwl/devkit").GeneratorCallback>;
16
14
  export {};
@@ -1,13 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lintProjectGenerator = exports.mapLintPattern = void 0;
3
+ exports.lintProjectGenerator = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nrwl/devkit");
6
6
  const eslint_file_1 = require("../utils/eslint-file");
7
7
  const path_1 = require("path");
8
8
  const init_1 = require("../init/init");
9
- const init_migration_1 = require("../init/init-migration");
10
- const project_configuration_1 = require("nx/src/generators/utils/project-configuration");
11
9
  function createEsLintConfiguration(tree, projectConfig, setParserOptionsProject) {
12
10
  const eslintConfig = (0, eslint_file_1.findEslintFile)(tree);
13
11
  (0, devkit_1.writeJson)(tree, (0, path_1.join)(projectConfig.root, `.eslintrc.json`), {
@@ -54,18 +52,12 @@ function createEsLintConfiguration(tree, projectConfig, setParserOptionsProject)
54
52
  ],
55
53
  });
56
54
  }
57
- function mapLintPattern(projectRoot, extension, rootProject) {
58
- const infix = rootProject ? 'src/' : '';
59
- return `${projectRoot}/${infix}**/*.${extension}`;
60
- }
61
- exports.mapLintPattern = mapLintPattern;
62
55
  function lintProjectGenerator(tree, options) {
63
56
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
64
57
  const installTask = (0, init_1.lintInitGenerator)(tree, {
65
58
  linter: options.linter,
66
59
  unitTestRunner: options.unitTestRunner,
67
60
  skipPackageJson: options.skipPackageJson,
68
- rootProject: options.rootProject,
69
61
  });
70
62
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
71
63
  projectConfig.targets['lint'] = {
@@ -75,28 +67,7 @@ function lintProjectGenerator(tree, options) {
75
67
  lintFilePatterns: options.eslintFilePatterns,
76
68
  },
77
69
  };
78
- // we are adding new project which is not the root project or
79
- // companion e2e app so we should check if migration to
80
- // monorepo style is needed
81
- if (!options.rootProject) {
82
- const projects = (0, project_configuration_1.readWorkspace)(tree).projects;
83
- if (isMigrationToMonorepoNeeded(projects, tree)) {
84
- // we only migrate project configurations that have been created
85
- const filteredProjects = [];
86
- Object.entries(projects).forEach(([name, project]) => {
87
- if (name !== options.project) {
88
- filteredProjects.push(project);
89
- }
90
- });
91
- (0, init_migration_1.migrateConfigToMonorepoStyle)(filteredProjects, tree, options.unitTestRunner);
92
- }
93
- }
94
- // our root `.eslintrc` is already the project config, so we should not override it
95
- // additionally, the companion e2e app would have `rootProject: true`
96
- // so we need to check for the root path as well
97
- if (!options.rootProject || projectConfig.root !== '.') {
98
- createEsLintConfiguration(tree, projectConfig, options.setParserOptionsProject);
99
- }
70
+ createEsLintConfiguration(tree, projectConfig, options.setParserOptionsProject);
100
71
  (0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
101
72
  if (!options.skipFormat) {
102
73
  yield (0, devkit_1.formatFiles)(tree);
@@ -105,35 +76,4 @@ function lintProjectGenerator(tree, options) {
105
76
  });
106
77
  }
107
78
  exports.lintProjectGenerator = lintProjectGenerator;
108
- /**
109
- * Detect based on the state of lint target configuration of the root project
110
- * if we should migrate eslint configs to monorepo style
111
- *
112
- * @param tree
113
- * @returns
114
- */
115
- function isMigrationToMonorepoNeeded(projects, tree) {
116
- const configs = Object.values(projects);
117
- if (configs.length === 1) {
118
- return false;
119
- }
120
- // get root project
121
- const rootProject = configs.find((p) => p.root === '.');
122
- if (!rootProject || !rootProject.targets) {
123
- return false;
124
- }
125
- // find if root project has lint target
126
- const lintTarget = (0, init_migration_1.findLintTarget)(rootProject);
127
- if (!lintTarget) {
128
- return false;
129
- }
130
- // if there is no override for `eslintConfig` we should migrate
131
- if (!lintTarget.options.eslintConfig) {
132
- return true;
133
- }
134
- // check if target has `eslintConfig` override and if it's not pointing to the source .eslintrc
135
- const rootEslintrc = (0, eslint_file_1.findEslintFile)(tree);
136
- return (lintTarget.options.eslintConfig === rootEslintrc ||
137
- lintTarget.options.eslintConfig === `./${rootEslintrc}`);
138
- }
139
79
  //# sourceMappingURL=lint-project.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lint-project.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/generators/lint-project/lint-project.ts"],"names":[],"mappings":";;;;AACA,yCAMsB;AAGtB,sDAAsD;AACtD,+BAA4B;AAC5B,uCAAiD;AACjD,2DAGgC;AAChC,yFAA8E;AAc9E,SAAS,yBAAyB,CAChC,IAAU,EACV,aAAmC,EACnC,uBAAgC;IAEhC,MAAM,YAAY,GAAG,IAAA,4BAAc,EAAC,IAAI,CAAC,CAAC;IAC1C,IAAA,kBAAS,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,aAAa,CAAC,IAAI,EAAE,gBAAgB,CAAC,EAAE;QAC1D,OAAO,EAAE,YAAY;YACnB,CAAC,CAAC,CAAC,GAAG,IAAA,uBAAc,EAAC,aAAa,CAAC,IAAI,CAAC,GAAG,YAAY,EAAE,CAAC;YAC1D,CAAC,CAAC,SAAS;QACb,8EAA8E;QAC9E,cAAc,EAAE,CAAC,OAAO,CAAC;QACzB,SAAS,EAAE;YACT;gBACE,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;gBACzC;;;;;;;;;;;;mBAYG;gBACH,aAAa,EAAE,CAAC,uBAAuB;oBACrC,CAAC,CAAC,SAAS;oBACX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AC,IAAI,KAAK,GAAG,CAAC,CAAC;IACxD,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;QACxC,OAAO,KAAK,CAAC;KACd;IACD,uCAAuC;IACvC,MAAM,UAAU,GAAG,IAAA,+BAAc,EAAC,WAAW,CAAC,CAAC;IAC/C,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,KAAK,CAAC;KACd;IACD,+DAA+D;IAC/D,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,YAAY,EAAE;QACpC,OAAO,IAAI,CAAC;KACb;IACD,+FAA+F;IAC/F,MAAM,YAAY,GAAG,IAAA,4BAAc,EAAC,IAAI,CAAC,CAAC;IAC1C,OAAO,CACL,UAAU,CAAC,OAAO,CAAC,YAAY,KAAK,YAAY;QAChD,UAAU,CAAC,OAAO,CAAC,YAAY,KAAK,KAAK,YAAY,EAAE,CACxD,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"lint-project.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/generators/lint-project/lint-project.ts"],"names":[],"mappings":";;;;AACA,yCAMsB;AAGtB,sDAAsD;AACtD,+BAA4B;AAC5B,uCAAiD;AAajD,SAAS,yBAAyB,CAChC,IAAU,EACV,aAAmC,EACnC,uBAAgC;IAEhC,MAAM,YAAY,GAAG,IAAA,4BAAc,EAAC,IAAI,CAAC,CAAC;IAC1C,IAAA,kBAAS,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,aAAa,CAAC,IAAI,EAAE,gBAAgB,CAAC,EAAE;QAC1D,OAAO,EAAE,YAAY;YACnB,CAAC,CAAC,CAAC,GAAG,IAAA,uBAAc,EAAC,aAAa,CAAC,IAAI,CAAC,GAAG,YAAY,EAAE,CAAC;YAC1D,CAAC,CAAC,SAAS;QACb,8EAA8E;QAC9E,cAAc,EAAE,CAAC,OAAO,CAAC;QACzB,SAAS,EAAE;YACT;gBACE,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAA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AAA;AA/BD,oDA+BC"}
@@ -1,3 +1,3 @@
1
- import { Tree } from '@nrwl/devkit';
1
+ import type { Tree } from '@nrwl/devkit';
2
2
  export declare const eslintConfigFileWhitelist: string[];
3
- export declare function findEslintFile(tree: Tree, projectRoot?: string): string | null;
3
+ export declare function findEslintFile(tree: Tree): string | null;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findEslintFile = exports.eslintConfigFileWhitelist = void 0;
4
- const devkit_1 = require("@nrwl/devkit");
5
4
  exports.eslintConfigFileWhitelist = [
6
5
  '.eslintrc',
7
6
  '.eslintrc.js',
@@ -9,11 +8,10 @@ exports.eslintConfigFileWhitelist = [
9
8
  '.eslintrc.yaml',
10
9
  '.eslintrc.yml',
11
10
  '.eslintrc.json',
12
- 'eslint.config.js', // new format that requires `ESLINT_USE_FLAT_CONFIG=true`
13
11
  ];
14
- function findEslintFile(tree, projectRoot = '') {
12
+ function findEslintFile(tree) {
15
13
  for (const file of exports.eslintConfigFileWhitelist) {
16
- if (tree.exists((0, devkit_1.joinPathFragments)(projectRoot, file))) {
14
+ if (tree.exists(file)) {
17
15
  return file;
18
16
  }
19
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"eslint-file.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/generators/utils/eslint-file.ts"],"names":[],"mappings":";;;AAAA,yCAAuD;AAE1C,QAAA,yBAAyB,GAAG;IACvC,WAAW;IACX,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,kBAAkB,EAAE,yDAAyD;CAC9E,CAAC;AAEF,SAAgB,cAAc,CAAC,IAAU,EAAE,WAAW,GAAG,EAAE;IACzD,KAAK,MAAM,IAAI,IAAI,iCAAyB,EAAE;QAC5C,IAAI,IAAI,CAAC,MAAM,CAAC,IAAA,0BAAiB,EAAC,WAAW,EAAE,IAAI,CAAC,CAAC,EAAE;YACrD,OAAO,IAAI,CAAC;SACb;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AARD,wCAQC"}
1
+ {"version":3,"file":"eslint-file.js","sourceRoot":"","sources":["../../../../../../packages/linter/src/generators/utils/eslint-file.ts"],"names":[],"mappings":";;;AAEa,QAAA,yBAAyB,GAAG;IACvC,WAAW;IACX,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,gBAAgB;CACjB,CAAC;AAEF,SAAgB,cAAc,CAAC,IAAU;IACvC,KAAK,MAAM,IAAI,IAAI,iCAAyB,EAAE;QAC5C,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YACrB,OAAO,IAAI,CAAC;SACb;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AARD,wCAQC"}
@@ -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,84 +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
- const FILE_EXTENSION_REGEX = /(?<!(^|\/))(\.[^/.]+)$/;
9
- function migrateConfigToMonorepoStyle(projects, tree, unitTestRunner) {
10
- var _a, _b, _c;
11
- // copy the root's .eslintrc.json to new name
12
- const rootProject = projects.find((p) => p.root === '.');
13
- const eslintPath = ((_c = (_b = (_a = rootProject.targets) === null || _a === void 0 ? void 0 : _a.lint) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.eslintConfig) || (0, eslint_file_1.findEslintFile)(tree);
14
- const pathSegments = eslintPath.split(FILE_EXTENSION_REGEX).filter(Boolean);
15
- const rootProjEslintPath = pathSegments.length > 1
16
- ? pathSegments.join(`.${rootProject.name}`)
17
- : `.${rootProject.name}.${rootProject.name}`;
18
- tree.write(rootProjEslintPath, tree.read(eslintPath));
19
- // update root project's configuration
20
- const lintTarget = findLintTarget(rootProject);
21
- lintTarget.options.eslintConfig = rootProjEslintPath;
22
- (0, devkit_1.updateProjectConfiguration)(tree, rootProject.name, rootProject);
23
- // replace root eslint with default global
24
- tree.delete(eslintPath);
25
- (0, devkit_1.writeJson)(tree, '.eslintrc.json', (0, global_eslint_config_1.getGlobalEsLintConfiguration)(unitTestRunner));
26
- // update extens in all projects' eslint configs
27
- projects.forEach((project) => {
28
- const lintTarget = findLintTarget(project);
29
- if (lintTarget) {
30
- const projectEslintPath = (0, devkit_1.joinPathFragments)(project.root, lintTarget.options.eslintConfig || (0, eslint_file_1.findEslintFile)(tree, project.root));
31
- migrateEslintFile(projectEslintPath, tree);
32
- }
33
- });
34
- }
35
- exports.migrateConfigToMonorepoStyle = migrateConfigToMonorepoStyle;
36
- function findLintTarget(project) {
37
- var _a;
38
- return (_a = Object.entries(project.targets).find(([name, target]) => name === 'lint' || target.executor === '@nrwl/linter:eslint')) === null || _a === void 0 ? void 0 : _a[1];
39
- }
40
- exports.findLintTarget = findLintTarget;
41
- function migrateEslintFile(projectEslintPath, tree) {
42
- if (projectEslintPath.endsWith('.json') ||
43
- projectEslintPath.endsWith('.eslintrc')) {
44
- (0, devkit_1.updateJson)(tree, projectEslintPath, (json) => {
45
- // we have a new root now
46
- delete json.root;
47
- // remove nrwl/nx plugins
48
- if (json.plugins) {
49
- json.plugins = json.plugins.filter((p) => p !== '@nrwl/nx');
50
- if (json.plugins.length === 0) {
51
- delete json.plugins;
52
- }
53
- }
54
- // add extends
55
- json.extends = json.extends || [];
56
- const pathToRootConfig = `${(0, devkit_1.offsetFromRoot)((0, path_1.dirname)(projectEslintPath))}.eslintrc.json`;
57
- if (json.extends.indexOf(pathToRootConfig) === -1) {
58
- json.extends.push(pathToRootConfig);
59
- }
60
- // cleanup overrides
61
- if (json.overrides) {
62
- json.overrides.forEach((override) => {
63
- if (override.extends) {
64
- override.extends = override.extends.filter((ext) => ext !== 'plugin:@nrwl/nx/typescript' &&
65
- ext !== 'plugin:@nrwl/nx/javascript');
66
- if (override.extends.length === 0) {
67
- delete override.extends;
68
- }
69
- }
70
- });
71
- }
72
- return json;
73
- });
74
- return;
75
- }
76
- if (projectEslintPath.endsWith('.yml') ||
77
- projectEslintPath.endsWith('.yaml')) {
78
- console.warn('YAML eslint config is not supported yet for migration');
79
- }
80
- if (projectEslintPath.endsWith('.js') || projectEslintPath.endsWith('.cjs')) {
81
- console.warn('YAML eslint config is not supported yet for migration');
82
- }
83
- }
84
- //# 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,yCASsB;AACtB,+BAAyC;AACzC,sDAAsD;AACtD,iEAAsE;AAEtE,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAEtD,SAAgB,4BAA4B,CAC1C,QAAgC,EAChC,IAAU,EACV,cAAsB;;IAEtB,6CAA6C;IAC7C,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;IACzD,MAAM,UAAU,GACd,CAAA,MAAA,MAAA,MAAA,WAAW,CAAC,OAAO,0CAAE,IAAI,0CAAE,OAAO,0CAAE,YAAY,KAAI,IAAA,4BAAc,EAAC,IAAI,CAAC,CAAC;IAC3E,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAA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