Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configured prettier #308

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"*.js": [
"prettier --trailing-comma es5 --write",
"git add"
]
}
21 changes: 0 additions & 21 deletions bin/regenerator

This file was deleted.

17 changes: 17 additions & 0 deletions bin/regenerator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env node

var compile = require("../main").compile;

require("commoner")
.version(require("../package.json").version)
.resolve(function(id) {
return this.readModuleP(id);
})
.option("-r, --include-runtime", "Prepend the runtime to the output.")
.option("--disable-async", "Disable transformation of async functions.")
.process(function(id, source) {
return compile(source, {
includeRuntime: this.options.includeRuntime,
disableAsync: this.options.disableAsync,
}).code;
});
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
"url": "git://github.com/facebook/regenerator.git"
},
"main": "main.js",
"bin": "bin/regenerator",
"bin": "bin/regenerator.js",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ive changed it so this file could also be 'caught' by the lint-staged's *.js rule

"scripts": {
"bootstrap": "lerna bootstrap",
"precommit": "lint-staged",
"test": "node test/run.js"
},
"dependencies": {
Expand Down Expand Up @@ -53,8 +54,11 @@
"babel-plugin-transform-runtime": "^6.9.0",
"babel-preset-env": "^1.2.2",
"babylon": "^6.14.1",
"husky": "^0.14.3",
"lerna": "^2.0.0",
"lint-staged": "^4.0.2",
"mocha": "^2.3.4",
"prettier": "^1.5.3",
"promise": "^7.0.4",
"semver": "^5.0.3"
},
Expand Down
24 changes: 12 additions & 12 deletions test/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,21 @@ enqueue("mocha", [

// Run command-line tool with available options to make sure it works.

enqueue("./bin/regenerator", [
enqueue("./bin/regenerator.js", [
"./test/async.es5.js"
], true);

enqueue("./bin/regenerator", [
enqueue("./bin/regenerator.js", [
"--include-runtime",
"./test/async.es5.js"
], true);

enqueue("./bin/regenerator", [
enqueue("./bin/regenerator.js", [
"--disable-async",
"./test/async.es5.js"
], true);

enqueue("./bin/regenerator", [
enqueue("./bin/regenerator.js", [
"--include-runtime",
"--disable-async",
"./test/async.es5.js"
Expand All @@ -213,21 +213,21 @@ enqueue("./bin/regenerator", [
// Make sure we run the command-line tool on a file that does not need any
// transformation, too.

enqueue("./bin/regenerator", [
enqueue("./bin/regenerator.js", [
"./test/nothing-to-transform.js"
], true);

enqueue("./bin/regenerator", [
enqueue("./bin/regenerator.js", [
"--include-runtime",
"./test/nothing-to-transform.js"
], true);

enqueue("./bin/regenerator", [
enqueue("./bin/regenerator.js", [
"--disable-async",
"./test/nothing-to-transform.js"
], true);

enqueue("./bin/regenerator", [
enqueue("./bin/regenerator.js", [
"--include-runtime",
"--disable-async",
"./test/nothing-to-transform.js"
Expand All @@ -237,21 +237,21 @@ enqueue("./bin/regenerator", [
//
// You passed `path.replaceWith()` a falsy node, use `path.remove()` instead

enqueue("./bin/regenerator", [
enqueue("./bin/regenerator.js", [
"./test/replaceWith-falsy.js"
], true);

enqueue("./bin/regenerator", [
enqueue("./bin/regenerator.js", [
"--include-runtime",
"./test/replaceWith-falsy.js"
], true);

enqueue("./bin/regenerator", [
enqueue("./bin/regenerator.js", [
"--disable-async",
"./test/replaceWith-falsy.js"
], true);

enqueue("./bin/regenerator", [
enqueue("./bin/regenerator.js", [
"--include-runtime",
"--disable-async",
"./test/replaceWith-falsy.js"
Expand Down