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.
corresponding to eslint generator-star-spacing option tested with and without space-before-function-paren enabled as needed for consistency with standard & semistandard based on proposal in prettier#5723 Co-authored-by: Christopher J. Brody <chris.brody@gmail.com> Co-authored-by: Adam Stankiewicz <sheerun@sher.pl> 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
707da6f
commit 39b01ee
Showing
13 changed files
with
243 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
147 changes: 147 additions & 0 deletions
147
tests/generator-star-spacing/__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,147 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`correct.js 1`] = ` | ||
====================================options===================================== | ||
generatorStarSpacing: true | ||
parsers: ["babel", "flow", "typescript"] | ||
printWidth: 80 | ||
| printWidth | ||
=====================================input====================================== | ||
// correct for: | ||
// * "generator-star-spacing": [ "error", { "before": true, "after": true } ], | ||
// but *not* for the following standard.js rules: | ||
// * "space-before-function-paren": [ "error", "always" ], | ||
// * "semi": [ "error", "never" ], | ||
function * generator() {} | ||
var anonymous = function * () {}; | ||
var shorthand = { * generator() {} }; | ||
class Example { | ||
async * foo() {} | ||
} | ||
=====================================output===================================== | ||
// correct for: | ||
// * "generator-star-spacing": [ "error", { "before": true, "after": true } ], | ||
// but *not* for the following standard.js rules: | ||
// * "space-before-function-paren": [ "error", "always" ], | ||
// * "semi": [ "error", "never" ], | ||
function * generator() {} | ||
var anonymous = function * () {}; | ||
var shorthand = { * generator() {} }; | ||
class Example { | ||
async * foo() {} | ||
} | ||
================================================================================ | ||
`; | ||
|
||
exports[`correct.js 2`] = ` | ||
====================================options===================================== | ||
generatorStarSpacing: true | ||
parsers: ["babel", "flow", "typescript"] | ||
printWidth: 80 | ||
spaceBeforeFunctionParen: true | ||
| printWidth | ||
=====================================input====================================== | ||
// correct for: | ||
// * "generator-star-spacing": [ "error", { "before": true, "after": true } ], | ||
// but *not* for the following standard.js rules: | ||
// * "space-before-function-paren": [ "error", "always" ], | ||
// * "semi": [ "error", "never" ], | ||
function * generator() {} | ||
var anonymous = function * () {}; | ||
var shorthand = { * generator() {} }; | ||
class Example { | ||
async * foo() {} | ||
} | ||
=====================================output===================================== | ||
// correct for: | ||
// * "generator-star-spacing": [ "error", { "before": true, "after": true } ], | ||
// but *not* for the following standard.js rules: | ||
// * "space-before-function-paren": [ "error", "always" ], | ||
// * "semi": [ "error", "never" ], | ||
function * generator () {} | ||
var anonymous = function * () {}; | ||
var shorthand = { * generator () {} }; | ||
class Example { | ||
async * foo () {} | ||
} | ||
================================================================================ | ||
`; | ||
|
||
exports[`incorrect.js 1`] = ` | ||
====================================options===================================== | ||
generatorStarSpacing: true | ||
parsers: ["babel", "flow", "typescript"] | ||
printWidth: 80 | ||
| printWidth | ||
=====================================input====================================== | ||
// *incorrect* for the following standard.js rules: | ||
// * "generator-star-spacing": [ "error", { "before": true, "after": true } ], | ||
// * "space-before-function-paren": [ "error", "always" ], | ||
// * "semi": [ "error", "never" ], | ||
function* generator() {} | ||
var anonymous = function* () {}; | ||
var shorthand = { * generator() {} }; | ||
function *generator() {} | ||
var anonymous = function *() {}; | ||
var shorthand = { *generator() {} }; | ||
=====================================output===================================== | ||
// *incorrect* for the following standard.js rules: | ||
// * "generator-star-spacing": [ "error", { "before": true, "after": true } ], | ||
// * "space-before-function-paren": [ "error", "always" ], | ||
// * "semi": [ "error", "never" ], | ||
function * generator() {} | ||
var anonymous = function * () {}; | ||
var shorthand = { * generator() {} }; | ||
function * generator() {} | ||
var anonymous = function * () {}; | ||
var shorthand = { * generator() {} }; | ||
================================================================================ | ||
`; | ||
|
||
exports[`incorrect.js 2`] = ` | ||
====================================options===================================== | ||
generatorStarSpacing: true | ||
parsers: ["babel", "flow", "typescript"] | ||
printWidth: 80 | ||
spaceBeforeFunctionParen: true | ||
| printWidth | ||
=====================================input====================================== | ||
// *incorrect* for the following standard.js rules: | ||
// * "generator-star-spacing": [ "error", { "before": true, "after": true } ], | ||
// * "space-before-function-paren": [ "error", "always" ], | ||
// * "semi": [ "error", "never" ], | ||
function* generator() {} | ||
var anonymous = function* () {}; | ||
var shorthand = { * generator() {} }; | ||
function *generator() {} | ||
var anonymous = function *() {}; | ||
var shorthand = { *generator() {} }; | ||
=====================================output===================================== | ||
// *incorrect* for the following standard.js rules: | ||
// * "generator-star-spacing": [ "error", { "before": true, "after": true } ], | ||
// * "space-before-function-paren": [ "error", "always" ], | ||
// * "semi": [ "error", "never" ], | ||
function * generator () {} | ||
var anonymous = function * () {}; | ||
var shorthand = { * generator () {} }; | ||
function * generator () {} | ||
var anonymous = function * () {}; | ||
var shorthand = { * generator () {} }; | ||
================================================================================ | ||
`; |
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,12 @@ | ||
// correct for: | ||
// * "generator-star-spacing": [ "error", { "before": true, "after": true } ], | ||
// but *not* for the following standard.js rules: | ||
// * "space-before-function-paren": [ "error", "always" ], | ||
// * "semi": [ "error", "never" ], | ||
|
||
function * generator() {} | ||
var anonymous = function * () {}; | ||
var shorthand = { * generator() {} }; | ||
class Example { | ||
async * foo() {} | ||
} |
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,11 @@ | ||
// *incorrect* for the following standard.js rules: | ||
// * "generator-star-spacing": [ "error", { "before": true, "after": true } ], | ||
// * "space-before-function-paren": [ "error", "always" ], | ||
// * "semi": [ "error", "never" ], | ||
|
||
function* generator() {} | ||
var anonymous = function* () {}; | ||
var shorthand = { * generator() {} }; | ||
function *generator() {} | ||
var anonymous = function *() {}; | ||
var shorthand = { *generator() {} }; |
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,7 @@ | ||
run_spec(__dirname, ["babel", "flow", "typescript"], { | ||
generatorStarSpacing: true | ||
}); | ||
run_spec(__dirname, ["babel", "flow", "typescript"], { | ||
generatorStarSpacing: true, | ||
spaceBeforeFunctionParen: true | ||
}); |
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
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