@@ -13,27 +13,6 @@ const utils = require('../utils')
13
13
// Helpers
14
14
// ------------------------------------------------------------------------------
15
15
16
- /**
17
- * Check if all keys and values from second object are resent in first object
18
- *
19
- * @param {{ [key: string]: any } } a object to
20
- * @param {{ [key: string]: any } } b The string to escape.
21
- * @returns {boolean } Returns the escaped string.
22
- */
23
- const isLooksLike = ( a , b ) =>
24
- a &&
25
- b &&
26
- Object . keys ( b ) . every ( ( bKey ) => {
27
- const bVal = b [ bKey ]
28
- const aVal = a [ bKey ]
29
- if ( typeof bVal === 'function' ) {
30
- return bVal ( aVal )
31
- }
32
- return bVal == null || / ^ [ b n s ] / . test ( typeof bVal )
33
- ? bVal === aVal
34
- : isLooksLike ( aVal , bVal )
35
- } )
36
-
37
16
/**
38
17
* @param {ComponentProp } property
39
18
* @param {RuleContext } context
@@ -44,7 +23,8 @@ const checkProperty = (property, context) => {
44
23
}
45
24
46
25
if (
47
- isLooksLike ( property . value , { type : 'Identifier' , name : 'Object' } ) &&
26
+ property . value . type === 'Identifier' &&
27
+ property . value . name === 'Object' &&
48
28
property . node . value . type !== 'TSAsExpression'
49
29
) {
50
30
context . report ( {
@@ -58,16 +38,18 @@ const checkProperty = (property, context) => {
58
38
property . value . type === 'ObjectExpression' &&
59
39
property . node . value . type === 'ObjectExpression'
60
40
) {
61
- const typePropert = property . node . value . properties . find (
41
+ const typeProperty = property . node . value . properties . find (
62
42
( prop ) =>
63
43
prop . type === 'Property' &&
64
44
prop . key . type === 'Identifier' &&
65
45
prop . key . name === 'type'
66
46
)
67
47
if (
68
- typePropert &&
69
- typePropert . type === 'Property' &&
70
- isLooksLike ( typePropert . value , { type : 'Identifier' , name : 'Object' } )
48
+ typeProperty &&
49
+ typeProperty . type === 'Property' &&
50
+ typeProperty . value . type === 'Identifier' &&
51
+ typeProperty . value . name === 'Object'
52
+ // isLooksLike(typeProperty.value, { type: 'Identifier', name: 'Object' })
71
53
) {
72
54
context . report ( {
73
55
node : property . node ,
@@ -134,7 +116,6 @@ module.exports = {
134
116
type : 'suggestion' ,
135
117
docs : {
136
118
description : 'enforce adding type declarations to object props' ,
137
- categories : [ 'base' ] ,
138
119
recommended : false ,
139
120
url : 'https://eslint.vuejs.org/rules/force-types-on-object-props.html'
140
121
} ,
0 commit comments