File tree Expand file tree Collapse file tree 6 files changed +124
-0
lines changed Expand file tree Collapse file tree 6 files changed +124
-0
lines changed Original file line number Diff line number Diff line change @@ -322,6 +322,7 @@ The following rules extend the rules provided by ESLint itself and apply them to
322322|  [ vue/dot-location] ( ./dot-location.md )  |  enforce consistent newlines before and after dots |  :wrench :  | 
323323|  [ vue/dot-notation] ( ./dot-notation.md )  |  enforce dot notation whenever possible |  :wrench :  | 
324324|  [ vue/eqeqeq] ( ./eqeqeq.md )  |  require the use of ` === `  and ` !== `  |  :wrench :  | 
325+ |  [ vue/func-call-spacing] ( ./func-call-spacing.md )  |  require or disallow spacing between function identifiers and their invocations |  :wrench :  | 
325326|  [ vue/key-spacing] ( ./key-spacing.md )  |  enforce consistent spacing between keys and values in object literal properties |  :wrench :  | 
326327|  [ vue/keyword-spacing] ( ./keyword-spacing.md )  |  enforce consistent spacing before and after keywords |  :wrench :  | 
327328|  [ vue/max-len] ( ./max-len.md )  |  enforce a maximum line length |   | 
Original file line number Diff line number Diff line change 1+ --- 
2+ pageClass : rule-details 
3+ sidebarDepth : 0 
4+ title : vue/func-call-spacing 
5+ description : require or disallow spacing between function identifiers and their invocations 
6+ --- 
7+ # vue/func-call-spacing  
8+ >  require or disallow spacing between function identifiers and their invocations
9+ 
10+ -  :wrench :  The ` --fix `  option on the [ command line] ( https://eslint.org/docs/user-guide/command-line-interface#fixing-problems )  can automatically fix some of the problems reported by this rule.
11+ 
12+ This rule is the same rule as core [ func-call-spacing]  rule but it applies to the expressions in ` <template> ` .
13+ 
14+ ## :books :  Further reading 
15+ 
16+ -  [ func-call-spacing] 
17+ 
18+ [ func-call-spacing ] : https://eslint.org/docs/rules/func-call-spacing 
19+ 
20+ ## :mag :  Implementation 
21+ 
22+ -  [ Rule source] ( https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/func-call-spacing.js ) 
23+ -  [ Test source] ( https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/func-call-spacing.js ) 
24+ 
25+ <sup >Taken with ❤️ [ from ESLint core] ( https://eslint.org/docs/rules/func-call-spacing ) </sup >
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ module.exports = {
1313    'vue/comma-spacing' : 'off' , 
1414    'vue/comma-style' : 'off' , 
1515    'vue/dot-location' : 'off' , 
16+     'vue/func-call-spacing' : 'off' , 
1617    'vue/html-closing-bracket-newline' : 'off' , 
1718    'vue/html-closing-bracket-spacing' : 'off' , 
1819    'vue/html-comment-content-newline' : 'off' , 
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ module.exports = {
2525    'dot-location' : require ( './rules/dot-location' ) , 
2626    'dot-notation' : require ( './rules/dot-notation' ) , 
2727    eqeqeq : require ( './rules/eqeqeq' ) , 
28+     'func-call-spacing' : require ( './rules/func-call-spacing' ) , 
2829    'html-closing-bracket-newline' : require ( './rules/html-closing-bracket-newline' ) , 
2930    'html-closing-bracket-spacing' : require ( './rules/html-closing-bracket-spacing' ) , 
3031    'html-comment-content-newline' : require ( './rules/html-comment-content-newline' ) , 
Original file line number Diff line number Diff line change 1+ /** 
2+  * @author  Yosuke Ota 
3+  */ 
4+ 'use strict' 
5+ 
6+ const  {  wrapCoreRule }  =  require ( '../utils' ) 
7+ 
8+ // eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories 
9+ module . exports  =  wrapCoreRule ( require ( 'eslint/lib/rules/func-call-spacing' ) ,  { 
10+   skipDynamicArguments : true 
11+ } ) 
Original file line number Diff line number Diff line change 1+ /** 
2+  * @author  Yosuke Ota 
3+  */ 
4+ 'use strict' 
5+ 
6+ const  {  RuleTester,  CLIEngine }  =  require ( 'eslint' ) 
7+ const  semver  =  require ( 'semver' ) 
8+ const  rule  =  require ( '../../../lib/rules/func-call-spacing' ) 
9+ 
10+ const  tester  =  new  RuleTester ( { 
11+   parser : require . resolve ( 'vue-eslint-parser' ) , 
12+   parserOptions : {  ecmaVersion : 2020  } 
13+ } ) 
14+ 
15+ tester . run ( 'func-call-spacing' ,  rule ,  { 
16+   valid : [ 
17+     ` 
18+     <template> 
19+       <div :foo="foo()" /> 
20+     </template> 
21+     ` , 
22+     { 
23+       code : ` 
24+       <template> 
25+         <div :foo="foo ()" /> 
26+       </template> 
27+       ` , 
28+       options : [ 'always' ] 
29+     } , 
30+     ` 
31+     <template> 
32+       <div :[foo()]="value" /> 
33+     </template> 
34+     ` , 
35+     { 
36+       code : ` 
37+       <template> 
38+         <div :[foo()]="value" /> 
39+       </template> 
40+       ` , 
41+       options : [ 'always' ] 
42+     } 
43+   ] , 
44+   invalid : [ 
45+     { 
46+       code : ` 
47+       <template> 
48+         <div :foo="foo ()" /> 
49+       </template> 
50+       ` , 
51+       output : ` 
52+       <template> 
53+         <div :foo="foo()" /> 
54+       </template> 
55+       ` , 
56+       errors : [ 
57+         { 
58+           message : semver . lt ( CLIEngine . version ,  '7.0.0' ) 
59+             ? 'Unexpected newline between function name and paren.' 
60+             : 'Unexpected whitespace between function name and paren.' , 
61+           line : 3 
62+         } 
63+       ] 
64+     } , 
65+     { 
66+       code : ` 
67+       <template> 
68+         <div :foo="foo()" /> 
69+       </template> 
70+       ` , 
71+       options : [ 'always' ] , 
72+       output : ` 
73+       <template> 
74+         <div :foo="foo ()" /> 
75+       </template> 
76+       ` , 
77+       errors : [ 
78+         { 
79+           message : 'Missing space between function name and paren.' , 
80+           line : 3 
81+         } 
82+       ] 
83+     } 
84+   ] 
85+ } ) 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments