Skip to content

workspace: implement ci check to catch typescript AST template strings issue #21810

Description

@Hotell

Describe the issue:

Because of TS AST bug microsoft/TypeScript#47597, when NX builds dependency graph based on source files it runs into following issue nrwl/nx#8938.

This was exposed and fix in #21751 ( PR includes a naive check only for 1 particular project, thus should be generalized ).

To mitigate that incorrect graph resolution we need to create a check that will fail pipeline and notify user that his code needs to be updated, to not create phantom/incorrect dependency resolution in dep-graph.

Actual behavior:

If our js module contains following code/pattern

  • there is a string literal interpolation
  • there is a static import of monorepo package within a string
// @filename packages/proj-a/index.js

const npmScope = 'myorg';
// 🚨 this is the root cause - template strings interpolation
console.log(`@${npmScope}`);


// 🚨 now your project depends on proj-b ( which is not true )
console.log(`import {foo} from '@my-org/proj-b'`)

Pipeline will pass

Expected behavior:

Pipeline checks for this patterns in affected files and fails if present

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions