0.1.5 • Published 5 years ago
@illumini/prettier-config v0.1.5
prettier-config
This package provides Illumini's base prettier configuration.
Pairs well with our ESLint configuration.
Table of Contents
Installation
npm
npm install --save-dev @illumini/prettier-configIf you don't have it installed already, also install prettier as a devDependency.
npm install --save-dev prettieryarn
yarn add --dev @illumini/prettier-config prettierConfigurations
We export one ESLint configuration for your usage:
Default Config
Create a prettier.config.js file at the root of your project that contains:
module.exports = require('@illumini/prettier-config');Editor Integration & Autoformatting
VS Code
- Install Prettier extension:
View → Extensionsthen find and install Prettier - Code formatter - Reload the editor
In your VS Code user settings
Code/File → Preferences → SettingsorCMD/CTRL + ,click the{}icon in the top right corner to modify yoursettings.jsonfile// Format on save with Prettier rules "editor.formatOnSave": true,
Pre-commit Hook
As another line of defence, if you want ESLint to automatically fix your errors on commit, you can use lint-staged with husky, which manages git hooks.
npm install --save-dev lint-staged huskyIn your
package.json:{ "lint-staged": { "*.js": ["eslint --fix"] }, "husky": { "hooks": { "pre-commit": "lint-staged" } } }
Publishing to npm
Read npm's docs on How to Update a Package.
npm login- Make sure you're logged into illumini's npm account with the credentials from 1pass.
npm whoamiwill tell you if you're already logged in.
- Make sure you're logged into illumini's npm account with the credentials from 1pass.
npm version <update_type>update_typecan bepatch,minor, ormajor. If you don't know which one to use, go read about semantic versioning.
npm publish