Skip to content
Merged
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
4 changes: 3 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@
"vars-on-top": 0,
"wrap-iife": 2,
"wrap-regex": 0,
"yoda": [2, "never", {"exceptRange": true}]
"yoda": [2, "never", {"exceptRange": true}],

Copy link
Contributor

Choose a reason for hiding this comment

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

extra line break intended here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I wanted to separate the custom rules. Would have put in a comment to make it clear but this is faux-JSON so there are no comments... (We do use a blank line as a separator higher up in the file, at least.)

"no-async": 2
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"test": "npm run lint && npm run check && npm run testonly",
"testonly": "babel-node ./node_modules/.bin/_mocha $npm_package_options_mocha",
"t": "babel-node ./node_modules/.bin/_mocha --require ./resources/mocha-bootload",
"lint": "eslint src || (printf '\\033[33mTry: \\033[7m npm run lint -- --fix \\033[0m\\n' && exit 1)",
"lint": "eslint --rulesdir ./resources/lint src || (printf '\\033[33mTry: \\033[7m npm run lint -- --fix \\033[0m\\n' && exit 1)",
"check": "flow check",
"check-cover": "for file in {src/*.js,src/**/*.js}; do echo $file; flow coverage $file; done",
"build": "babel src --optional runtime --ignore __tests__ --out-dir dist/ && cp package.json dist/ && npm run build-dot-flow",
Expand Down
28 changes: 28 additions & 0 deletions resources/lint/no-async.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) 2017, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

module.exports = function(context) {
if (context.getFilename().match(/\b__tests__\b/)) {
return {};
} else {
return {
FunctionDeclaration: function(node) {
if (node.async) {
context.report(
node,
'async functions are not allowed outside of the test suite ' +
'because older versions of NodeJS do not support them ' +
'without additional runtime dependencies. Instead, use explicit ' +
'Promises.'
);
}
},
};
}
};