forked from prettier/prettier
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prettierx space-before-function-paren option (#6)
ported (largely reimplemented) from prettier-miscellaneous (arijs#22) with ES test moved to eslint-compat subdirectory; test space-before-function-paren with real member function; test coverage added for space-before-function-paren not enabled; configuration & documentation according to new prettier format; tslint-compat test to cover use of TypeScript generics; issue with TypeScript generics resolved; and space-before-function-paren option added to README.md. Co-authored-by: Christopher J. Brody <chris.brody@gmail.com> Co-authored-by: Joseph Frazier <1212jtraceur@gmail.com> Co-authored-by: Rafael Hengles <rafael@hengles.net> Co-authored-by: Ika <ikatyang@gmail.com> Co-authored-by: Lucas Azzola <derflatulator@gmail.com>
- Loading branch information
1 parent
d7532ef
commit 828aab3
Showing
14 changed files
with
533 additions
and
4 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
150 changes: 150 additions & 0 deletions
150
tests/space-before-function-paren/eslint-compat/__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,150 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`eslint.js 1`] = ` | ||
====================================options===================================== | ||
parsers: ["flow", "typescript"] | ||
printWidth: 80 | ||
spaceBeforeFunctionParen: true | ||
| printWidth | ||
=====================================input====================================== | ||
/*eslint space-before-function-paren: "error"*/ | ||
/*eslint-env es6*/ | ||
function foo() { | ||
// ... | ||
} | ||
var bar = function() { | ||
// ... | ||
}; | ||
var bar = function foo() { | ||
// ... | ||
}; | ||
class Foo { | ||
constructor() { | ||
// ... | ||
} | ||
bar() { | ||
// ... | ||
} | ||
} | ||
var foo = { | ||
bar() { | ||
// ... | ||
} | ||
}; | ||
var foo = async() => 1 | ||
=====================================output===================================== | ||
/*eslint space-before-function-paren: "error"*/ | ||
/*eslint-env es6*/ | ||
function foo () { | ||
// ... | ||
} | ||
var bar = function () { | ||
// ... | ||
}; | ||
var bar = function foo () { | ||
// ... | ||
}; | ||
class Foo { | ||
constructor () { | ||
// ... | ||
} | ||
bar () { | ||
// ... | ||
} | ||
} | ||
var foo = { | ||
bar () { | ||
// ... | ||
} | ||
}; | ||
var foo = async () => 1; | ||
================================================================================ | ||
`; | ||
|
||
exports[`eslint.js 2`] = ` | ||
====================================options===================================== | ||
parsers: ["flow", "typescript"] | ||
printWidth: 80 | ||
| printWidth | ||
=====================================input====================================== | ||
/*eslint space-before-function-paren: "error"*/ | ||
/*eslint-env es6*/ | ||
function foo() { | ||
// ... | ||
} | ||
var bar = function() { | ||
// ... | ||
}; | ||
var bar = function foo() { | ||
// ... | ||
}; | ||
class Foo { | ||
constructor() { | ||
// ... | ||
} | ||
bar() { | ||
// ... | ||
} | ||
} | ||
var foo = { | ||
bar() { | ||
// ... | ||
} | ||
}; | ||
var foo = async() => 1 | ||
=====================================output===================================== | ||
/*eslint space-before-function-paren: "error"*/ | ||
/*eslint-env es6*/ | ||
function foo() { | ||
// ... | ||
} | ||
var bar = function() { | ||
// ... | ||
}; | ||
var bar = function foo() { | ||
// ... | ||
}; | ||
class Foo { | ||
constructor() { | ||
// ... | ||
} | ||
bar() { | ||
// ... | ||
} | ||
} | ||
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,31 @@ | ||
/*eslint space-before-function-paren: "error"*/ | ||
/*eslint-env es6*/ | ||
|
||
function foo() { | ||
// ... | ||
} | ||
|
||
var bar = function() { | ||
// ... | ||
}; | ||
|
||
var bar = function foo() { | ||
// ... | ||
}; | ||
|
||
class Foo { | ||
constructor() { | ||
// ... | ||
} | ||
bar() { | ||
// ... | ||
} | ||
} | ||
|
||
var foo = { | ||
bar() { | ||
// ... | ||
} | ||
}; | ||
|
||
var foo = async() => 1 |
2 changes: 2 additions & 0 deletions
2
tests/space-before-function-paren/eslint-compat/jsfmt.spec.js
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,2 @@ | ||
run_spec(__dirname, ["flow", "typescript"], { spaceBeforeFunctionParen: true }); | ||
run_spec(__dirname, ["flow", "typescript"]); |
Oops, something went wrong.