SmartHR Prettier Config
raw JSON → 1.0.1 verified Sat Apr 25 auth: no javascript
A sharable Prettier configuration package for SmartHR, version 1.0.1, stable. It provides a consistent code formatting standard for SmartHR projects. The config is minimal and intended to be extended. It is part of the tamatebako monorepo alongside eslint-config-smarthr and eslint-plugin-smarthr. Differentiator: official SmartHR config, integrates with the SmartHR toolchain.
Common errors
error Error: Cannot find module 'prettier-config-smarthr' ↓
cause Package not installed or not in node_modules.
fix
Run npm install --save-dev prettier-config-smarthr
error Invalid configuration: Module 'prettier-config-smarthr' was not found. ↓
cause Prettier cannot resolve the config package.
fix
Ensure prettier-config-smarthr is installed and your Prettier config file correctly references it.
Warnings
gotcha Package is CommonJS only, ESM projects need to use a dynamic import or convert to CJS. ↓
fix Use require() or create a wrapper that uses createRequire.
gotcha Do not forget to install Prettier as a dev dependency – this package does not include Prettier. ↓
fix Run npm install --save-dev prettier
Install
npm install prettier-config-smarthr yarn add prettier-config-smarthr pnpm add prettier-config-smarthr Imports
- default wrong
import prettierConfig from 'prettier-config-smarthr'correctmodule.exports = require('prettier-config-smarthr') - prettierConfig wrong
const { prettier } = require('prettier-config-smarthr')correctconst prettierConfig = require('prettier-config-smarthr') - extend in package.json wrong
"prettier": { "extends": "prettier-config-smarthr" }correct"prettier": "prettier-config-smarthr"
Quickstart
const prettierConfig = require('prettier-config-smarthr');
module.exports = {
...prettierConfig,
semi: true,
singleQuote: true
};