File tree 1 file changed +23
-10
lines changed
1 file changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -1640,16 +1640,29 @@ export class MigrateController
1640
1640
}
1641
1641
1642
1642
private async runESLint ( projectDir : string ) {
1643
- // todo: run @nativescript /eslint-plugin on project folder to update imports
1644
- // const childProcess = injector.resolve('childProcess') as IChildProcess;
1645
- // const args = [
1646
- // 'npx',
1647
- // '--package typescript',
1648
- // '--package @nativescript/eslint-plugin',
1649
- // '-c eslint-plugin',
1650
- // projectDir
1651
- // ]
1652
- // await childProcess.exec(args.join(' '))
1643
+ this . spinner . start ( `Running ESLint fixes` ) ;
1644
+ try {
1645
+ const childProcess = injector . resolve ( "childProcess" ) as IChildProcess ;
1646
+ const npxVersion = await childProcess . exec ( "npx -v" ) ;
1647
+
1648
+ const npxFlags = [ ] ;
1649
+
1650
+ if ( semver . gt ( semver . coerce ( npxVersion ) , "7.0.0" ) ) {
1651
+ npxFlags . push ( "-y" ) ;
1652
+ }
1653
+
1654
+ const args = [
1655
+ "npx" ,
1656
+ ...npxFlags ,
1657
+ "@nativescript/eslint-plugin" ,
1658
+ projectDir ,
1659
+ ] ;
1660
+ await childProcess . exec ( args . join ( " " ) ) ;
1661
+ this . spinner . succeed ( `Applied ESLint fixes` ) ;
1662
+ } catch ( err ) {
1663
+ this . spinner . fail ( `Failed to apply ESLint fixes` ) ;
1664
+ this . $logger . trace ( "Failed to apply ESLint fixes. Error is:" , err ) ;
1665
+ }
1653
1666
}
1654
1667
}
1655
1668
You can’t perform that action at this time.
0 commit comments