File tree Expand file tree Collapse file tree 2 files changed +4
-28
lines changed
Expand file tree Collapse file tree 2 files changed +4
-28
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,7 @@ const messages = {
77
88const getProblem = ( node , context ) => {
99 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 } ) ;
1411 const closingBrace = sourceCode . getLastToken ( node ) ;
1512 const [ , start ] = sourceCode . getRange ( openingBrace ) ;
1613 const [ end ] = sourceCode . getRange ( closingBrace ) ;
@@ -36,20 +33,11 @@ const create = context => {
3633 'BlockStatement' ,
3734 'ClassBody' ,
3835 'StaticBlock' ,
39- ] , node => {
40- if ( node . body . length > 0 ) {
41- return ;
42- }
43-
44- return getProblem ( node , context ) ;
45- } ) ;
46-
47- context . on ( [
4836 'ObjectExpression' ,
49- // Experimental https://github.com/tc39/proposal-record-tuple
50- 'RecordExpression' ,
5137 ] , node => {
52- if ( node . properties . length > 0 ) {
38+ const children = node . type === 'ObjectExpression' ? node . properties : node . body ;
39+
40+ if ( children . length > 0 ) {
5341 return ;
5442 }
5543
Original file line number Diff line number Diff line change @@ -114,18 +114,6 @@ test.babel({
114114 languageOptions : enableBabelPlugin ( 'doExpressions' ) ,
115115 errors : 1 ,
116116 } ,
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- } ,
129117 {
130118 code : outdent `
131119 class Foo {
You can’t perform that action at this time.
0 commit comments