@@ -13,11 +13,8 @@ const filesFilter = (file: any) => {
1313 return true ;
1414} ;
1515
16- const getCategory = ( fileName : string , addCategory : { } | boolean ) : string => {
17- const fileExt = fileName
18- . split ( "." )
19- . pop ( )
20- . toLowerCase ( ) ;
16+ const getCategory = ( fileName : string , addCategory : any | boolean ) : string => {
17+ const fileExt = fileName . split ( "." ) . pop ( ) . toLowerCase ( ) ;
2118 if ( typeof addCategory === "object" ) {
2219 for ( const pattern of Object . keys ( addCategory ) ) {
2320 if ( new RegExp ( `^${ pattern } $` ) . test ( fileName ) ) {
@@ -61,11 +58,11 @@ export async function exportFile(
6158 }
6259 const api = new AtelierAPI ( workspaceFolder ) ;
6360 api . setNamespace ( namespace ) ;
64- const log = status => outputChannel . appendLine ( `export "${ name } " as "${ fileName } " - ${ status } ` ) ;
61+ const log = ( status ) => outputChannel . appendLine ( `export "${ name } " as "${ fileName } " - ${ status } ` ) ;
6562 const folders = path . dirname ( fileName ) ;
6663 return mkdirSyncRecursive ( folders )
6764 . then ( ( ) => {
68- return api . getDoc ( name ) . then ( data => {
65+ return api . getDoc ( name ) . then ( ( data ) => {
6966 if ( ! data || ! data . result ) {
7067 throw new Error ( "Something wrong happened" ) ;
7168 }
@@ -75,7 +72,7 @@ export async function exportFile(
7572 const promise = new Promise ( ( resolve , reject ) => {
7673 if ( noStorage ) {
7774 // get only the storage xml for the doc.
78- api . getDoc ( name + "?storageOnly=1" ) . then ( storageData => {
75+ api . getDoc ( name + "?storageOnly=1" ) . then ( ( storageData ) => {
7976 if ( ! storageData || ! storageData . result ) {
8077 reject ( new Error ( "Something wrong happened fetching the storage data" ) ) ;
8178 }
@@ -122,12 +119,12 @@ export async function exportFile(
122119
123120 log ( `Success ${ isSkipped } ` ) ;
124121 } )
125- . catch ( error => {
122+ . catch ( ( error ) => {
126123 throw error ;
127124 } ) ;
128125 } ) ;
129126 } )
130- . catch ( error => {
127+ . catch ( ( error ) => {
131128 log ( "ERROR: " + error ) ;
132129 throw error ;
133130 } ) ;
@@ -140,12 +137,14 @@ export async function exportList(files: string[], workspaceFolder: string, names
140137 const { atelier, folder, addCategory } = config ( "export" , workspaceFolder ) ;
141138
142139 const root = [ workspaceFolderUri ( workspaceFolder ) . fsPath , folder ] . join ( path . sep ) ;
143- const run = async fileList => {
140+ const run = async ( fileList ) => {
144141 const errors = [ ] ;
145142 for ( const file of fileList ) {
146- await exportFile ( workspaceFolder , namespace , file , getFileName ( root , file , atelier , addCategory ) ) . catch ( error => {
147- errors . push ( `${ file } - ${ error } ` ) ;
148- } ) ;
143+ await exportFile ( workspaceFolder , namespace , file , getFileName ( root , file , atelier , addCategory ) ) . catch (
144+ ( error ) => {
145+ errors . push ( `${ file } - ${ error } ` ) ;
146+ }
147+ ) ;
149148 }
150149 outputChannel . appendLine ( `Exported items: ${ fileList . length - errors . length } ` ) ;
151150 if ( errors . length ) {
@@ -166,10 +165,10 @@ export async function exportList(files: string[], workspaceFolder: string, names
166165export async function exportAll ( workspaceFolder ?: string ) : Promise < any > {
167166 if ( ! workspaceFolder ) {
168167 const list = vscode . workspace . workspaceFolders
169- . filter ( folder => config ( "conn" , folder . name ) . active )
170- . map ( el => el . name ) ;
168+ . filter ( ( folder ) => config ( "conn" , folder . name ) . active )
169+ . map ( ( el ) => el . name ) ;
171170 if ( list . length > 1 ) {
172- return vscode . window . showQuickPick ( list ) . then ( folder => ( folder ? exportAll : null ) ) ;
171+ return vscode . window . showQuickPick ( list ) . then ( ( folder ) => ( folder ? exportAll : null ) ) ;
173172 } else {
174173 workspaceFolder = list . pop ( ) ;
175174 }
@@ -180,8 +179,8 @@ export async function exportAll(workspaceFolder?: string): Promise<any> {
180179 const api = new AtelierAPI ( workspaceFolder ) ;
181180 outputChannel . show ( true ) ;
182181 const { category, generated, filter, ns } = config ( "export" , workspaceFolder ) ;
183- const files = data => data . result . content . filter ( filesFilter ) . map ( file => file . name ) ;
184- return api . getDocNames ( { category, generated, filter } ) . then ( data => {
182+ const files = ( data ) => data . result . content . filter ( filesFilter ) . map ( ( file ) => file . name ) ;
183+ return api . getDocNames ( { category, generated, filter } ) . then ( ( data ) => {
185184 return exportList ( files ( data ) , workspaceFolder , ns ) ;
186185 } ) ;
187186}
@@ -204,7 +203,7 @@ Would you like to continue?`,
204203 }
205204 }
206205 const { workspaceFolder, namespace } = node ;
207- return Promise . all ( nodes . map ( node => node . getItems4Export ( ) ) ) . then ( items => {
206+ return Promise . all ( nodes . map ( ( node ) => node . getItems4Export ( ) ) ) . then ( ( items ) => {
208207 return exportList ( items . flat ( ) , workspaceFolder , namespace ) ;
209208 } ) ;
210209}
0 commit comments