This extension requires
prettier-eslint:^10.1.0 packages to be installed either locally or globally.
Error: Cannot find module 'prettier' OR Error: Cannot find module 'eslint'
- Quit Visual Studio Code
- Open terminal and run
rm -rf node_modules to erase your local
npm install or
yarn install to reinstall your
- Install Prettier and ESLint locally
Please create an issue before adding a rating. I am the only contributor currently. https://gitlab.com/idahogurl/vs-code-prettier-eslint/issues
The extension uses your ESLint and Prettier configuration files. These files are resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn't) found.
ESLint Configuration File
.eslintrc.* file or an
eslintConfig field in a
Prettier Configuration File
Prettier uses cosmiconfig for configuration file support. This means you can configure prettier via (in order of precedence):
"prettier" key in your
.prettierrc file, written in JSON or YAML, with optional extensions:
.json/.yaml/.yml (without extension takes precedence).
prettier.config.js file that exports an object.
.prettierrc.toml file, written in TOML (the
.toml extension is required).
CTRL + CMD + P (macOS) or
CTRL + Shift + P (Windows/Linux) to format a file or a selection of code.
You can enable the
Format on Save setting to avoid entering the command all the time.
- Open the file you want to format
CTRL + SHIFT + P (Windows/Linux) or
CMD + SHIFT + P (macOS) to open the command palette
- Start typing
Format Document With and select it
- Choose the bottom item
Configure Default Formatter
Setup Format on Save
Prettier Eslint as the default formatter as detailed above
- Open User or Workspace settings
- On Windows/Linux - File > Preferences > Settings
- On macOS - Code > Preferences > Settings
- Start typing
Format on and select it
Format on Save (found mid-page in the right panel)
- Ensure both
Format on Input and
Format on Paste are disabled. They are not supported functionality
- Afterward, the file should format automatically once you save it
If you have suggestions for how this extension could be improved, or want to report a bug, open an issue! I'd love all and any contributions. If you are interested in contributing to the project, check out the Contributing Guide.
Current Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!