Skip to content

Commit 44aee86

Browse files
authored
Consolidate Prettier config and improve consistency (#15191)
## Summary Clean up and consolidate formatting configuration across the monorepo. ## Changes ### 1. Remove Redundant Configs - ❌ Delete `packages/twenty-server/.prettierrc` (had invalid `brakeBeforeElse` typo) - ❌ Delete `packages/twenty-zapier/.prettierrc` - ✅ Use root `.prettierrc` only (Prettier searches up directory tree automatically) ### 2. Improve Root Prettier Config - Change `endOfLine: 'auto'` → `'lf'` for consistent Unix line endings across all OSes ### 3. Enhance VSCode Settings - `files.eol: 'auto'` → `'\\n'` (consistent with Prettier) - Add `files.insertFinalNewline: true` (explicit editor behavior) - Add `files.trimTrailingWhitespace: true` (cleaner files) ### 4. Add `.gitattributes` - Enforce LF line endings at Git level - Prevents `core.autocrlf` from converting based on contributor's OS - Mark patch files as binary (they have mixed line endings by design) - Explicitly define binary file types ### 5. Fix Line Endings - Convert 3 selectable-list state files from CRLF → LF - These were the only source files with Windows line endings ## Why These Changes Matter **Before:** - 3 different Prettier configs (inconsistent, one had typo) - Mixed CRLF/LF depending on contributor's OS - No Git-level enforcement **After:** - Single source of truth for formatting - All files use LF (Unix standard) - Git enforces line endings regardless of OS - Prettier warning about invalid option removed ## Result - ✅ Single `.prettierrc` config - ✅ Consistent LF line endings enforced by Git - ✅ Better VSCode defaults - ✅ No more CRLF files sneaking in from Windows contributors
1 parent d76abef commit 44aee86

21 files changed

+80
-59
lines changed

.gitattributes

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
* text=auto eol=lf
2+
3+
*.ts text eol=lf
4+
*.tsx text eol=lf
5+
*.js text eol=lf
6+
*.jsx text eol=lf
7+
*.json text eol=lf
8+
*.md text eol=lf
9+
*.yml text eol=lf
10+
*.yaml text eol=lf
11+
*.sh text eol=lf
12+
*.mjs text eol=lf
13+
*.cjs text eol=lf
14+
15+
# Patch files may have mixed line endings by design
16+
*.patch -text
17+
18+
*.png binary
19+
*.jpg binary
20+
*.jpeg binary
21+
*.gif binary
22+
*.ico binary
23+
*.svg binary
24+
*.woff binary
25+
*.woff2 binary
26+
*.ttf binary
27+
*.eot binary
28+

.prettierrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"singleQuote": true,
33
"trailingComma": "all",
4-
"endOfLine": "auto"
5-
}
4+
"endOfLine": "lf"
5+
}

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"editor.formatOnSave": false,
3-
"files.eol": "auto",
3+
"files.eol": "\n",
4+
"files.insertFinalNewline": true,
5+
"files.trimTrailingWhitespace": true,
46
"[typescript]": {
57
"editor.formatOnSave": false,
68
"editor.codeActionsOnSave": {
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext';
2-
import { createComponentFamilyState } from '@/ui/utilities/state/component-state/utils/createComponentFamilyState';
3-
4-
export const isSelectedItemIdComponentFamilyState = createComponentFamilyState<
5-
boolean,
6-
string
7-
>({
8-
key: 'isSelectedItemIdComponentFamilyState',
9-
defaultValue: false,
10-
componentInstanceContext: SelectableListComponentInstanceContext,
11-
});
1+
import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext';
2+
import { createComponentFamilyState } from '@/ui/utilities/state/component-state/utils/createComponentFamilyState';
3+
4+
export const isSelectedItemIdComponentFamilyState = createComponentFamilyState<
5+
boolean,
6+
string
7+
>({
8+
key: 'isSelectedItemIdComponentFamilyState',
9+
defaultValue: false,
10+
componentInstanceContext: SelectableListComponentInstanceContext,
11+
});
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext';
2-
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
3-
4-
export const selectableItemIdsComponentState = createComponentState<string[][]>(
5-
{
6-
key: 'selectableItemIdsComponentState',
7-
defaultValue: [[]],
8-
componentInstanceContext: SelectableListComponentInstanceContext,
9-
},
10-
);
1+
import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext';
2+
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
3+
4+
export const selectableItemIdsComponentState = createComponentState<string[][]>(
5+
{
6+
key: 'selectableItemIdsComponentState',
7+
defaultValue: [[]],
8+
componentInstanceContext: SelectableListComponentInstanceContext,
9+
},
10+
);
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext';
2-
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
3-
4-
export const selectedItemIdComponentState = createComponentState<string | null>(
5-
{
6-
key: 'selectedItemIdComponentState',
7-
defaultValue: null,
8-
componentInstanceContext: SelectableListComponentInstanceContext,
9-
},
10-
);
1+
import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext';
2+
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
3+
4+
export const selectedItemIdComponentState = createComponentState<string | null>(
5+
{
6+
key: 'selectedItemIdComponentState',
7+
defaultValue: null,
8+
componentInstanceContext: SelectableListComponentInstanceContext,
9+
},
10+
);

packages/twenty-server/.prettierrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/twenty-zapier/.prettierrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

tools/eslint-rules/rules/component-props-naming.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
isIdentifier,
44
isVariableDeclarator,
55
} from '@typescript-eslint/utils/ast-utils';
6-
import { RuleContext } from '@typescript-eslint/utils/ts-eslint';
6+
import { type RuleContext } from '@typescript-eslint/utils/ts-eslint';
77

88
// NOTE: The rule will be available in ESLint configs as "@nx/workspace-component-props-naming"
99
export const RULE_NAME = 'component-props-naming';

tools/eslint-rules/rules/effect-components.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { ESLintUtils, TSESTree } from '@typescript-eslint/utils';
1+
import { ESLintUtils, type TSESTree } from '@typescript-eslint/utils';
22
import {
33
isIdentifier,
44
isVariableDeclarator,
55
} from '@typescript-eslint/utils/ast-utils';
6-
import { RuleContext } from '@typescript-eslint/utils/ts-eslint';
6+
import { type RuleContext } from '@typescript-eslint/utils/ts-eslint';
77

88
// NOTE: The rule will be available in ESLint configs as "@nx/workspace-effect-components"
99
export const RULE_NAME = 'effect-components';

0 commit comments

Comments
 (0)