Skip to content

Commit

Permalink
prettierx fix space-before-function-paren - babel
Browse files Browse the repository at this point in the history
(babel parser)

discovered through standard.js compat proposal
in prettier#5723

Co-authored-by: Christopher J. Brody <chris.brody@gmail.com>
Co-authored-by: Adam Stankiewicz <sheerun@sher.pl>
  • Loading branch information
Christopher J. Brody and sheerun committed Jan 6, 2019
1 parent b39fff3 commit 8e632b5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/language-js/printer-estree.js
Original file line number Diff line number Diff line change
Expand Up @@ -4272,6 +4272,9 @@ function printObjectMethod(path, options, print) {
parts.push("[", key, "]");
} else {
parts.push(key);
if (options.spaceBeforeFunctionParen) {
parts.push(" ");
}
}

parts.push(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`eslint.js 1`] = `
====================================options=====================================
parsers: ["flow", "typescript"]
parsers: ["babel", "flow", "typescript"]
printWidth: 80
spaceBeforeFunctionParen: true
| printWidth
Expand Down Expand Up @@ -77,7 +77,7 @@ var foo = async () => 1;

exports[`eslint.js 2`] = `
====================================options=====================================
parsers: ["flow", "typescript"]
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand Down
4 changes: 2 additions & 2 deletions tests/space-before-function-paren/eslint-compat/jsfmt.spec.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
run_spec(__dirname, ["flow", "typescript"], { spaceBeforeFunctionParen: true });
run_spec(__dirname, ["flow", "typescript"]);
run_spec(__dirname, ["babel", "flow", "typescript"], { spaceBeforeFunctionParen: true });
run_spec(__dirname, ["babel", "flow", "typescript"]);

0 comments on commit 8e632b5

Please sign in to comment.