Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v19.8.0 - new project - Expected an assignment or function call and instead saw an expression #28069

Closed
1 of 4 tasks
wizardnet972 opened this issue Sep 24, 2024 · 1 comment · Fixed by #28102
Closed
1 of 4 tasks
Assignees

Comments

@wizardnet972
Copy link
Contributor

wizardnet972 commented Sep 24, 2024

Current Behavior

Description

I encountered the following ESLint error when running the nx run-many -t build,lint,test command for a newly created workspace:

Expected an assignment or function call and instead saw an expression. eslint@typescript-eslint/no-unused-expressions

Expected Behavior

The linting step should not fail with the @typescript-eslint/no-unused-expressions error.

GitHub Repo

https://github.com/wizardnet972/nx-repo-problem

Steps to Reproduce

  1. Run the following commands to reproduce the error:
    rm -rf nx-repo-problem
    
    npx --yes create-nx-workspace@latest nx-repo-problem --preset angular-monorepo --appName nx-repo-problem-ui --bundler esbuild --style scss --ssr false --e2eTestRunner playwright --ci skip
    
    cd nx-repo-problem
    
    npx nx g @nx/angular:lib ng-lib --directory libs/ng-lib --projectNameAndRootFormat=as-provided --buildable
    
    npx --yes nx generate @nx/angular:storybook-configuration --project=nx-repo-problem-ui --no-interactive
    
    npx nx run-many -t build,lint,test

Output

After executing the above commands, the lint step fails with the following output:


 NX   Let's create a new workspace [https://nx.dev/getting-started/intro]


 NX   Creating your v19.8.0 workspace.

✔ Installing dependencies with npm
✔ Successfully created the workspace: nx-repo-problem.

——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————


 NX   Nx CLI is not installed globally.

This means that you will have to use "npx nx" to execute commands in the workspace.
Run "npm i -g nx" to be able to execute command directly.


——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————


 NX   First time using Nx? Check out this interactive Nx tutorial.

https://nx.dev/angular-tutorial/1-code-generation

README.md		eslint.config.js	jest.preset.js		nx.json			package.json
apps			jest.config.ts		node_modules		package-lock.json	tsconfig.base.json

 NX  Generating @nx/angular:library

UPDATE nx.json
CREATE libs/ng-lib/project.json
CREATE libs/ng-lib/README.md
CREATE libs/ng-lib/ng-package.json
CREATE libs/ng-lib/package.json
CREATE libs/ng-lib/tsconfig.json
CREATE libs/ng-lib/tsconfig.lib.json
CREATE libs/ng-lib/tsconfig.lib.prod.json
CREATE libs/ng-lib/src/index.ts
CREATE libs/ng-lib/jest.config.ts
CREATE libs/ng-lib/src/test-setup.ts
CREATE libs/ng-lib/tsconfig.spec.json
CREATE libs/ng-lib/src/lib/ng-lib/ng-lib.component.css
CREATE libs/ng-lib/src/lib/ng-lib/ng-lib.component.html
CREATE libs/ng-lib/src/lib/ng-lib/ng-lib.component.spec.ts
CREATE libs/ng-lib/src/lib/ng-lib/ng-lib.component.ts
CREATE libs/ng-lib/eslint.config.js
UPDATE eslint.config.js
UPDATE package.json
UPDATE tsconfig.base.json

added 27 packages, and audited 1547 packages in 2s

224 packages are looking for funding
  run `npm fund` for details

3 high severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

 NX   👀 View Details of ng-lib

Run "nx show project ng-lib" to view details about this project.


 NX  Generating @nx/angular:storybook-configuration

Fetching @nx/storybook...
UPDATE nx.json
UPDATE package.json
CREATE apps/nx-repo-problem-ui/.storybook/main.ts
CREATE apps/nx-repo-problem-ui/.storybook/preview.ts
CREATE apps/nx-repo-problem-ui/.storybook/tsconfig.json
UPDATE apps/nx-repo-problem-ui/tsconfig.app.json
UPDATE apps/nx-repo-problem-ui/tsconfig.json
UPDATE apps/nx-repo-problem-ui/project.json
CREATE apps/nx-repo-problem-ui/src/app/app.component.stories.ts
CREATE apps/nx-repo-problem-ui/src/app/nx-welcome.component.stories.ts
UPDATE apps/nx-repo-problem-ui/tsconfig.editor.json
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated @storybook/jest@0.2.3: In Storybook 8, this package functionality has been integrated to a new package called @storybook/test, which uses Vitest APIs for an improved experience. When upgrading to Storybook 8 with 'npx storybook@latest upgrade', you will get prompted and will get an automigration for the new package. Please migrate when you can.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated @storybook/testing-library@0.2.2: In Storybook 8, this package functionality has been integrated to a new package called @storybook/test, which uses Vitest APIs for an improved experience. When upgrading to Storybook 8 with 'npx storybook@latest upgrade', you will get prompted and will get an automigration for the new package. Please migrate when you can.
npm warn deprecated @storybook/expect@28.1.3-5: In Storybook 8, this package functionality has been integrated to a new package called @storybook/test, which uses Vitest APIs for an improved experience. When upgrading to Storybook 8 with 'npx storybook@latest upgrade', you will get prompted and will get an automigration for the new package. Please migrate when you can.

added 473 packages, and audited 2020 packages in 13s

326 packages are looking for funding
  run `npm fund` for details

8 vulnerabilities (5 moderate, 3 high)

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

 NX   Running targets build, lint, test for 3 projects

   ✖  nx run nx-repo-problem-ui:lint
      Linting "nx-repo-problem-ui"...

      /Users/wizardnet972/code/sandbox/nx-init/nx-repo-problem/apps/nx-repo-problem-ui/.storybook/tsconfig.json
        1:1  error  Expected an assignment or function call and instead saw an expression  @typescript-eslint/no-unused-expressions

      /Users/wizardnet972/code/sandbox/nx-init/nx-repo-problem/apps/nx-repo-problem-ui/project.json
        1:1  error  Expected an assignment or function call and instead saw an expression  @typescript-eslint/no-unused-expressions

      /Users/wizardnet972/code/sandbox/nx-init/nx-repo-problem/apps/nx-repo-problem-ui/tsconfig.app.json
        1:1  error  Expected an assignment or function call and instead saw an expression  @typescript-eslint/no-unused-expressions

      /Users/wizardnet972/code/sandbox/nx-init/nx-repo-problem/apps/nx-repo-problem-ui/tsconfig.editor.json
        1:1  error  Expected an assignment or function call and instead saw an expression  @typescript-eslint/no-unused-expressions

      /Users/wizardnet972/code/sandbox/nx-init/nx-repo-problem/apps/nx-repo-problem-ui/tsconfig.json
        1:1  error  Expected an assignment or function call and instead saw an expression  @typescript-eslint/no-unused-expressions

      /Users/wizardnet972/code/sandbox/nx-init/nx-repo-problem/apps/nx-repo-problem-ui/tsconfig.spec.json
        1:1  error  Expected an assignment or function call and instead saw an expression  @typescript-eslint/no-unused-expressions

      ✖ 6 problems (6 errors, 0 warnings)

      ✖ 6 problems (6 errors, 0 warnings)


   ✔  nx run nx-repo-problem-ui:build:production (3s)
   ✔  nx run ng-lib:test (3s)
   ✔  nx run nx-repo-problem-ui:test (4s)
   ✔  nx run nx-repo-problem-ui-e2e:lint (830ms)
   ✔  nx run ng-lib:build:production (1s)

——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
   ✖  nx run ng-lib:lint
      Linting "ng-lib"...

      /Users/wizardnet972/code/sandbox/nx-init/nx-repo-problem/libs/ng-lib/ng-package.json
        1:1  error  Expected an assignment or function call and instead saw an expression  @typescript-eslint/no-unused-expressions

      /Users/wizardnet972/code/sandbox/nx-init/nx-repo-problem/libs/ng-lib/package.json
        1:1  error  Expected an assignment or function call and instead saw an expression  @typescript-eslint/no-unused-expressions

      /Users/wizardnet972/code/sandbox/nx-init/nx-repo-problem/libs/ng-lib/project.json
        1:1  error  Expected an assignment or function call and instead saw an expression  @typescript-eslint/no-unused-expressions

      /Users/wizardnet972/code/sandbox/nx-init/nx-repo-problem/libs/ng-lib/tsconfig.json
        1:1  error  Expected an assignment or function call and instead saw an expression  @typescript-eslint/no-unused-expressions

      /Users/wizardnet972/code/sandbox/nx-init/nx-repo-problem/libs/ng-lib/tsconfig.lib.json
        1:1  error  Expected an assignment or function call and instead saw an expression  @typescript-eslint/no-unused-expressions

      /Users/wizardnet972/code/sandbox/nx-init/nx-repo-problem/libs/ng-lib/tsconfig.lib.prod.json
        1:1  error  Expected an assignment or function call and instead saw an expression  @typescript-eslint/no-unused-expressions

      /Users/wizardnet972/code/sandbox/nx-init/nx-repo-problem/libs/ng-lib/tsconfig.spec.json
        1:1  error  Expected an assignment or function call and instead saw an expression  @typescript-eslint/no-unused-expressions

      ✖ 7 problems (7 errors, 0 warnings)

      ✖ 7 problems (7 errors, 0 warnings)



——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Ran targets build, lint, test for 3 projects (5s)

   ✔  5/7 succeeded [0 read from cache]

   ✖  2/7 targets failed, including the following:

      - nx run nx-repo-problem-ui:lint
      - nx run ng-lib:lint

 Hint: Try "nx view-logs" to get structured, searchable errors logs in your browser.

Nx Report

yarn run v1.22.22
$ /Users/wizardnet972/code/sandbox/nx-init/nx-repo-problem/node_modules/.bin/nx report

 NX   Report complete - copy this into the issue template

Node           : 22.6.0
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.8.2

nx                 : 19.8.0
@nx/js             : 19.8.0
@nx/jest           : 19.8.0
@nx/linter         : 19.8.0
@nx/eslint         : 19.8.0
@nx/workspace      : 19.8.0
@nx/angular        : 19.8.0
@nx/cypress        : 19.8.0
@nx/devkit         : 19.8.0
@nx/eslint-plugin  : 19.8.0
@nx/playwright     : 19.8.0
@nx/storybook      : 19.8.0
@nrwl/tao          : 19.8.0
@nx/vite           : 19.8.0
@nx/web            : 19.8.0
@nx/webpack        : 19.8.0
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/playwright/plugin
@nx/eslint/plugin
---------------------------------------
Community plugins:
@storybook/angular : 8.3.2

✨  Done in 0.86s.

Failure Logs

No response

Package Manager Version

npm

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

image

jaysoo added a commit that referenced this issue Sep 25, 2024
… TS rules to JSON files (#28102)

This PR fixes an issue with buildable/publishable Angular libs, where TS
rules are being applied to JSON files.

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #28069

---------

Co-authored-by: James Henry <james@henry.sc>
FrozenPandaz pushed a commit that referenced this issue Sep 26, 2024
… TS rules to JSON files (#28102)

This PR fixes an issue with buildable/publishable Angular libs, where TS
rules are being applied to JSON files.

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #28069

---------

Co-authored-by: James Henry <james@henry.sc>
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants