question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prettier formatter does not work out-of-the-box in VSCode 1.38.1 in NX NestJS application

See original GitHub issue

Expected Behavior

When I use the prettier format on a file inside the VSCode editor, it succeeds.

Current Behavior

When I use the prettier format on a file inside the VSCode editor, it throws an error in the output tab of the terminal.

Failure Information (for bugs)

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. npx create-nx-workspace@latest {whatever}
  2. yarn add @nrwl/nest
  3. nx g @nrwl/nest:application
  4. Run prettier on a badly formatted broken-prettier/apps/src/app/app.module.ts in VSCode
  5. Get error:
Failed to load plugin '@nrwl/nx' declared in 'CLIOptions'/Users/aryanjabbari/Documents/Practice/broken-prettier/apps/src/app/app.module.ts:: Cannot find module '@nrwl/eslint-plugin-nx'
Require stack:
- /__placeholder__.js

Context

Please provide any relevant information about your setup:

  • version of Nx used: 8.5.0
  • 3rd-party libraries and their versions package.json:
{
   ...
  "dependencies": {
    "@nestjs/common": "^6.2.4",
    "@nestjs/core": "^6.2.4",
    "@nestjs/platform-express": "^6.2.4",
    "reflect-metadata": "^0.1.12"
  },
  "devDependencies": {
    "@nrwl/workspace": "8.5.0",
    "@types/node": "~8.9.4",
    "dotenv": "6.2.0",
    "eslint": "6.1.0",
    "prettier": "1.16.4",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.4.5",
    "@nrwl/jest": "8.5.0",
    "jest": "24.1.0",
    "@types/jest": "24.0.9",
    "ts-jest": "24.0.0",
    "@nrwl/node": "8.5.0",
    "@nestjs/schematics": "^6.3.0",
    "@nestjs/testing": "^6.2.4",
    "@nrwl/nest": "8.5.0",
    "@nrwl/eslint-plugin-nx": "8.5.0",
    "@typescript-eslint/parser": "2.0.0-alpha.4",
    "@typescript-eslint/eslint-plugin": "2.0.0-alpha.4",
    "eslint-config-prettier": "6.0.0"
  }
}

Failure Logs

Failed to load plugin '@nrwl/nx' declared in 'CLIOptions'/Users/aryanjabbari/Documents/Practice/broken-prettier/apps/src/app/app.module.ts:: Cannot find module '@nrwl/eslint-plugin-nx'
Require stack:
- /__placeholder__.js

Other

VSCode Version: 1.38.1 esbenp.prettier-vscode extension version: 2.2.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
AryanJ-NYCcommented, Sep 18, 2019

https://github.com/prettier/prettier-vscode/issues/672#issuecomment-526467711

I found the solution. VSCode has (had) a prettier.eslint setting that I had turned on (likely from a long, long time ago). It’s only with this eslint config that I’ve run into trouble. Sorry for the trouble and thanks for your time.

0reactions
AryanJ-NYCcommented, Sep 18, 2019

I am running macOS High Sierra, Version 10.13.6.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code formatting with prettier is not working in nest js
Make sure prettier is enabled in VS Code; Check the "prettier" logs (open a terminal, select the "output" tab. next you need to...
Read more >
How to fix Prettier Extension not working issue in VS CODE
0:00 · New! Watch ads now so you can enjoy fewer interruptions. Got it.
Read more >
How to fix Prettier Extension in VS Code - YouTube
I just updated VS Code and my prettier extension (to format all of my code) was not working. I didn't realize how much...
Read more >
Prettier not working in VSCode – possible fixes - LinuxPip
Prettier is an opinionated code formatter very popular in web development. It makes sure your code looks good and easy to read through....
Read more >
Prettier - Code formatter - Visual Studio Marketplace
Settings can also be configured through VS Code - however, these settings will only apply while running the extension, not when running prettier...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found