Skip to content

Commit

Permalink
style(lint): enable eqeqeq rule (#62)
Browse files Browse the repository at this point in the history
* style(lint): enable eqeqeq rule

https://eslint.org/docs/rules/eqeqeq

* Update .eslintrc.js
  • Loading branch information
macklinu authored and SimenB committed Feb 10, 2018
1 parent 5ea5c23 commit 883a842
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = {
node: true,
},
rules: {
eqeqeq: ['error', 'smart'],
strict: 'error',
'eslint-plugin/require-meta-docs-url': [
'error',
Expand Down
2 changes: 1 addition & 1 deletion rules/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const expectCase = node =>
node.callee.name === 'expect' &&
node.arguments.length == 1 &&
node.arguments.length === 1 &&
node.parent &&
node.parent.type === 'MemberExpression' &&
node.parent.parent;
Expand Down
14 changes: 7 additions & 7 deletions rules/valid-expect-in-promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const reportMsg =
const isThenOrCatch = node => {
return (
node.property &&
(node.property.name == 'then' || node.property.name == 'catch')
(node.property.name === 'then' || node.property.name === 'catch')
);
};

Expand All @@ -27,7 +27,7 @@ const isExpectCallPresentInFunction = body => {
const isExpectCall = expression => {
return (
expression &&
expression.type == 'CallExpression' &&
expression.type === 'CallExpression' &&
expression.callee.type === 'MemberExpression' &&
expression.callee.object.type === 'CallExpression' &&
expression.callee.object.callee.name === 'expect'
Expand Down Expand Up @@ -86,8 +86,8 @@ const getTestFunction = node => {

const isParentThenOrPromiseReturned = (node, testFunctionBody) => {
return (
testFunctionBody.type == 'CallExpression' ||
node.parent.parent.type == 'ReturnStatement' ||
testFunctionBody.type === 'CallExpression' ||
node.parent.parent.type === 'ReturnStatement' ||
isPromiseReturnedLater(node, testFunctionBody) ||
isThenOrCatch(node.parent.parent)
);
Expand All @@ -113,7 +113,7 @@ const verifyExpectWithReturn = (
};

const isAwaitExpression = node => {
return node.parent.parent && node.parent.parent.type == 'AwaitExpression';
return node.parent.parent && node.parent.parent.type === 'AwaitExpression';
};

const isHavingAsyncCallBackParam = testFunction => {
Expand All @@ -135,9 +135,9 @@ module.exports = {
return {
MemberExpression(node) {
if (
node.type == 'MemberExpression' &&
node.type === 'MemberExpression' &&
isThenOrCatch(node) &&
node.parent.type == 'CallExpression' &&
node.parent.type === 'CallExpression' &&
!isAwaitExpression(node)
) {
const testFunction = getTestFunction(node);
Expand Down

0 comments on commit 883a842

Please sign in to comment.