Skip to content

Commit 883a842

Browse files
macklinuSimenB
authored andcommitted
style(lint): enable eqeqeq rule (#62)
* style(lint): enable eqeqeq rule https://eslint.org/docs/rules/eqeqeq * Update .eslintrc.js
1 parent 5ea5c23 commit 883a842

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = {
1616
node: true,
1717
},
1818
rules: {
19+
eqeqeq: ['error', 'smart'],
1920
strict: 'error',
2021
'eslint-plugin/require-meta-docs-url': [
2122
'error',

rules/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const expectCase = node =>
44
node.callee.name === 'expect' &&
5-
node.arguments.length == 1 &&
5+
node.arguments.length === 1 &&
66
node.parent &&
77
node.parent.type === 'MemberExpression' &&
88
node.parent.parent;

rules/valid-expect-in-promise.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const reportMsg =
88
const isThenOrCatch = node => {
99
return (
1010
node.property &&
11-
(node.property.name == 'then' || node.property.name == 'catch')
11+
(node.property.name === 'then' || node.property.name === 'catch')
1212
);
1313
};
1414

@@ -27,7 +27,7 @@ const isExpectCallPresentInFunction = body => {
2727
const isExpectCall = expression => {
2828
return (
2929
expression &&
30-
expression.type == 'CallExpression' &&
30+
expression.type === 'CallExpression' &&
3131
expression.callee.type === 'MemberExpression' &&
3232
expression.callee.object.type === 'CallExpression' &&
3333
expression.callee.object.callee.name === 'expect'
@@ -86,8 +86,8 @@ const getTestFunction = node => {
8686

8787
const isParentThenOrPromiseReturned = (node, testFunctionBody) => {
8888
return (
89-
testFunctionBody.type == 'CallExpression' ||
90-
node.parent.parent.type == 'ReturnStatement' ||
89+
testFunctionBody.type === 'CallExpression' ||
90+
node.parent.parent.type === 'ReturnStatement' ||
9191
isPromiseReturnedLater(node, testFunctionBody) ||
9292
isThenOrCatch(node.parent.parent)
9393
);
@@ -113,7 +113,7 @@ const verifyExpectWithReturn = (
113113
};
114114

115115
const isAwaitExpression = node => {
116-
return node.parent.parent && node.parent.parent.type == 'AwaitExpression';
116+
return node.parent.parent && node.parent.parent.type === 'AwaitExpression';
117117
};
118118

119119
const isHavingAsyncCallBackParam = testFunction => {
@@ -135,9 +135,9 @@ module.exports = {
135135
return {
136136
MemberExpression(node) {
137137
if (
138-
node.type == 'MemberExpression' &&
138+
node.type === 'MemberExpression' &&
139139
isThenOrCatch(node) &&
140-
node.parent.type == 'CallExpression' &&
140+
node.parent.type === 'CallExpression' &&
141141
!isAwaitExpression(node)
142142
) {
143143
const testFunction = getTestFunction(node);

0 commit comments

Comments
 (0)