@nrwl/eslint-plugin-nx 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 (62) hide show
  1. package/index.d.ts +1 -0
  2. package/index.js +5 -0
  3. package/index.js.map +1 -0
  4. package/package.json +8 -18
  5. package/README.md +0 -63
  6. package/src/configs/angular-template.d.ts +0 -20
  7. package/src/configs/angular-template.js +0 -22
  8. package/src/configs/angular-template.js.map +0 -1
  9. package/src/configs/angular.d.ts +0 -25
  10. package/src/configs/angular.js +0 -43
  11. package/src/configs/angular.js.map +0 -1
  12. package/src/configs/javascript.d.ts +0 -42
  13. package/src/configs/javascript.js +0 -51
  14. package/src/configs/javascript.js.map +0 -1
  15. package/src/configs/react-base.d.ts +0 -112
  16. package/src/configs/react-base.js +0 -141
  17. package/src/configs/react-base.js.map +0 -1
  18. package/src/configs/react-jsx.d.ts +0 -71
  19. package/src/configs/react-jsx.js +0 -65
  20. package/src/configs/react-jsx.js.map +0 -1
  21. package/src/configs/react-tmp.d.ts +0 -12
  22. package/src/configs/react-tmp.js +0 -18
  23. package/src/configs/react-tmp.js.map +0 -1
  24. package/src/configs/react-typescript.d.ts +0 -41
  25. package/src/configs/react-typescript.js +0 -56
  26. package/src/configs/react-typescript.js.map +0 -1
  27. package/src/configs/typescript.d.ts +0 -24
  28. package/src/configs/typescript.js +0 -34
  29. package/src/configs/typescript.js.map +0 -1
  30. package/src/constants.d.ts +0 -12
  31. package/src/constants.js +0 -18
  32. package/src/constants.js.map +0 -1
  33. package/src/index.d.ts +0 -1
  34. package/src/index.js +0 -28
  35. package/src/index.js.map +0 -1
  36. package/src/resolve-workspace-rules.d.ts +0 -4
  37. package/src/resolve-workspace-rules.js +0 -36
  38. package/src/resolve-workspace-rules.js.map +0 -1
  39. package/src/rules/enforce-module-boundaries.d.ts +0 -16
  40. package/src/rules/enforce-module-boundaries.js +0 -428
  41. package/src/rules/enforce-module-boundaries.js.map +0 -1
  42. package/src/rules/nx-plugin-checks.d.ts +0 -21
  43. package/src/rules/nx-plugin-checks.js +0 -359
  44. package/src/rules/nx-plugin-checks.js.map +0 -1
  45. package/src/utils/ast-utils.d.ts +0 -12
  46. package/src/utils/ast-utils.js +0 -181
  47. package/src/utils/ast-utils.js.map +0 -1
  48. package/src/utils/config-utils.d.ts +0 -6
  49. package/src/utils/config-utils.js +0 -21
  50. package/src/utils/config-utils.js.map +0 -1
  51. package/src/utils/create-eslint-rule.d.ts +0 -2
  52. package/src/utils/create-eslint-rule.js +0 -6
  53. package/src/utils/create-eslint-rule.js.map +0 -1
  54. package/src/utils/graph-utils.d.ts +0 -5
  55. package/src/utils/graph-utils.js +0 -117
  56. package/src/utils/graph-utils.js.map +0 -1
  57. package/src/utils/project-graph-utils.d.ts +0 -7
  58. package/src/utils/project-graph-utils.js +0 -46
  59. package/src/utils/project-graph-utils.js.map +0 -1
  60. package/src/utils/runtime-lint-utils.d.ts +0 -85
  61. package/src/utils/runtime-lint-utils.js +0 -329
  62. package/src/utils/runtime-lint-utils.js.map +0 -1
@@ -1,359 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateVersionJsonExpression = exports.validatePackageGroup = exports.validateImplemenationNode = exports.validateEntry = exports.checkCollectionNode = exports.checkCollectionFileNode = exports.RULE_NAME = void 0;
4
- const devkit_1 = require("@nrwl/devkit");
5
- const runtime_lint_utils_1 = require("../utils/runtime-lint-utils");
6
- const fs_1 = require("fs");
7
- const register_1 = require("nx/src/utils/register");
8
- const path = require("path");
9
- const create_eslint_rule_1 = require("../utils/create-eslint-rule");
10
- const project_graph_utils_1 = require("../utils/project-graph-utils");
11
- const semver_1 = require("semver");
12
- const DEFAULT_OPTIONS = {
13
- generatorsJson: 'generators.json',
14
- executorsJson: 'executors.json',
15
- migrationsJson: 'migrations.json',
16
- packageJson: 'package.json',
17
- allowedVersionStrings: ['*', 'latest', 'next'],
18
- };
19
- exports.RULE_NAME = 'nx-plugin-checks';
20
- exports.default = (0, create_eslint_rule_1.createESLintRule)({
21
- name: exports.RULE_NAME,
22
- meta: {
23
- docs: {
24
- description: 'Checks common nx-plugin configuration files for validity',
25
- recommended: 'error',
26
- },
27
- schema: {},
28
- type: 'problem',
29
- messages: {
30
- invalidSchemaPath: 'Schema path should point to a valid file',
31
- invalidImplementationPath: '{{ key }}: Implementation path should point to a valid file',
32
- invalidImplementationModule: '{{ key }}: Unable to find export {{ identifier }} in implementation module',
33
- unableToReadImplementationExports: '{{ key }}: Unable to read exports for implementation module',
34
- invalidVersion: '{{ key }}: Version should be a valid semver',
35
- noGeneratorsOrSchematicsFound: 'Unable to find `generators` or `schematics` property',
36
- noExecutorsOrBuildersFound: 'Unable to find `executors` or `builders` property',
37
- valueShouldBeObject: '{{ key }} should be an object',
38
- missingRequiredSchema: '{{ key }}: Missing required property - `schema`',
39
- missingImplementation: '{{ key }}: Missing required property - `implementation`',
40
- missingVersion: '{{ key }}: Missing required property - `version`',
41
- },
42
- },
43
- defaultOptions: [DEFAULT_OPTIONS],
44
- create(context) {
45
- // jsonc-eslint-parser adds this property to parserServices where appropriate
46
- if (!context.parserServices.isJSON) {
47
- return {};
48
- }
49
- const { projectGraph, projectRootMappings } = (0, project_graph_utils_1.readProjectGraph)(exports.RULE_NAME);
50
- const sourceFilePath = (0, runtime_lint_utils_1.getSourceFilePath)(context.getFilename(), devkit_1.workspaceRoot);
51
- const sourceProject = (0, runtime_lint_utils_1.findProject)(projectGraph, projectRootMappings, sourceFilePath);
52
- // If source is not part of an nx workspace, return.
53
- if (!sourceProject) {
54
- return {};
55
- }
56
- const options = normalizeOptions(sourceProject, context.options[0]);
57
- context.options[0] = options;
58
- const { generatorsJson, executorsJson, migrationsJson, packageJson } = options;
59
- if (![generatorsJson, executorsJson, migrationsJson, packageJson].includes(sourceFilePath)) {
60
- return {};
61
- }
62
- if (!global.tsProjectRegistered) {
63
- (0, register_1.registerTsProject)(devkit_1.workspaceRoot, 'tsconfig.base.json');
64
- global.tsProjectRegistered = true;
65
- }
66
- return {
67
- ['JSONExpressionStatement > JSONObjectExpression'](node) {
68
- if (sourceFilePath === generatorsJson) {
69
- checkCollectionFileNode(node, 'generator', context);
70
- }
71
- else if (sourceFilePath === migrationsJson) {
72
- checkCollectionFileNode(node, 'migration', context);
73
- }
74
- else if (sourceFilePath === executorsJson) {
75
- checkCollectionFileNode(node, 'executor', context);
76
- }
77
- else if (sourceFilePath === packageJson) {
78
- validatePackageGroup(node, context);
79
- }
80
- },
81
- };
82
- },
83
- });
84
- function normalizeOptions(sourceProject, options) {
85
- const base = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options);
86
- const pathPrefix = sourceProject.data.root !== '.' ? `${sourceProject.data.root}/` : '';
87
- return Object.assign(Object.assign({}, base), { executorsJson: base.executorsJson
88
- ? `${pathPrefix}${base.executorsJson}`
89
- : undefined, generatorsJson: base.generatorsJson
90
- ? `${pathPrefix}${base.generatorsJson}`
91
- : undefined, migrationsJson: base.migrationsJson
92
- ? `${pathPrefix}${base.migrationsJson}`
93
- : undefined, packageJson: base.packageJson
94
- ? `${pathPrefix}${base.packageJson}`
95
- : undefined });
96
- }
97
- function checkCollectionFileNode(baseNode, mode, context) {
98
- const schematicsRootNode = baseNode.properties.find((x) => x.key.type === 'JSONLiteral' && x.key.value === 'schematics');
99
- const generatorsRootNode = baseNode.properties.find((x) => x.key.type === 'JSONLiteral' && x.key.value === 'generators');
100
- const executorsRootNode = baseNode.properties.find((x) => x.key.type === 'JSONLiteral' && x.key.value === 'executors');
101
- const buildersRootNode = baseNode.properties.find((x) => x.key.type === 'JSONLiteral' && x.key.value === 'builders');
102
- if (!schematicsRootNode && !generatorsRootNode && mode !== 'executor') {
103
- context.report({
104
- messageId: 'noGeneratorsOrSchematicsFound',
105
- node: baseNode,
106
- });
107
- return;
108
- }
109
- if (!executorsRootNode && !buildersRootNode && mode === 'executor') {
110
- context.report({
111
- messageId: 'noExecutorsOrBuildersFound',
112
- node: baseNode,
113
- });
114
- return;
115
- }
116
- const collectionNodes = [
117
- { collectionNode: schematicsRootNode, key: 'schematics' },
118
- { collectionNode: generatorsRootNode, key: 'generators' },
119
- { collectionNode: executorsRootNode, key: 'executors' },
120
- { collectionNode: buildersRootNode, key: 'builders' },
121
- ].filter(({ collectionNode }) => !!collectionNode);
122
- for (const { collectionNode, key } of collectionNodes) {
123
- if (collectionNode.value.type !== 'JSONObjectExpression') {
124
- context.report({
125
- messageId: 'valueShouldBeObject',
126
- data: { key },
127
- node: schematicsRootNode,
128
- });
129
- }
130
- else {
131
- checkCollectionNode(collectionNode.value, mode, context);
132
- }
133
- }
134
- }
135
- exports.checkCollectionFileNode = checkCollectionFileNode;
136
- function checkCollectionNode(baseNode, mode, context) {
137
- const entries = baseNode.properties;
138
- for (const entryNode of entries) {
139
- if (entryNode.value.type !== 'JSONObjectExpression') {
140
- context.report({
141
- messageId: 'valueShouldBeObject',
142
- data: { key: entryNode.key.value },
143
- node: entryNode,
144
- });
145
- }
146
- else if (entryNode.key.type === 'JSONLiteral') {
147
- validateEntry(entryNode.value, entryNode.key.value.toString(), mode, context);
148
- }
149
- }
150
- }
151
- exports.checkCollectionNode = checkCollectionNode;
152
- function validateEntry(baseNode, key, mode, context) {
153
- const schemaNode = baseNode.properties.find((x) => x.key.type === 'JSONLiteral' && x.key.value === 'schema');
154
- if (mode !== 'migration' && !schemaNode) {
155
- context.report({
156
- messageId: 'missingRequiredSchema',
157
- data: {
158
- key,
159
- },
160
- node: baseNode,
161
- });
162
- }
163
- else if (schemaNode) {
164
- if (schemaNode.value.type !== 'JSONLiteral' ||
165
- typeof schemaNode.value.value !== 'string') {
166
- context.report({
167
- messageId: 'invalidSchemaPath',
168
- node: schemaNode.value,
169
- });
170
- }
171
- else {
172
- const schemaFilePath = path.join(path.dirname(context.getFilename()), schemaNode.value.value);
173
- if (!(0, fs_1.existsSync)(schemaFilePath)) {
174
- context.report({
175
- messageId: 'invalidSchemaPath',
176
- node: schemaNode.value,
177
- });
178
- }
179
- else {
180
- try {
181
- (0, devkit_1.readJsonFile)(schemaFilePath);
182
- }
183
- catch (e) {
184
- context.report({
185
- messageId: 'invalidSchemaPath',
186
- node: schemaNode.value,
187
- });
188
- }
189
- }
190
- }
191
- }
192
- const implementationNode = baseNode.properties.find((x) => x.key.type === 'JSONLiteral' &&
193
- (x.key.value === 'implementation' || x.key.value === 'factory'));
194
- if (!implementationNode) {
195
- context.report({
196
- messageId: 'missingImplementation',
197
- data: {
198
- key,
199
- },
200
- node: baseNode,
201
- });
202
- }
203
- else {
204
- validateImplemenationNode(implementationNode, key, context);
205
- }
206
- if (mode === 'migration') {
207
- const versionNode = baseNode.properties.find((x) => x.key.type === 'JSONLiteral' && x.key.value === 'version');
208
- if (!versionNode) {
209
- context.report({
210
- messageId: 'missingVersion',
211
- data: {
212
- key,
213
- },
214
- node: baseNode,
215
- });
216
- }
217
- else if (versionNode.value.type !== 'JSONLiteral' ||
218
- typeof versionNode.value.value !== 'string') {
219
- context.report({
220
- messageId: 'invalidVersion',
221
- data: {
222
- key,
223
- },
224
- node: versionNode.value,
225
- });
226
- }
227
- else {
228
- const specifiedVersion = versionNode.value.value;
229
- if (!(0, semver_1.valid)(specifiedVersion)) {
230
- context.report({
231
- messageId: 'invalidVersion',
232
- data: {
233
- key,
234
- },
235
- node: versionNode.value,
236
- });
237
- }
238
- }
239
- }
240
- }
241
- exports.validateEntry = validateEntry;
242
- function validateImplemenationNode(implementationNode, key, context) {
243
- if (implementationNode.value.type !== 'JSONLiteral' ||
244
- typeof implementationNode.value.value !== 'string') {
245
- context.report({
246
- messageId: 'invalidImplementationPath',
247
- data: {
248
- key,
249
- },
250
- node: implementationNode.value,
251
- });
252
- }
253
- else {
254
- const [implementationPath, identifier] = implementationNode.value.value.split('#');
255
- let resolvedPath;
256
- const modulePath = path.join(path.dirname(context.getFilename()), implementationPath);
257
- try {
258
- resolvedPath = require.resolve(modulePath);
259
- }
260
- catch (e) {
261
- context.report({
262
- messageId: 'invalidImplementationPath',
263
- data: {
264
- key,
265
- },
266
- node: implementationNode.value,
267
- });
268
- }
269
- if (identifier) {
270
- try {
271
- const m = require(resolvedPath);
272
- if (!(identifier in m && typeof m[identifier] === 'function')) {
273
- context.report({
274
- messageId: 'invalidImplementationModule',
275
- node: implementationNode.value,
276
- data: {
277
- identifier,
278
- key,
279
- },
280
- });
281
- }
282
- }
283
- catch (_a) {
284
- context.report({
285
- messageId: 'unableToReadImplementationExports',
286
- node: implementationNode.value,
287
- data: {
288
- key,
289
- },
290
- });
291
- }
292
- }
293
- }
294
- }
295
- exports.validateImplemenationNode = validateImplemenationNode;
296
- function validatePackageGroup(baseNode, context) {
297
- var _a, _b, _c;
298
- const migrationsNode = (_a = baseNode.properties.find((x) => x.key.type === 'JSONLiteral' &&
299
- x.value.type === 'JSONObjectExpression' &&
300
- (x.key.value === 'nx-migrations' ||
301
- x.key.value === 'ng-update' ||
302
- x.key.value === 'migrations'))) === null || _a === void 0 ? void 0 : _a.value;
303
- const packageGroupNode = migrationsNode === null || migrationsNode === void 0 ? void 0 : migrationsNode.properties.find((x) => x.key.type === 'JSONLiteral' && x.key.value === 'packageGroup');
304
- if (packageGroupNode) {
305
- // Package group is defined as an array
306
- if (packageGroupNode.value.type === 'JSONArrayExpression') {
307
- // Look at entries which are an object
308
- const members = packageGroupNode.value.elements.filter((x) => x.type === 'JSONObjectExpression');
309
- // validate that the version property exists and is valid
310
- for (const member of members) {
311
- const versionPropertyNode = member.properties.find((x) => x.key.type === 'JSONLiteral' && x.key.value === 'version');
312
- const packageNode = member.properties.find((x) => x.key.type === 'JSONLiteral' && x.key.value === 'package');
313
- const key = (_c = (_b = packageNode === null || packageNode === void 0 ? void 0 : packageNode.value) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : 'unknown';
314
- if (versionPropertyNode) {
315
- if (!validateVersionJsonExpression(versionPropertyNode.value, context))
316
- context.report({
317
- messageId: 'invalidVersion',
318
- data: { key },
319
- node: versionPropertyNode.value,
320
- });
321
- }
322
- else {
323
- context.report({
324
- messageId: 'missingVersion',
325
- data: { key },
326
- node: member,
327
- });
328
- }
329
- }
330
- // Package group is defined as an object (Record<PackageName, Version>)
331
- }
332
- else if (packageGroupNode.value.type === 'JSONObjectExpression') {
333
- const properties = packageGroupNode.value.properties;
334
- // For each property, ensure its value is a valid version
335
- for (const propertyNode of properties) {
336
- if (!validateVersionJsonExpression(propertyNode.value, context)) {
337
- context.report({
338
- messageId: 'invalidVersion',
339
- data: {
340
- key: propertyNode.key.value,
341
- },
342
- node: propertyNode.value,
343
- });
344
- }
345
- }
346
- }
347
- }
348
- }
349
- exports.validatePackageGroup = validatePackageGroup;
350
- function validateVersionJsonExpression(node, context) {
351
- var _a;
352
- return (node &&
353
- node.type === 'JSONLiteral' &&
354
- typeof node.value === 'string' &&
355
- ((0, semver_1.valid)(node.value) ||
356
- ((_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.allowedVersionStrings.includes(node.value))));
357
- }
358
- exports.validateVersionJsonExpression = validateVersionJsonExpression;
359
- //# sourceMappingURL=nx-plugin-checks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nx-plugin-checks.js","sourceRoot":"","sources":["../../../../../packages/eslint-plugin-nx/src/rules/nx-plugin-checks.ts"],"names":[],"mappings":";;;AAGA,yCAIsB;AACtB,oEAA6E;AAC7E,2BAAgC;AAChC,oDAA0D;AAC1D,6BAA6B;AAE7B,oEAA+D;AAC/D,sEAAgE;AAChE,mCAA+B;AAY/B,MAAM,eAAe,GAAe;IAClC,cAAc,EAAE,iBAAiB;IACjC,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE,iBAAiB;IACjC,WAAW,EAAE,cAAc;IAC3B,qBAAqB,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC;CAC/C,CAAC;AAeW,QAAA,SAAS,GAAG,kBAAkB,CAAC;AAE5C,kBAAe,IAAA,qCAAgB,EAAsB;IACnD,IAAI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C,OAAO,CAAC,CAAC,CAAC,0CAAE,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA,CAAC,CAClE,CAAC;AACJ,CAAC;AAXD,sEAWC"}
@@ -1,12 +0,0 @@
1
- import { ProjectGraphProjectNode } from '@nrwl/devkit';
2
- /**
3
- *
4
- * @param importScope like `@myorg/somelib`
5
- * @returns
6
- */
7
- export declare function getBarrelEntryPointByImportScope(importScope: string): string[] | null;
8
- export declare function getBarrelEntryPointProjectNode(projectNode: ProjectGraphProjectNode): {
9
- path: string;
10
- importScope: string;
11
- }[] | null;
12
- export declare function getRelativeImportPath(exportedMember: any, filePath: any, basePath: any): any;
@@ -1,181 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRelativeImportPath = exports.getBarrelEntryPointProjectNode = exports.getBarrelEntryPointByImportScope = void 0;
4
- const devkit_1 = require("@nrwl/devkit");
5
- const typescript_1 = require("nx/src/utils/typescript");
6
- const fs_1 = require("fs");
7
- const path_1 = require("path");
8
- const ts = require("typescript");
9
- const devkit_2 = require("@nrwl/devkit");
10
- function tryReadBaseJson() {
11
- try {
12
- return (0, devkit_1.readJsonFile)((0, devkit_1.joinPathFragments)(devkit_2.workspaceRoot, 'tsconfig.base.json'));
13
- }
14
- catch (e) {
15
- devkit_2.logger.warn(`Error reading "tsconfig.base.json": \n${JSON.stringify(e)}`);
16
- return null;
17
- }
18
- }
19
- /**
20
- *
21
- * @param importScope like `@myorg/somelib`
22
- * @returns
23
- */
24
- function getBarrelEntryPointByImportScope(importScope) {
25
- var _a;
26
- const tsConfigBase = tryReadBaseJson();
27
- return ((_a = tsConfigBase === null || tsConfigBase === void 0 ? void 0 : tsConfigBase.compilerOptions) === null || _a === void 0 ? void 0 : _a.paths[importScope]) || null;
28
- }
29
- exports.getBarrelEntryPointByImportScope = getBarrelEntryPointByImportScope;
30
- function getBarrelEntryPointProjectNode(projectNode) {
31
- var _a;
32
- const tsConfigBase = tryReadBaseJson();
33
- if ((_a = tsConfigBase === null || tsConfigBase === void 0 ? void 0 : tsConfigBase.compilerOptions) === null || _a === void 0 ? void 0 : _a.paths) {
34
- const potentialEntryPoints = Object.keys(tsConfigBase.compilerOptions.paths)
35
- .filter((entry) => {
36
- const sourceFolderPaths = tsConfigBase.compilerOptions.paths[entry];
37
- return sourceFolderPaths.some((sourceFolderPath) => {
38
- return (sourceFolderPath === projectNode.data.sourceRoot ||
39
- sourceFolderPath.indexOf(`${projectNode.data.sourceRoot}/`) === 0);
40
- });
41
- })
42
- .map((entry) => tsConfigBase.compilerOptions.paths[entry].map((x) => ({
43
- path: x,
44
- importScope: entry,
45
- })));
46
- return potentialEntryPoints.flat();
47
- }
48
- return null;
49
- }
50
- exports.getBarrelEntryPointProjectNode = getBarrelEntryPointProjectNode;
51
- function hasMemberExport(exportedMember, filePath) {
52
- const fileContent = (0, fs_1.readFileSync)(filePath, 'utf8');
53
- // use the TypeScript AST to find the path to the file where exportedMember is defined
54
- const sourceFile = ts.createSourceFile(filePath, fileContent, ts.ScriptTarget.Latest, true);
55
- // search whether there is already an export with our node
56
- return ((0, typescript_1.findNodes)(sourceFile, ts.SyntaxKind.Identifier).filter((identifier) => identifier.text === exportedMember).length > 0);
57
- }
58
- function getRelativeImportPath(exportedMember, filePath, basePath) {
59
- var _a;
60
- const fileContent = (0, fs_1.readFileSync)(filePath, 'utf8');
61
- // use the TypeScript AST to find the path to the file where exportedMember is defined
62
- const sourceFile = ts.createSourceFile(filePath, fileContent, ts.ScriptTarget.Latest, true);
63
- // Search in the current file whether there's an export already!
64
- const memberNodes = (0, typescript_1.findNodes)(sourceFile, ts.SyntaxKind.Identifier).filter((identifier) => identifier.text === exportedMember);
65
- let hasExport = false;
66
- for (const memberNode of memberNodes || []) {
67
- if (memberNode) {
68
- // recursively navigate upwards to find the ExportKey modifier
69
- let parent = memberNode;
70
- do {
71
- parent = parent.parent;
72
- if (parent) {
73
- // if we are inside a parameter list or decorator or param assignment
74
- // then this is not what we're searching for, so break :)
75
- if (parent.kind === ts.SyntaxKind.Parameter ||
76
- parent.kind === ts.SyntaxKind.PropertyAccessExpression ||
77
- parent.kind === ts.SyntaxKind.TypeReference ||
78
- parent.kind === ts.SyntaxKind.HeritageClause ||
79
- parent.kind === ts.SyntaxKind.Decorator) {
80
- hasExport = false;
81
- break;
82
- }
83
- // if our identifier is within an ExportDeclaration but is not just
84
- // a re-export of some other module, we're good
85
- if (parent.kind === ts.SyntaxKind.ExportDeclaration &&
86
- !parent.moduleSpecifier) {
87
- hasExport = true;
88
- break;
89
- }
90
- if (parent.modifiers &&
91
- parent.modifiers.find((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)) {
92
- /**
93
- * if we get to a function export declaration we need to verify whether the
94
- * exported function is actually the member we are searching for. Otherwise
95
- * we might end up finding a function that just uses our searched identifier
96
- * internally.
97
- *
98
- * Example: assume we try to find a constant member: `export const SOME_CONSTANT = 'bla'`
99
- *
100
- * Then we might end up in a file that uses it like
101
- *
102
- * import { SOME_CONSTANT } from '@myorg/samelib'
103
- *
104
- * export function someFunction() {
105
- * return `Hi, ${SOME_CONSTANT}`
106
- * }
107
- *
108
- * We want to avoid accidentally picking the someFunction export since we're searching upwards
109
- * starting from `SOME_CONSTANT` identifier usages.
110
- */
111
- if (parent.kind === ts.SyntaxKind.FunctionDeclaration) {
112
- const parentName = (_a = parent.name) === null || _a === void 0 ? void 0 : _a.text;
113
- if (parentName === exportedMember) {
114
- hasExport = true;
115
- break;
116
- }
117
- }
118
- else {
119
- hasExport = true;
120
- break;
121
- }
122
- }
123
- }
124
- } while (!!parent);
125
- }
126
- if (hasExport) {
127
- break;
128
- }
129
- }
130
- if (hasExport) {
131
- // we found the file, now grab the path
132
- return filePath;
133
- }
134
- // if we didn't find an export, let's try to follow
135
- // all export declarations and see whether any of those
136
- // exports the node we're searching for
137
- const exportDeclarations = (0, typescript_1.findNodes)(sourceFile, ts.SyntaxKind.ExportDeclaration);
138
- for (const exportDeclaration of exportDeclarations) {
139
- if (exportDeclaration.moduleSpecifier) {
140
- // verify whether the export declaration we're looking at is a named export
141
- // cause in that case we need to check whether our searched member is
142
- // part of the exports
143
- if (exportDeclaration.exportClause &&
144
- (0, typescript_1.findNodes)(exportDeclaration, ts.SyntaxKind.Identifier).filter((identifier) => identifier.text === exportedMember).length === 0) {
145
- continue;
146
- }
147
- const modulePath = exportDeclaration.moduleSpecifier.text;
148
- let moduleFilePath;
149
- if (modulePath.endsWith('.js') || modulePath.endsWith('.jsx')) {
150
- moduleFilePath = (0, devkit_1.joinPathFragments)((0, path_1.dirname)(filePath), modulePath);
151
- if (!(0, fs_1.existsSync)(moduleFilePath)) {
152
- const tsifiedModulePath = modulePath.replace(/\.js(x?)$/, '.ts$1');
153
- moduleFilePath = (0, devkit_1.joinPathFragments)((0, path_1.dirname)(filePath), `${tsifiedModulePath}`);
154
- }
155
- }
156
- else if (modulePath.endsWith('.ts') || modulePath.endsWith('.tsx')) {
157
- moduleFilePath = (0, devkit_1.joinPathFragments)((0, path_1.dirname)(filePath), modulePath);
158
- }
159
- else {
160
- moduleFilePath = (0, devkit_1.joinPathFragments)((0, path_1.dirname)(filePath), `${modulePath}.ts`);
161
- if (!(0, fs_1.existsSync)(moduleFilePath)) {
162
- // might be a tsx file
163
- moduleFilePath = (0, devkit_1.joinPathFragments)((0, path_1.dirname)(filePath), `${modulePath}.tsx`);
164
- }
165
- }
166
- if (!(0, fs_1.existsSync)(moduleFilePath)) {
167
- // might be an index.ts
168
- moduleFilePath = (0, devkit_1.joinPathFragments)((0, path_1.dirname)(filePath), `${modulePath}/index.ts`);
169
- }
170
- if (hasMemberExport(exportedMember, moduleFilePath)) {
171
- const foundFilePath = getRelativeImportPath(exportedMember, moduleFilePath, basePath);
172
- if (foundFilePath) {
173
- return foundFilePath;
174
- }
175
- }
176
- }
177
- }
178
- return null;
179
- }
180
- exports.getRelativeImportPath = getRelativeImportPath;
181
- //# sourceMappingURL=ast-utils.js.map
@@ -1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+0,0 @@
1
- /**
2
- * Checks if package is available
3
- * @param name name of the package
4
- * @returns
5
- */
6
- export declare function packageExists(name: string): boolean;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.packageExists = void 0;
4
- const fs_1 = require("fs");
5
- /**
6
- * Checks if package is available
7
- * @param name name of the package
8
- * @returns
9
- */
10
- function packageExists(name) {
11
- try {
12
- // TODO(meeroslav): This will not work once we start using yarn Berry with PnP
13
- (0, fs_1.accessSync)(`./node_modules/.bin/${name}`);
14
- return true;
15
- }
16
- catch (e) {
17
- return false;
18
- }
19
- }
20
- exports.packageExists = packageExists;
21
- //# sourceMappingURL=config-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-utils.js","sourceRoot":"","sources":["../../../../../packages/eslint-plugin-nx/src/utils/config-utils.ts"],"names":[],"mappings":";;;AAAA,2BAAgC;AAEhC;;;;GAIG;AACH,SAAgB,aAAa,CAAC,IAAY;IACxC,IAAI;QACF,8EAA8E;QAC9E,IAAA,eAAU,EAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AARD,sCAQC"}
@@ -1,2 +0,0 @@
1
- import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const createESLintRule: <TOptions extends readonly unknown[], TMessageIds extends string, TRuleListener extends import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener = import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>({ name, meta, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<TOptions, TMessageIds, TRuleListener>>) => import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<TMessageIds, TOptions, TRuleListener>;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createESLintRule = void 0;
4
- const utils_1 = require("@typescript-eslint/utils");
5
- exports.createESLintRule = utils_1.ESLintUtils.RuleCreator(() => ``);
6
- //# sourceMappingURL=create-eslint-rule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-eslint-rule.js","sourceRoot":"","sources":["../../../../../packages/eslint-plugin-nx/src/utils/create-eslint-rule.ts"],"names":[],"mappings":";;;AAAA,oDAAuD;AAE1C,QAAA,gBAAgB,GAAG,mBAAW,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC"}
@@ -1,5 +0,0 @@
1
- import type { ProjectGraph, ProjectGraphProjectNode } from '@nrwl/devkit';
2
- export declare function getPath(graph: ProjectGraph, sourceProjectName: string, targetProjectName: string): Array<ProjectGraphProjectNode>;
3
- export declare function pathExists(graph: ProjectGraph, sourceProjectName: string, targetProjectName: string): boolean;
4
- export declare function checkCircularPath(graph: ProjectGraph, sourceProject: ProjectGraphProjectNode, targetProject: ProjectGraphProjectNode): ProjectGraphProjectNode[];
5
- export declare function findFilesInCircularPath(circularPath: ProjectGraphProjectNode[]): Array<string[]>;