Skip to content

Commit 7009d36

Browse files
feat: add team-specific prettier configs
- Add basePrettierOptions (printWidth: 100) for library/base projects - Add reactPrettierOptions (printWidth: 80) for frontend - Add backendPrettierOptions (printWidth: 120, arrowParens: avoid) for backend - Add .prettierrc.js using basePrettierOptions - Update README with prettier config documentation - Format codebase with useTabs: true 🚧 BREAKING CHANGES 🚧
1 parent a1b314b commit 7009d36

18 files changed

+841
-802
lines changed

.commitlintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = {extends: ['@commitlint/config-conventional']}
1+
module.exports = { extends: ['@commitlint/config-conventional'] };

.cz-config.js

Lines changed: 62 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,64 @@
11
module.exports = {
2-
// add additional standard scopes here
3-
scopes: [{name: 'events'}, {name: 'user'}, {name: 'tickets'}],
4-
// use this to permanently skip any questions by listing the message key as a string
5-
skipQuestions: [],
2+
// add additional standard scopes here
3+
scopes: [{ name: 'events' }, { name: 'user' }, { name: 'tickets' }],
4+
// use this to permanently skip any questions by listing the message key as a string
5+
skipQuestions: [],
66

7-
/* DEFAULT CONFIG */
8-
messages: {
9-
type: 'What type of changes are you committing:',
10-
scope: '\nEnlighten us with the scope (optional):',
11-
customScope: 'Add the scope of your liking:',
12-
subject: 'Write a short and simple description of the change:\n',
13-
body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
14-
breaking: 'List any BREAKING CHANGES (optional):\n',
15-
footer: 'List any ISSUES CLOSED by this change (optional). E.g.: #31, #34:\n',
16-
confirmCommit: 'Are you sure you the above looks right?',
17-
},
18-
types: [
19-
{
20-
value: 'fix',
21-
name: '🐛 fix: Changes that fix a bug',
22-
emoji: '🐛',
23-
},
24-
{
25-
value: 'feat',
26-
name: ' 🚀 feat: Changes that introduce a new feature',
27-
emoji: '🚀',
28-
},
29-
{
30-
value: 'refactor',
31-
name: '🔍 refactor: Changes that neither fixes a bug nor adds a feature',
32-
emoji: '🔍',
33-
},
34-
{
35-
value: 'test',
36-
name: '💡 test: Adding missing tests',
37-
emoji: '💡',
38-
},
39-
{
40-
value: 'style',
41-
name:
42-
'💅 style: Changes that do not impact the code base \n (white-space, formatting, missing semi-colons, etc)',
43-
emoji: '💅',
44-
},
45-
{
46-
value: 'docs',
47-
name: '📝 docs: Changes to the docs',
48-
emoji: '📝',
49-
},
50-
{
51-
value: 'chore',
52-
name:
53-
'🤖 chore: Changes to the build process or auxiliary tools\n and or libraries such as auto doc generation',
54-
emoji: '🤖',
55-
},
56-
],
57-
allowTicketNumber: false,
58-
isTicketNumberRequired: false,
59-
ticketNumberPrefix: '#',
60-
ticketNumberRegExp: '\\d{1,5}',
61-
allowCustomScopes: true,
62-
allowBreakingChanges: ['feat', 'fix', 'chore'],
63-
breakingPrefix: '🚧 BREAKING CHANGES 🚧',
64-
footerPrefix: 'CLOSES ISSUE:',
65-
subjectLimit: 100,
66-
}
7+
/* DEFAULT CONFIG */
8+
messages: {
9+
type: 'What type of changes are you committing:',
10+
scope: '\nEnlighten us with the scope (optional):',
11+
customScope: 'Add the scope of your liking:',
12+
subject: 'Write a short and simple description of the change:\n',
13+
body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
14+
breaking: 'List any BREAKING CHANGES (optional):\n',
15+
footer: 'List any ISSUES CLOSED by this change (optional). E.g.: #31, #34:\n',
16+
confirmCommit: 'Are you sure you the above looks right?',
17+
},
18+
types: [
19+
{
20+
value: 'fix',
21+
name: '🐛 fix: Changes that fix a bug',
22+
emoji: '🐛',
23+
},
24+
{
25+
value: 'feat',
26+
name: ' 🚀 feat: Changes that introduce a new feature',
27+
emoji: '🚀',
28+
},
29+
{
30+
value: 'refactor',
31+
name: '🔍 refactor: Changes that neither fixes a bug nor adds a feature',
32+
emoji: '🔍',
33+
},
34+
{
35+
value: 'test',
36+
name: '💡 test: Adding missing tests',
37+
emoji: '💡',
38+
},
39+
{
40+
value: 'style',
41+
name: '💅 style: Changes that do not impact the code base \n (white-space, formatting, missing semi-colons, etc)',
42+
emoji: '💅',
43+
},
44+
{
45+
value: 'docs',
46+
name: '📝 docs: Changes to the docs',
47+
emoji: '📝',
48+
},
49+
{
50+
value: 'chore',
51+
name: '🤖 chore: Changes to the build process or auxiliary tools\n and or libraries such as auto doc generation',
52+
emoji: '🤖',
53+
},
54+
],
55+
allowTicketNumber: false,
56+
isTicketNumberRequired: false,
57+
ticketNumberPrefix: '#',
58+
ticketNumberRegExp: '\\d{1,5}',
59+
allowCustomScopes: true,
60+
allowBreakingChanges: ['feat', 'fix', 'chore'],
61+
breakingPrefix: '🚧 BREAKING CHANGES 🚧',
62+
footerPrefix: 'CLOSES ISSUE:',
63+
subjectLimit: 100,
64+
};

.prettierrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { createJiti } from 'jiti';
2+
3+
const jiti = createJiti(import.meta.url);
4+
const { basePrettierOptions } = jiti('./src/prettier.ts');
5+
6+
export default basePrettierOptions;

.releaserc.json

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
11
{
2-
"branches": [
3-
"master",
4-
{
5-
"name": "next",
6-
"prerelease": true
7-
}
8-
],
9-
"plugins": [
10-
[
11-
"@semantic-release/commit-analyzer",
12-
{
13-
"preset": "angular",
14-
"releaseRules": [
15-
{
16-
"release": "patch",
17-
"type": "chore"
18-
},
19-
{
20-
"release": "patch",
21-
"type": "refactor"
22-
},
23-
{
24-
"release": "patch",
25-
"type": "style"
26-
}
27-
]
28-
}
29-
],
30-
"@semantic-release/release-notes-generator",
31-
[
32-
"@semantic-release/changelog",
33-
{
34-
"changelogFile": "CHANGELOG.md"
35-
}
36-
],
37-
"@semantic-release/npm",
38-
[
39-
"@semantic-release/github",
40-
{
41-
"assets": ["CHANGELOG.md"]
42-
}
43-
]
44-
]
2+
"branches": [
3+
"master",
4+
{
5+
"name": "next",
6+
"prerelease": true
7+
}
8+
],
9+
"plugins": [
10+
[
11+
"@semantic-release/commit-analyzer",
12+
{
13+
"preset": "angular",
14+
"releaseRules": [
15+
{
16+
"release": "patch",
17+
"type": "chore"
18+
},
19+
{
20+
"release": "patch",
21+
"type": "refactor"
22+
},
23+
{
24+
"release": "patch",
25+
"type": "style"
26+
}
27+
]
28+
}
29+
],
30+
"@semantic-release/release-notes-generator",
31+
[
32+
"@semantic-release/changelog",
33+
{
34+
"changelogFile": "CHANGELOG.md"
35+
}
36+
],
37+
"@semantic-release/npm",
38+
[
39+
"@semantic-release/github",
40+
{
41+
"assets": ["CHANGELOG.md"]
42+
}
43+
]
44+
]
4545
}

README.MD

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,33 @@ export default instant({
149149

150150
### Prettier Configuration
151151

152-
The config includes `eslint-config-prettier` to disable conflicting rules. For formatting, use Prettier separately:
152+
This config includes `eslint-config-prettier` to disable ESLint rules that conflict with Prettier. Run Prettier separately for formatting.
153153

154-
**Option 1: Use exported Prettier config**
154+
We export team-specific Prettier configs for use in `.prettierrc.js`:
155155

156-
Create `.prettierrc.js`:
156+
| Preset | `printWidth` | `arrowParens` |
157+
|--------|--------------|---------------|
158+
| Base/Library | 100 | `always` |
159+
| React | 80 | `always` |
160+
| Backend | 120 | `avoid` |
161+
162+
All presets share: `semi: true`, `singleQuote: true`, `tabWidth: 2`, `trailingComma: 'all'`, `useTabs: true`
157163

158164
```javascript
159-
import { prettierConfig } from 'eslint-config-instant/prettier';
160-
export default prettierConfig;
161-
```
165+
// .prettierrc.js
162166

163-
**Option 2: Custom Prettier config**
167+
// For React projects
168+
import { reactPrettierOptions } from 'eslint-config-instant';
169+
export default reactPrettierOptions;
164170

165-
Create your own `.prettierrc.js` with your preferred settings.
171+
// For Backend projects
172+
import { backendPrettierOptions } from 'eslint-config-instant';
173+
export default backendPrettierOptions;
174+
175+
// For Library/Base projects
176+
import { basePrettierOptions } from 'eslint-config-instant';
177+
export default basePrettierOptions;
178+
```
166179

167180
## VS Code Setup
168181

eslint.config.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { instant } from './src/index.js';
22

33
export default instant({
4-
type: 'library',
5-
ignores: [
6-
'dist/**',
7-
'coverage/**',
8-
// Legacy CommonJS config files
9-
'.commitlintrc.js',
10-
'.cz-config.js',
11-
],
4+
type: 'library',
5+
ignores: [
6+
'dist/**',
7+
'coverage/**',
8+
// Legacy CommonJS config files
9+
'.commitlintrc.js',
10+
'.cz-config.js',
11+
],
1212
});

0 commit comments

Comments
 (0)