visual-studio-codeprettierprettier-vscode

The prettier extension will use 'node_modules/prettier/index.js' for validation


I have Prettier extension installed in my VS Code. Up until the last update everything worked fine, and now I am prompted with this question:

The Prettier extension will use 'node_modules/prettier/index.js' for validation, which is installed locally in folder 'my_project_folder'. Do you allow the execution of the Prettier version including all plugins and configuration files it will load on your behalf?

Press 'Allow Everywhere' to remember the choice for all workspaces.

If I decline it, the Prettier formatting will not work. Why am I prompted with this since I have Prettier installed as an Extension and not as npm package?


Solution

  • it is the VS Code extension and not some npm package?

    The opposite is true. Prettier is not a VS Code extension. The extension is a bridge (integration) between your editor and the Prettier package installed in the project. In different projects, different versions of Prettier are installed, so to make sure all the collaborators get the same formatting, the local version must always be used. On the other hand, running code from node_modules in VS Code is a certain security risk (e.g., think of a malicious fork of Prettier), so the extension makes the user aware of that. You didn't see this prompt before because it has been added recently.