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.

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'.
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');
npm install prettier-config-trucknet-io
yarn add prettier-config-trucknet-io
pnpm add prettier-config-trucknet-io

Shows how to set up Prettier with the shared config in a project: create a .prettierrc.js file that requires the config, then run Prettier to check formatting.

// .prettierrc.js
module.exports = require('prettier-config-trucknet-io');

// Then run: npx prettier --check .