@nrwl/eslint-plugin-nx 13.5.2 → 13.6.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/eslint-plugin-nx",
3
- "version": "13.5.2",
3
+ "version": "13.6.0",
4
4
  "description": "ESLint Plugin for Nx",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,8 +27,8 @@
27
27
  "eslint-config-prettier": "^8.1.0"
28
28
  },
29
29
  "dependencies": {
30
- "@nrwl/devkit": "13.5.2",
31
- "@nrwl/workspace": "13.5.2",
30
+ "@nrwl/devkit": "13.6.0",
31
+ "@nrwl/workspace": "13.6.0",
32
32
  "@typescript-eslint/experimental-utils": "~5.3.0",
33
33
  "chalk": "4.1.0",
34
34
  "confusing-browser-globals": "^1.0.9",
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.workspaceRules = void 0;
4
+ const fs_1 = require("fs");
4
5
  const constants_1 = require("./constants");
5
6
  /**
6
7
  * Optionally, if ts-node and tsconfig-paths are available in the current workspace, apply the require
@@ -10,34 +11,41 @@ const constants_1 = require("./constants");
10
11
  * tools/eslint-rules and write their rules in JavaScript and the fundamentals will still work (but
11
12
  * workspace path mapping will not, for example).
12
13
  */
13
- try {
14
- require('ts-node').register({
15
- dir: constants_1.WORKSPACE_PLUGIN_DIR,
16
- });
17
- const tsconfigPaths = require('tsconfig-paths');
18
- // Load the tsconfig from tools/eslint-rules/tsconfig.json
19
- const tsConfigResult = tsconfigPaths.loadConfig(constants_1.WORKSPACE_PLUGIN_DIR);
20
- /**
21
- * Register the custom workspace path mappings with node so that workspace libraries
22
- * can be imported and used within custom workspace lint rules.
23
- */
24
- tsconfigPaths.register({
25
- baseUrl: tsConfigResult.absoluteBaseUrl,
26
- paths: tsConfigResult.paths,
27
- });
14
+ function registerTSWorkspaceLint() {
15
+ try {
16
+ require('ts-node').register({
17
+ dir: constants_1.WORKSPACE_PLUGIN_DIR,
18
+ });
19
+ const tsconfigPaths = require('tsconfig-paths');
20
+ // Load the tsconfig from tools/eslint-rules/tsconfig.json
21
+ const tsConfigResult = tsconfigPaths.loadConfig(constants_1.WORKSPACE_PLUGIN_DIR);
22
+ /**
23
+ * Register the custom workspace path mappings with node so that workspace libraries
24
+ * can be imported and used within custom workspace lint rules.
25
+ */
26
+ tsconfigPaths.register({
27
+ baseUrl: tsConfigResult.absoluteBaseUrl,
28
+ paths: tsConfigResult.paths,
29
+ });
30
+ }
31
+ catch (err) { }
28
32
  }
29
- catch (err) { }
30
33
  exports.workspaceRules = (() => {
34
+ // If `tools/eslint-rules` folder doesn't exist, there is no point trying to register and load it
35
+ if (!(0, fs_1.existsSync)(constants_1.WORKSPACE_PLUGIN_DIR)) {
36
+ return {};
37
+ }
38
+ // Register `tools/eslint-rules` for TS transpilation
39
+ registerTSWorkspaceLint();
31
40
  try {
32
41
  /**
33
42
  * Currently we only support applying the rules from the user's workspace plugin object
34
43
  * (i.e. not other things that plugings can expose like configs, processors etc)
35
44
  */
36
45
  const { rules } = require(constants_1.WORKSPACE_PLUGIN_DIR);
37
- const localWorkspaceRules = rules;
38
46
  // Apply the namespace to the resolved rules
39
47
  const namespacedRules = {};
40
- for (const [ruleName, ruleConfig] of Object.entries(localWorkspaceRules)) {
48
+ for (const [ruleName, ruleConfig] of Object.entries(rules)) {
41
49
  namespacedRules[`${constants_1.WORKSPACE_RULE_NAMESPACE}/${ruleName}`] = ruleConfig;
42
50
  }
43
51
  return namespacedRules;
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-workspace-rules.js","sourceRoot":"","sources":["../../../../packages/eslint-plugin-nx/src/resolve-workspace-rules.ts"],"names":[],"mappings":";;;AACA,2CAA6E;AAI7E;;;;;;;GAOG;AACH,IAAI;IACF,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC;QAC1B,GAAG,EAAE,gCAAoB;KAC1B,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEhD,0DAA0D;IAC1D,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC,gCAAoB,CAAC,CAAC;IAEtE;;;OAGG;IACH,aAAa,CAAC,QAAQ,CAAC;QACrB,OAAO,EAAE,cAAc,CAAC,eAAe;QACvC,KAAK,EAAE,cAAc,CAAC,KAAK;KAC5B,CAAC,CAAC;CACJ;AAAC,OAAO,GAAG,EAAE,GAAE;AAEH,QAAA,cAAc,GAAG,CAAC,GAAgB,EAAE;IAC/C,IAAI;QACF;;;WAGG;QACH,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,gCAAoB,CAAC,CAAC;QAChD,MAAM,mBAAmB,GAAgB,KAAK,CAAC;QAE/C,4CAA4C;QAC5C,MAAM,eAAe,GAAgB,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE;YACxE,eAAe,CAAC,GAAG,oCAAwB,IAAI,QAAQ,EAAE,CAAC,GAAG,UAAU,CAAC;SACzE;QACD,OAAO,eAAe,CAAC;KACxB;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,EAAE,CAAC;KACX;AACH,CAAC,CAAC,EAAE,CAAC"}
1
+ {"version":3,"file":"resolve-workspace-rules.js","sourceRoot":"","sources":["../../../../packages/eslint-plugin-nx/src/resolve-workspace-rules.ts"],"names":[],"mappings":";;;AACA,2BAAgC;AAChC,2CAA6E;AAI7E;;;;;;;GAOG;AACH,SAAS,uBAAuB;IAC9B,IAAI;QACF,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC;YAC1B,GAAG,EAAE,gCAAoB;SAC1B,CAAC,CAAC;QAEH,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAEhD,0DAA0D;QAC1D,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC,gCAAoB,CAAC,CAAC;QAEtE;;;WAGG;QACH,aAAa,CAAC,QAAQ,CAAC;YACrB,OAAO,EAAE,cAAc,CAAC,eAAe;YACvC,KAAK,EAAE,cAAc,CAAC,KAAK;SAC5B,CAAC,CAAC;KACJ;IAAC,OAAO,GAAG,EAAE,GAAE;AAClB,CAAC;AAEY,QAAA,cAAc,GAAG,CAAC,GAAgB,EAAE;IAC/C,iGAAiG;IACjG,IAAI,CAAC,IAAA,eAAU,EAAC,gCAAoB,CAAC,EAAE;QACrC,OAAO,EAAE,CAAC;KACX;IACD,qDAAqD;IACrD,uBAAuB,EAAE,CAAC;IAC1B,IAAI;QACF;;;WAGG;QACH,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,gCAAoB,CAAC,CAAC;QAEhD,4CAA4C;QAC5C,MAAM,eAAe,GAAgB,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAoB,CAAC,EAAE;YACzE,eAAe,CAAC,GAAG,oCAAwB,IAAI,QAAQ,EAAE,CAAC,GAAG,UAAU,CAAC;SACzE;QACD,OAAO,eAAe,CAAC;KACxB;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,EAAE,CAAC;KACX;AACH,CAAC,CAAC,EAAE,CAAC"}