@@ -43,19 +43,30 @@ Alternatively, you can create a Prettier configuration file (e.g., `.prettierrc.
4343
4444** ` .prettierrc.js ` (or ` prettier.config.js ` )**
4545
46- This package exports both CommonJS (CJS) and ES Module (ESM) formats. You can import it accordingly:
46+ This package exports both CommonJS (CJS) and ES Module (ESM) formats. Choose the appropriate example based on your project's module system:
47+
48+ > ** Note** : You can also use ` prettier.config.cjs ` to force CommonJS format even in projects with ` "type": "module" ` in package.json.
49+
50+ For CommonJS (` .js ` files without ` "type": "module" ` in package.json):
4751
4852``` javascript
49- // For CommonJS (e.g., if your prettier.config.js is a .js file treated as CJS)
50- // const prettierConfigReact = require('@tcd-devkit/prettier-config-react');
53+ const prettierConfigReact = require (' @tcd-devkit/prettier-config-react' );
54+
55+ module .exports = {
56+ ... prettierConfigReact,
57+ // Your custom overrides can be added here
58+ // For example, if you have custom Tailwind settings:
59+ // tailwindConfig: './tailwind.config.js',
60+ };
61+ ```
5162
52- // For ES Modules (e.g., if your prettier.config.js is a .mjs file or package.json has "type": "module")
53- // import prettierConfigReact from '@tcd-devkit/prettier-config-react';
63+ For ES Modules (` .mjs ` files or ` .js ` files with ` "type": "module" ` in package.json):
64+
65+ ``` javascript
66+ import prettierConfigReact from ' @tcd-devkit/prettier-config-react' ;
5467
55- // Then spread the imported config:
5668export default {
57- // ...prettierConfigReact, // Choose one of the import methods above
58- ... require (' @tcd-devkit/prettier-config-react' ), // Defaulting to require for wider compatibility in basic .js files
69+ ... prettierConfigReact,
5970 // Your custom overrides can be added here
6071 // For example, if you have custom Tailwind settings:
6172 // tailwindConfig: './tailwind.config.js',
0 commit comments