@nx/eslint-plugin 17.2.5 → 17.2.6

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/README.md CHANGED
@@ -1,9 +1,4 @@
1
- <p style="text-align: center;">
2
- <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
4
- <img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
5
- </picture>
6
- </p>
1
+ <p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
7
2
 
8
3
  <div style="text-align: center;">
9
4
 
@@ -20,9 +15,9 @@
20
15
 
21
16
  <hr>
22
17
 
23
- # Nx: Smart Monorepos · Fast CI
18
+ # Nx: Smart, Fast and Extensible Build System
24
19
 
25
- Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
20
+ Nx is a next generation build system with first class monorepo support and powerful integrations.
26
21
 
27
22
  This package is an ESLint plugin for Nx.
28
23
 
@@ -64,5 +59,5 @@ npx nx@latest init
64
59
  - [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
65
60
 
66
61
  <p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
67
- width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
62
+ width="100%" alt="Nx - Smart, Fast and Extensible Build System"></a></p>
68
63
 
package/migrations.json CHANGED
@@ -5,6 +5,12 @@
5
5
  "version": "16.0.0-beta.1",
6
6
  "description": "Replace @nrwl/eslint-plugin-nx with @nx/eslint-plugin",
7
7
  "implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
8
+ },
9
+ "update-17-2-6-rename-workspace-rules": {
10
+ "cli": "nx",
11
+ "version": "17-2-6-beta.1",
12
+ "description": "Rename workspace rules from @nx/workspace/name to @nx/workspace-name",
13
+ "implementation": "./src/migrations/update-17-2-6-rename-workspace-rules/rename-workspace-rules"
8
14
  }
9
15
  },
10
16
  "packageJsonUpdates": {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/eslint-plugin",
3
- "version": "v17.2.5",
3
+ "version": "17.2.6",
4
4
  "private": false,
5
5
  "description": "The eslint-plugin package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
6
6
  "repository": {
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "homepage": "https://nx.dev",
26
26
  "peerDependencies": {
27
- "@typescript-eslint/parser": "^6.13.2",
27
+ "@typescript-eslint/parser": "^6.9.1",
28
28
  "eslint-config-prettier": "^9.0.0"
29
29
  },
30
30
  "peerDependenciesMeta": {
@@ -33,16 +33,16 @@
33
33
  }
34
34
  },
35
35
  "dependencies": {
36
- "@nx/devkit": "v17.2.5",
37
- "@nx/js": "v17.2.5",
38
- "@typescript-eslint/type-utils": "^6.13.2",
39
- "@typescript-eslint/utils": "^6.13.2",
36
+ "@nx/devkit": "17.2.6",
37
+ "@nx/js": "17.2.6",
38
+ "@typescript-eslint/type-utils": "^6.9.1",
39
+ "@typescript-eslint/utils": "^6.9.1",
40
40
  "chalk": "^4.1.0",
41
41
  "confusing-browser-globals": "^1.0.9",
42
42
  "jsonc-eslint-parser": "^2.1.0",
43
43
  "semver": "7.5.3",
44
44
  "tslib": "^2.3.0",
45
- "@nrwl/eslint-plugin-nx": "v17.2.5"
45
+ "@nrwl/eslint-plugin-nx": "17.2.6"
46
46
  },
47
47
  "publishConfig": {
48
48
  "access": "public"
@@ -1,3 +1,4 @@
1
+ export declare const WORKSPACE_RULES_PATH = "tools/eslint-rules";
1
2
  export declare const WORKSPACE_PLUGIN_DIR: string;
2
3
  /**
3
4
  * We add a namespace so that we mitigate the risk of rule name collisions as much as
@@ -7,6 +8,6 @@ export declare const WORKSPACE_PLUGIN_DIR: string;
7
8
  * E.g. if a user writes a rule called "foo", then they will include it in their ESLint
8
9
  * config files as:
9
10
  *
10
- * "@nx/workspace/foo": "error"
11
+ * "@nx/workspace-foo": "error"
11
12
  */
12
- export declare const WORKSPACE_RULE_NAMESPACE = "workspace";
13
+ export declare const WORKSPACE_RULE_PREFIX = "workspace";
package/src/constants.js CHANGED
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WORKSPACE_RULE_NAMESPACE = exports.WORKSPACE_PLUGIN_DIR = void 0;
3
+ exports.WORKSPACE_RULE_PREFIX = exports.WORKSPACE_PLUGIN_DIR = exports.WORKSPACE_RULES_PATH = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const path_1 = require("path");
6
- exports.WORKSPACE_PLUGIN_DIR = (0, path_1.join)(devkit_1.workspaceRoot, 'tools/eslint-rules');
6
+ exports.WORKSPACE_RULES_PATH = 'tools/eslint-rules';
7
+ exports.WORKSPACE_PLUGIN_DIR = (0, path_1.join)(devkit_1.workspaceRoot, exports.WORKSPACE_RULES_PATH);
7
8
  /**
8
9
  * We add a namespace so that we mitigate the risk of rule name collisions as much as
9
10
  * possible between what users might create in their workspaces and what we might want
@@ -12,6 +13,6 @@ exports.WORKSPACE_PLUGIN_DIR = (0, path_1.join)(devkit_1.workspaceRoot, 'tools/e
12
13
  * E.g. if a user writes a rule called "foo", then they will include it in their ESLint
13
14
  * config files as:
14
15
  *
15
- * "@nx/workspace/foo": "error"
16
+ * "@nx/workspace-foo": "error"
16
17
  */
17
- exports.WORKSPACE_RULE_NAMESPACE = 'workspace';
18
+ exports.WORKSPACE_RULE_PREFIX = 'workspace';
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function renameWorkspaceRule(tree: Tree): Promise<void>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const binary_extensions_1 = require("@nx/devkit/src/utils/binary-extensions");
5
+ const constants_1 = require("../../constants");
6
+ async function renameWorkspaceRule(tree) {
7
+ if (!tree.exists(constants_1.WORKSPACE_RULES_PATH)) {
8
+ return;
9
+ }
10
+ let ruleNames = [];
11
+ try {
12
+ ruleNames = Object.keys(require(constants_1.WORKSPACE_PLUGIN_DIR).rules);
13
+ }
14
+ catch (e) {
15
+ return;
16
+ }
17
+ (0, devkit_1.visitNotIgnoredFiles)(tree, '.', (path) => {
18
+ if ((0, binary_extensions_1.isBinaryPath)(path)) {
19
+ return;
20
+ }
21
+ let contents = tree.read(path, 'utf-8');
22
+ ruleNames.forEach((ruleName) => {
23
+ contents = contents.replace(new RegExp(`@nx/workspace/${ruleName}`, 'g'), `@nx/workspace-${ruleName}`);
24
+ });
25
+ tree.write(path, contents);
26
+ });
27
+ await (0, devkit_1.formatFiles)(tree);
28
+ }
29
+ exports.default = renameWorkspaceRule;
@@ -21,7 +21,9 @@ exports.workspaceRules = (() => {
21
21
  // Apply the namespace to the resolved rules
22
22
  const namespacedRules = {};
23
23
  for (const [ruleName, ruleConfig] of Object.entries(rules)) {
24
- namespacedRules[`${constants_1.WORKSPACE_RULE_NAMESPACE}/${ruleName}`] = ruleConfig;
24
+ namespacedRules[`${constants_1.WORKSPACE_RULE_PREFIX}-${ruleName}`] = ruleConfig;
25
+ // keep the old namespaced rules for backwards compatibility
26
+ namespacedRules[`${constants_1.WORKSPACE_RULE_PREFIX}/${ruleName}`] = ruleConfig;
25
27
  }
26
28
  return namespacedRules;
27
29
  }