File tree 2 files changed +4
-28
lines changed
2 files changed +4
-28
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,7 @@ const messages = {
7
7
8
8
const getProblem = ( node , context ) => {
9
9
const { sourceCode} = context ;
10
- const filter = node . type === 'RecordExpression'
11
- ? token => token . type === 'Punctuator' && ( token . value === '#{' || token . value === '{|' )
12
- : isOpeningBraceToken ;
13
- const openingBrace = sourceCode . getFirstToken ( node , { filter} ) ;
10
+ const openingBrace = sourceCode . getFirstToken ( node , { filter : isOpeningBraceToken } ) ;
14
11
const closingBrace = sourceCode . getLastToken ( node ) ;
15
12
const [ , start ] = sourceCode . getRange ( openingBrace ) ;
16
13
const [ end ] = sourceCode . getRange ( closingBrace ) ;
@@ -36,20 +33,11 @@ const create = context => {
36
33
'BlockStatement' ,
37
34
'ClassBody' ,
38
35
'StaticBlock' ,
39
- ] , node => {
40
- if ( node . body . length > 0 ) {
41
- return ;
42
- }
43
-
44
- return getProblem ( node , context ) ;
45
- } ) ;
46
-
47
- context . on ( [
48
36
'ObjectExpression' ,
49
- // Experimental https://github.com/tc39/proposal-record-tuple
50
- 'RecordExpression' ,
51
37
] , node => {
52
- if ( node . properties . length > 0 ) {
38
+ const children = node . type === 'ObjectExpression' ? node . properties : node . body ;
39
+
40
+ if ( children . length > 0 ) {
53
41
return ;
54
42
}
55
43
Original file line number Diff line number Diff line change @@ -114,18 +114,6 @@ test.babel({
114
114
languageOptions : enableBabelPlugin ( 'doExpressions' ) ,
115
115
errors : 1 ,
116
116
} ,
117
- {
118
- code : 'const record = #{ };' ,
119
- output : 'const record = #{};' ,
120
- languageOptions : enableBabelPlugin ( [ 'recordAndTuple' , { syntaxType : 'hash' } ] ) ,
121
- errors : 1 ,
122
- } ,
123
- {
124
- code : 'const record = {| |};' ,
125
- output : 'const record = {||};' ,
126
- languageOptions : enableBabelPlugin ( [ 'recordAndTuple' , { syntaxType : 'bar' } ] ) ,
127
- errors : 1 ,
128
- } ,
129
117
{
130
118
code : outdent `
131
119
class Foo {
You can’t perform that action at this time.
0 commit comments