Skip to content

Commit

Permalink
refactor: lookup promise statics from object instead of array (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
macklinu committed May 24, 2018
1 parent ceb7414 commit 9b0cbd1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rules/lib/is-promise.js
Expand Up @@ -29,7 +29,7 @@ function isPromise(expression) {
expression.callee.type === 'MemberExpression' &&
expression.callee.object.type === 'Identifier' &&
expression.callee.object.name === 'Promise' &&
PROMISE_STATICS.indexOf(expression.callee.property.name) !== -1)
PROMISE_STATICS[expression.callee.property.name])
)
}

Expand Down
7 changes: 6 additions & 1 deletion rules/lib/promise-statics.js
@@ -1,3 +1,8 @@
'use strict'

module.exports = ['all', 'race', 'reject', 'resolve']
module.exports = {
all: true,
race: true,
reject: true,
resolve: true
}
2 changes: 1 addition & 1 deletion rules/no-new-statics.js
Expand Up @@ -15,7 +15,7 @@ module.exports = {
if (
node.callee.type === 'MemberExpression' &&
node.callee.object.name === 'Promise' &&
PROMISE_STATICS.indexOf(node.callee.property.name) > -1
PROMISE_STATICS[node.callee.property.name]
) {
context.report({
node,
Expand Down

0 comments on commit 9b0cbd1

Please sign in to comment.