Commit 5d30424 1 parent 31ba7bf commit 5d30424 Copy full SHA for 5d30424
File tree 2 files changed +32
-28
lines changed
packages/eslint-plugin-react-hooks/src
2 files changed +32
-28
lines changed Original file line number Diff line number Diff line change @@ -70,23 +70,25 @@ export default {
70
70
/**
71
71
* SourceCode#getText that also works down to ESLint 3.0.0
72
72
*/
73
- function getSource ( node ) {
74
- if ( typeof context . getSource === 'function' ) {
75
- return context . getSource ( node ) ;
76
- } else {
77
- return context . sourceCode . getText ( node ) ;
78
- }
79
- }
73
+ const getSource =
74
+ typeof context . getSource === 'function'
75
+ ? node => {
76
+ return context . getSource ( node ) ;
77
+ }
78
+ : node => {
79
+ return context . sourceCode . getText ( node ) ;
80
+ } ;
80
81
/**
81
82
* SourceCode#getScope that also works down to ESLint 3.0.0
82
83
*/
83
- function getScope ( node ) {
84
- if ( typeof context . getScope === 'function' ) {
85
- return context . getScope ( ) ;
86
- } else {
87
- return context . sourceCode . getScope ( node ) ;
88
- }
89
- }
84
+ const getScope =
85
+ typeof context . getScope === 'function'
86
+ ? ( ) => {
87
+ return context . getScope ( ) ;
88
+ }
89
+ : node => {
90
+ return context . sourceCode . getScope ( node ) ;
91
+ } ;
90
92
91
93
const scopeManager = context . getSourceCode ( ) . scopeManager ;
92
94
Original file line number Diff line number Diff line change @@ -151,23 +151,25 @@ export default {
151
151
/**
152
152
* SourceCode#getText that also works down to ESLint 3.0.0
153
153
*/
154
- function getSource ( node ) {
155
- if ( typeof context . getSource === 'function' ) {
156
- return context . getSource ( node ) ;
157
- } else {
158
- return context . sourceCode . getText ( node ) ;
159
- }
160
- }
154
+ const getSource =
155
+ typeof context . getSource === 'function'
156
+ ? node => {
157
+ return context . getSource ( node ) ;
158
+ }
159
+ : node => {
160
+ return context . sourceCode . getText ( node ) ;
161
+ } ;
161
162
/**
162
163
* SourceCode#getScope that also works down to ESLint 3.0.0
163
164
*/
164
- function getScope ( node ) {
165
- if ( typeof context . getScope === 'function' ) {
166
- return context . getScope ( ) ;
167
- } else {
168
- return context . sourceCode . getScope ( node ) ;
169
- }
170
- }
165
+ const getScope =
166
+ typeof context . getScope === 'function'
167
+ ? ( ) => {
168
+ return context . getScope ( ) ;
169
+ }
170
+ : node => {
171
+ return context . sourceCode . getScope ( node ) ;
172
+ } ;
171
173
172
174
return {
173
175
// Maintain code segment path stack as we traverse.
You can’t perform that action at this time.
0 commit comments