Create an Nx Workspace with prettier, husky and lint-staged

InstructorBram Borggreve

Share this video with your friends

Send Tweet

In this lesson we create a new empty Nx Workspace by running `yarn create nx-workspace.

While the installer provides several pre-defined structures, we pick the empty workspace and provide our own structure.

This setup creates a default structure including the files nx.json and workspace.json, which store the project meta data.

Additionally, we have an empty apps and libs folder, where the actual code gets generated.

After looking at the structure, we personalize our prettier configuration and add the husky and lint-staged dev dependencies. Inside package.json we configure the a pre-commit hook in husky and make it execute lint-staged.

To configure lint-stated which we provide a configuration on how to format certain files based on their extension.