Skip to content

Commit

Permalink
Revert "fix(core): sort node names for module resolution"
Browse files Browse the repository at this point in the history
  • Loading branch information
vsavkin committed Jan 12, 2020
1 parent 2c3d46a commit 0b77072
Show file tree
Hide file tree
Showing 12 changed files with 535 additions and 619 deletions.
2 changes: 2 additions & 0 deletions e2e/command-line.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ forEachCli(() => {
`
import '../../../libs/${mylib}';
import '@proj/${lazylib}';
import '@proj/${mylib}/deep';
import '@proj/${myapp2}';
import '@proj/${invalidtaglib}';
import '@proj/${validtaglib}';
Expand All @@ -55,6 +56,7 @@ forEachCli(() => {
const out = runCLI(`lint ${myapp}`, { silenceError: true });
expect(out).toContain('library imports must start with @proj/');
expect(out).toContain('imports of lazy-loaded libraries are forbidden');
expect(out).toContain('deep imports into libraries are forbidden');
expect(out).toContain('imports of apps are forbidden');
expect(out).toContain(
'A project tagged with "validtag" can only depend on libs tagged with "validtag"'
Expand Down
16 changes: 2 additions & 14 deletions packages/eslint-plugin-nx/src/rules/enforce-module-boundaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
readNxJson,
readWorkspaceJson
} from '@nrwl/workspace/src/core/file-utils';
import { TargetProjectLocator } from '@nrwl/workspace/src/core/project-graph/build-dependencies/target-project-locator';

type Options = [
{
Expand Down Expand Up @@ -101,15 +100,6 @@ export default createESLintRule<Options, MessageIds>({
}
const npmScope = (global as any).npmScope;
const projectGraph = (global as any).projectGraph as ProjectGraph;

if (!(global as any).targetProjectLocator) {
(global as any).targetProjectLocator = new TargetProjectLocator(
projectGraph.nodes
);
}
const targetProjectLocator = (global as any)
.targetProjectLocator as TargetProjectLocator;

return {
ImportDeclaration(node: TSESTree.ImportDeclaration) {
const imp = (node.source as TSESTree.Literal).value as string;
Expand Down Expand Up @@ -151,10 +141,8 @@ export default createESLintRule<Options, MessageIds>({
// findProjectUsingImport to take care of same prefix
const targetProject = findProjectUsingImport(
projectGraph,
targetProjectLocator,
sourceFilePath,
imp,
npmScope
npmScope,
imp
);

// something went wrong => return.
Expand Down
Loading

0 comments on commit 0b77072

Please sign in to comment.