forked from prettier/prettier
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add --space-before-function-paren option (#22)
* Add test demonstrating behavior on eslint space-before-function-paren sample code * Add --space-before-function-paren option This corresponds to ESLint's `space-before-function-paren` "always" option: http://eslint.org/docs/rules/space-before-function-paren#always See prettier#1139 * Document --space-before-function-paren option
- Loading branch information
1 parent
ec98ca6
commit a93175c
Showing
7 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
62 changes: 62 additions & 0 deletions
62
tests/space-before-function-paren/__snapshots__/jsfmt.spec.js.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`eslint.js 1`] = ` | ||
/*eslint space-before-function-paren: "error"*/ | ||
/*eslint-env es6*/ | ||
function foo() { | ||
// ... | ||
} | ||
var bar = function() { | ||
// ... | ||
}; | ||
var bar = function foo() { | ||
// ... | ||
}; | ||
class Foo { | ||
constructor() { | ||
// ... | ||
} | ||
} | ||
var foo = { | ||
bar() { | ||
// ... | ||
} | ||
}; | ||
var foo = async() => 1 | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
/*eslint space-before-function-paren: "error"*/ | ||
/*eslint-env es6*/ | ||
function foo () { | ||
// ... | ||
} | ||
var bar = function () { | ||
// ... | ||
}; | ||
var bar = function foo () { | ||
// ... | ||
}; | ||
class Foo { | ||
constructor () { | ||
// ... | ||
} | ||
} | ||
var foo = { | ||
bar () { | ||
// ... | ||
} | ||
}; | ||
var foo = async () => 1; | ||
`; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/*eslint space-before-function-paren: "error"*/ | ||
/*eslint-env es6*/ | ||
|
||
function foo() { | ||
// ... | ||
} | ||
|
||
var bar = function() { | ||
// ... | ||
}; | ||
|
||
var bar = function foo() { | ||
// ... | ||
}; | ||
|
||
class Foo { | ||
constructor() { | ||
// ... | ||
} | ||
} | ||
|
||
var foo = { | ||
bar() { | ||
// ... | ||
} | ||
}; | ||
|
||
var foo = async() => 1 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
run_spec(__dirname, { spaceBeforeFunctionParen: true }, [ | ||
"babylon", | ||
"typescript" | ||
]); |