Consolidate Prettier config and improve consistency#15191
Conversation
- Add 'eol-last': ['error', 'always'] to ESLint configs - Change Prettier endOfLine from 'auto' to 'lf' - Run lint --fix to apply consistent-type-imports fixes This ensures all code files end with a newline character, following POSIX standards and preventing .env concatenation issues.
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
This PR implements ESLint enforcement of trailing newlines across the codebase by adding the 'eol-last': ['error', 'always'] rule to both base and React ESLint configurations. The changes ensure all text files end with a newline character, following POSIX standards. The PR also updates Prettier's endOfLine setting from 'auto' to 'lf' for consistent Unix-style line endings. Most modifications are automatic fixes that convert regular TypeScript imports to type-only imports (e.g., RuleContext → type RuleContext) and add missing trailing newlines to files. This systematic approach improves tooling compatibility, prevents shell concatenation issues, and ensures cleaner git diffs across the entire codebase.
Important Files Changed
Changed Files
| Filename | Score | Overview |
|---|---|---|
| eslint.config.mjs | 5/5 | Added 'eol-last': ['error', 'always'] rule to base ESLint configuration |
| eslint.config.react.mjs | 5/5 | Added 'eol-last': ['error', 'always'] rule to React ESLint configuration |
| .prettierrc | 4/5 | Changed endOfLine from 'auto' to 'lf' but file itself lacks trailing newline |
| tools/eslint-rules/rules/matching-state-variable.ts | 4/5 | Added type import and trailing newline, but has inconsistent error message data properties |
| tools/eslint-rules/rules/component-props-naming.ts | 5/5 | Converted RuleContext import to type-only import |
| tools/eslint-rules/rules/effect-components.ts | 5/5 | Converted TSESTree and RuleContext to type-only imports |
| tools/eslint-rules/rules/explicit-boolean-predicates-in-if.ts | 5/5 | Converted TSESTree import to type-only import |
| tools/eslint-rules/rules/graphql-resolvers-should-be-guarded.ts | 5/5 | Added missing trailing newline to ESLint rule file |
| tools/eslint-rules/rules/graphql-resolvers-should-be-guarded.spec.ts | 5/5 | Added missing trailing newline to test specification file |
| tools/eslint-rules/rules/max-consts-per-file.ts | 5/5 | Converted TSESTree import to type-only import |
| tools/eslint-rules/rules/no-navigate-prefer-link.ts | 5/5 | Converted TSESTree import to type-only import |
| tools/eslint-rules/rules/rest-api-methods-should-be-guarded.ts | 5/5 | Added missing trailing newline to ESLint rule file |
| tools/eslint-rules/rules/rest-api-methods-should-be-guarded.spec.ts | 5/5 | Added missing trailing newline to test specification file |
| tools/eslint-rules/rules/sort-css-properties-alphabetically.ts | 5/5 | Converted multiple types to type-only imports |
| tools/eslint-rules/utils/createRule.ts | 5/5 | Added missing trailing newline to utility file |
| tools/eslint-rules/utils/typedTokenHelpers.ts | 5/5 | Added missing trailing newline to utility file |
Confidence score: 4/5
- This PR is safe to merge with only one minor inconsistency needing attention
- Score reflects clean implementation of POSIX standards with mostly automated fixes, but points deducted for
.prettierrcnot following its own rule and one inconsistent error message pattern - Pay close attention to
.prettierrc(missing trailing newline) andtools/eslint-rules/rules/matching-state-variable.ts(inconsistent error message data properties)
Sequence Diagram
sequenceDiagram
participant User
Additional Comments (1)
-
tools/eslint-rules/rules/matching-state-variable.ts, line 94-97 (link)logic: Inconsistent data property names: uses
actual/expectedinstead ofactualName/expectedNamelike other error reports in this file
Context used:
- Context from
dashboard- Use 'type' instead of 'interface' for type definitions in the project. (source)
16 files reviewed, 2 comments
.prettierrc
Outdated
| "trailingComma": "all", | ||
| "endOfLine": "auto" | ||
| "endOfLine": "lf" | ||
| } No newline at end of file |
There was a problem hiding this comment.
logic: This file is missing a trailing newline, which contradicts the PR's goal of enforcing trailing newlines via ESLint. The ESLint rule 'eol-last': ['error', 'always'] should apply to this file.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .prettierrc
Line: 5:5
Comment:
**logic:** This file is missing a trailing newline, which contradicts the PR's goal of enforcing trailing newlines via ESLint. The ESLint rule `'eol-last': ['error', 'always']` should apply to this file.
How can I resolve this? If you propose a fix, please make it concise.- Remove redundant package-level .prettierrc files (twenty-server, twenty-zapier) - Prettier automatically searches up directory tree, so root config is sufficient - Fix twenty-server/.prettierrc typo: 'brakeBeforeElse' (invalid option) - Change .prettierrc endOfLine from 'auto' to 'lf' for consistency - Update .vscode/settings.json: - files.eol: 'auto' → '\n' (consistent with Prettier) - Add files.insertFinalNewline: true - Add files.trimTrailingWhitespace: true - Fix 3 files with CRLF line endings in selectable-list states Result: Single source of truth for Prettier config, consistent line endings.
- Enforce LF line endings for all text files - Prevent Git autocrlf from converting line endings based on OS - Mark patch files as binary to preserve mixed line endings - Explicitly mark binary file types This prevents CRLF files from entering the repo regardless of contributor's Git config or operating system.
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:27741 This environment will automatically shut down when the PR is closed or after 5 hours. |
Summary
Clean up and consolidate formatting configuration across the monorepo.
Changes
1. Remove Redundant Configs
packages/twenty-server/.prettierrc(had invalidbrakeBeforeElsetypo)packages/twenty-zapier/.prettierrc.prettierrconly (Prettier searches up directory tree automatically)2. Improve Root Prettier Config
endOfLine: 'auto'→'lf'for consistent Unix line endings across all OSes3. Enhance VSCode Settings
files.eol: 'auto'→'\\n'(consistent with Prettier)files.insertFinalNewline: true(explicit editor behavior)files.trimTrailingWhitespace: true(cleaner files)4. Add
.gitattributescore.autocrlffrom converting based on contributor's OS5. Fix Line Endings
Why These Changes Matter
Before:
After:
Result
.prettierrcconfig