Codux Help Center
Browse our articles to find the answers you need
Using Prettier to Format Code
Prettier is a code formatting tool that makes your code more readable, consistent, and easier to maintain. It takes messy, unformatted code and formats it in an aesthetically pleasing manner while also keeping the structure intact. You can even use it as a linter!
If you have a Prettier config file in your project, Codux will format code files based on the preferences configured inside it when you make changes to the file or format it. For example, code shown in the code drawer in Codux and files opened through the Files panel will show things like indentation size, line length limit, quote strings, trailing commas, end-of-line characters, and so on, based on Prettier configuration.
Note:
Codux initially looks for a
.prettierrc
file in your project, and applies its configurations if found. In the event that a .prettierrc
file is not found, Codux defaults to the standard TypeScript formatter settings as a fallback.Use Prettier in Your Project
To use Prettier in your project, add a
.prettierrc
file to the root of your project (or to the package root of a monorepo). You can also add a .prettierignore
file if you want to ignore (and not format) certain files and folders. Refer here to read about configuring the file in the Prettier docs.You'll see your changes take effect after you make changes to a file, or format the document via the right-click menu option or prettier button at the bottom right of the code drawer.
Was this article helpful?