Trucknet Prettier Config
raw JSON → 2.1.0 verified Sat Apr 25 auth: no javascript
Shared Prettier configuration for all Trucknet projects. Version 2.1.0 is the current stable release, updated on an as-needed basis. It includes Prettier as a dependency to enforce consistent versioning across projects. Key differentiator: simple require-based usage without legacy .prettierrc JSON files; it is a drop-in shared config that ensures all team projects use identical formatting rules, reducing bikeshedding and formatting inconsistencies.
Common errors
error Error: Could not resolve 'prettier-config-trucknet-io' ↓
cause Package not installed or missing from node_modules.
fix
Run 'npm i -D prettier-config-trucknet-io'.
error Error: Cannot find module 'prettier' ↓
cause Prettier is no longer a separate dep since v2; this config includes it, but if user removed it and still has old lockfile, conflict may arise.
fix
Remove old node_modules and package-lock.json, then reinstall: 'rm -rf node_modules package-lock.json && npm install'.
Warnings
gotcha Requires removing any existing .prettierrc or prettier fields from package.json before usage. ↓
fix Delete .prettierrc files and remove 'prettier' from devDependencies before installing this config.
breaking Version 2.0.0 switched from a peer dependency on prettier to a direct dependency; users must update their install commands. ↓
fix Run 'npm remove prettier && npm i -D prettier-config-trucknet-io' to avoid version conflicts.
deprecated Using .prettierrc with JSON format is deprecated in favor of .prettierrc.js for clarity and consistency. ↓
fix Switch to .prettierrc.js with module.exports = require('prettier-config-trucknet-io');
Install
npm install prettier-config-trucknet-io yarn add prettier-config-trucknet-io pnpm add prettier-config-trucknet-io Imports
- default export wrong
module.exports = require('prettier-config-trucknet-io').default;correctmodule.exports = require('prettier-config-trucknet-io'); - default export (ESM) wrong
import { config } from 'prettier-config-trucknet-io';correctimport config from 'prettier-config-trucknet-io'; - extend in .prettierrc (JSON) wrong
"prettier-config-trucknet-io/index"correct"prettier-config-trucknet-io"
Quickstart
// .prettierrc.js
module.exports = require('prettier-config-trucknet-io');
// Then run: npx prettier --check .