@lsby/eslint-plugin 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -21,6 +21,14 @@ module.exports = {
|
|
|
21
21
|
node.left.type === 'MemberExpression' &&
|
|
22
22
|
node.right.raw === 'null'
|
|
23
23
|
) {
|
|
24
|
+
// 检查是不是类实例的 null 比较, 比如 this.x === null
|
|
25
|
+
const isClassPropertyCheck = node.left.object.type === 'ThisExpression'
|
|
26
|
+
if (isClassPropertyCheck) {
|
|
27
|
+
// 如果是类实例的 null 检查,则跳过修复
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// 默认的 hasOwnProperty 检查
|
|
24
32
|
context.report({
|
|
25
33
|
node,
|
|
26
34
|
messageId: 'useHas',
|