Fix prettier↔eslint config drift on comma-dangle functions#57
Closed
senoff wants to merge 3 commits into
Closed
Conversation
The two formatter configs were in direct conflict:
- .prettierrc had "trailingComma": "all" → adds trailing commas on
every multi-line construct, including function call arguments
- .eslintrc had "comma-dangle": {"functions": "never"} → rejects
trailing commas on function calls/declarations
The lint-staged hook runs prettier first, then eslint. Any commit
touching a file with pre-existing multi-line function calls would
get a trailing comma injected by prettier and then immediately
rejected by eslint — even if the actual change was unrelated. This
forced drive-by workarounds across prior PRs (collapsing multi-line
function constructs to single-line just to dodge the hook).
Resolution: change .prettierrc to "trailingComma": "es5".
This matches eslint's intent — trailing commas on objects and
arrays (es5-valid), but NOT on function calls or declarations.
The eslint comma-dangle config is left untouched (lower-risk).
Two secondary conflicts in .eslintrc were also fixed:
1. space-before-function-paren (anonymous: "never"): prettier
normalizes anonymous functions to "function ()" with a space;
eslint enforced no space. Changed anonymous to "ignore" so
prettier controls the style without eslint rejecting it.
2. quotes ("single"): prettier uses double quotes for strings
containing a single quote (to avoid escaping); eslint required
single quotes unconditionally. Added "avoidEscape": true to the
quotes rule to match prettier's behavior.
3. import/extensions: disabled. CommonJS require() patterns in
this codebase include .js extensions, which the rule incorrectly
flags. Rule was never passing cleanly in test/spec files.
4. max-len: added ignoreTemplateLiterals: true to match the intent
of the existing ignoreStrings option.
Codebase normalization: ran "npx prettier --write ." after the
config changes to bring all files into the new consistent state.
All changes are purely cosmetic (quote style, bracket spacing,
line wrapping). No behavior was altered.
Test result: 884 + 200 + 1 passing, 0 failing (mocha unit +
integration + end-to-end suites green).
This reverts commit 3b96b9a.
This was referenced May 2, 2026
Author
|
Local test run on this branch —
No regressions vs baseline. Skipped Posted because the |
Author
|
Regenerated per AGENTS.md guidance — see new PR #69. Closing this one in favor of the regenerated version. |
This was referenced May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
prettierandeslintconfigs were in direct conflict, causing the lint-staged pre-commit hook to fail on innocuous commits:.prettierrchad"trailingComma": "all"→ adds trailing commas to every multi-line construct, including function call arguments.eslintrchad"comma-dangle": {"functions": "never"}→ rejects trailing commas on function calls/declarationsThe hook runs prettier first, then eslint. Any commit touching a file with pre-existing multi-line function calls would get a trailing comma injected by prettier, then immediately rejected by eslint — even when the actual change was completely unrelated. The only workaround was collapsing multi-line function constructs to single-line to dodge the hook.
Three additional secondary conflicts were also present:
space-before-function-paren (anonymous: "never"): prettier normalizes anonymous functions tofunction ()(with space); eslint required no spacequotes ("single"): prettier uses double quotes for strings containing a single quote (to avoid escaping); eslint required single quotes unconditionallyimport/extensions: CommonJSrequire()patterns in test/spec files include.jsextensions, which the rule incorrectly flagged — it was never passing cleanlyFix
.prettierrc: Change"trailingComma"from"all"to"es5". This matches eslint's intent — trailing commas on objects and arrays (es5-valid), but NOT on function calls/declarations. Thecomma-dangleeslint rule is left untouched (changing the prettier config is lower-risk)..eslintrc(secondary fixes):space-before-function-paren: setanonymousfrom"never"to"ignore"so prettier controls the stylequotes: add"avoidEscape": trueto allow double quotes when a string contains a single quote (matches prettier's behavior)import/extensions: set to"off"— this rule doesn't apply meaningfully to a CommonJS Node.js projectmax-len: addignoreTemplateLiterals: trueto match the intent of the existingignoreStringsoptionAlternative considered: changing the
eslint comma-dangle functionsrule from"never"to"all"instead of changing prettier. Rejected because it would require adding trailing commas to all existing function calls across the codebase — a much larger diff with higher review burden for upstream.Normalization
Ran
npx prettier --write .after the config changes to bring all files into the new consistent state. All changes are purely cosmetic (quote normalization, bracket spacing, line wrapping). No behavior was altered.Testing
npm run test:unit: 884 passing, 0 failingnpm run test:integration: 200 passing, 0 failingnpm run test:end-to-end: 1 passing, 0 failing--no-verifyVerification
Post-merge, contributors can verify by making any small change to a file with multi-line function calls and confirming the hook no longer fails.