Prettier-vscode: with-node-modules

Created on 20 Nov 2019  路  11Comments  路  Source: prettier/prettier-vscode

I want to format the javascript file in /node_modules, prettier ignores the formatting. How to do it? Wanted to apply --with-node-modules, but don't know how

enhancement help wanted locked

Most helpful comment

Fixed in #1268

All 11 comments

This isn't a flag that is exposed through the VS Code extension. This doesn't seem like something that is common enough to justify putting in the extension.

Please reopen if you have a strong opinion on this, but I think using the CLI is a valid work around.

Hey, turns out it might be useful if working with nested node_modules folder. Assuming .gitignore looks something like this and we use it as .prettierignore:

/node_modules
!/src/node_modules

prettier.getFileInfo is going to always return ignored: true if withNodeModules option is false. Providing withNodeModules: true correctly ignores files in the root node_modules folder and allows formatting in /src/node_modules.

I'm open to accepting a pull request with this feature.

Any momentum on this?

Need it too

btw, @sin-raben VSCode Beautify plugin may be worth your attention

As an interim solution I'd suggest to edit extension directly in the extensions folder: in dist/extension.js search for getFileInfo( and add withNodeModules: true there 馃し鈥嶁檪

thanks for the advice

Fixed in #1268

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bluemoehre picture bluemoehre  路  3Comments

SkeLLLa picture SkeLLLa  路  4Comments

GantMan picture GantMan  路  3Comments

mshehadeh picture mshehadeh  路  4Comments

bardware picture bardware  路  4Comments