This repository has been archived by the owner on Jun 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
13: retain leading comments when replacing the imports
- Loading branch information
1 parent
6060473
commit 560f0aa
Showing
3 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* top of file | ||
*/ | ||
'use strict'; | ||
// after use strict | ||
var a = 'a'; | ||
/* | ||
* after var a | ||
*/ | ||
|
||
// before foo | ||
// const foo = 123; | ||
// after foo | ||
|
||
// before other imports | ||
// import Funk from 'funky-town'; | ||
// after other imports | ||
|
||
// All comments between an expression and import React should remain. | ||
|
||
// before blah | ||
// const blah = 111; | ||
// after blah | ||
|
||
// before react import | ||
import React, { | ||
Platform, | ||
NativeModules, | ||
} from 'react-native'; | ||
// after imports | ||
|
||
// before Spaghetti | ||
import Spaghetti from 'food'; | ||
// after Spaghetti | ||
|
||
/** | ||
* comment above class | ||
*/ | ||
export default class Foo extends React.Component { | ||
static get propTypes() { | ||
return {}; | ||
// bottom of propTypes | ||
} | ||
|
||
// above componentWillMount | ||
componentWillMount() {} | ||
|
||
/** | ||
* multi-line comment above foo | ||
* @param {String} blah | ||
* @return {undefined} | ||
*/ | ||
foo(blah) {} | ||
|
||
render() { | ||
// top of render | ||
return; | ||
} | ||
} | ||
|
||
// EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* top of file | ||
*/ | ||
'use strict'; | ||
// after use strict | ||
var a = 'a'; | ||
|
||
/* | ||
* after var a | ||
*/ | ||
|
||
// before foo | ||
// const foo = 123; | ||
// after foo | ||
|
||
// before other imports | ||
// import Funk from 'funky-town'; | ||
// after other imports | ||
|
||
// All comments between an expression and import React should remain. | ||
|
||
// before blah | ||
// const blah = 111; | ||
// after blah | ||
|
||
// before react import | ||
import React from 'react'; | ||
|
||
import {Platform, NativeModules} from 'react-native'; | ||
// after imports | ||
|
||
// before Spaghetti | ||
import Spaghetti from 'food'; | ||
// after Spaghetti | ||
|
||
/** | ||
* comment above class | ||
*/ | ||
export default class Foo extends React.Component { | ||
static get propTypes() { | ||
return {}; | ||
// bottom of propTypes | ||
} | ||
|
||
// above componentWillMount | ||
componentWillMount() {} | ||
|
||
/** | ||
* multi-line comment above foo | ||
* @param {String} blah | ||
* @return {undefined} | ||
*/ | ||
foo(blah) {} | ||
|
||
render() { | ||
// top of render | ||
return; | ||
} | ||
} | ||
|
||
// EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters