|
@@ -112,7 +112,14 @@ module.exports = {
|
|
|
create: function (context) {
|
|
|
return {
|
|
|
BinaryExpression: function (node) {
|
|
|
- if (node.operator === '===') {
|
|
|
+ if (
|
|
|
+ node.operator === '===' && (
|
|
|
+ (node.right.type === 'Literal' && node.left.type === 'Literal') ||
|
|
|
+ (node.right.type === 'Literal' && ![true, false].includes(node.right.value)) ||
|
|
|
+ (node.left.type === 'Literal' && ![true, false].includes(node.left.value)) ||
|
|
|
+ (node.right.type === 'Identifier' && node.left.type === 'Identifier' && !(node.right.name === "undefined" || node.left.name === "undefined"))
|
|
|
+ )
|
|
|
+ ) {
|
|
|
context.report({
|
|
|
node: node,
|
|
|
message: 'Avoid using strict equality operator \'===\' (use loose equality operator \'==\' instead)',
|