From dc5344f348a5e1131284615c66f0e2f12d513437 Mon Sep 17 00:00:00 2001 From: Tugdual de Kerviler Date: Mon, 18 Nov 2019 13:34:54 +0100 Subject: [PATCH] Fix lint errors --- bin/po2android.js | 15 ++++++++++----- bin/po2swift.js | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bin/po2android.js b/bin/po2android.js index c6020ad0ac..0158b59915 100755 --- a/bin/po2android.js +++ b/bin/po2android.js @@ -7,10 +7,11 @@ const gettextParser = require( 'gettext-parser' ), const indent = ' '; /** - * Encode a raw string into an Android-compatible value to be copied into the XML node + * Encode a raw string into an Android-compatible value * * See: https://tekeye.uk/android/examples/android-string-resources-gotchas - * @param unsafeXMLValue string + * @param {string} unsafeXMLValue input string to be escaped + * @return {string} Escaped string to be copied into the XML node */ function escapeResourceXML( unsafeXMLValue ) { // Let's first replace XML special characters that JSON.stringify does not escape: <, > and & @@ -29,6 +30,10 @@ function escapeResourceXML( unsafeXMLValue ) { * Try using the string first by stripping any non-alphanumeric characters and cropping it * Then try hashing the string and appending it to the the sanatized string * If none of the above makes a unique ref for our string throw an error + * + * @param {string} str raw string + * @param {string} prefix Optional prefix to add to the name + * @return {string} A unique name for this string */ const getUniqueName = ( function() { const names = {}; @@ -50,8 +55,8 @@ const getUniqueName = ( function() { } names[ name ] = true; return `${ prefix }${ name }`; - } -} )(); + }; +}() ); function po2Android( poInput ) { const po = gettextParser.po.parse( poInput ); @@ -83,7 +88,7 @@ ${ indent } // try to minimize changes in diffs by sorting strings const androidResourcesSortedList = Object.entries( androidResourcesMap ) .sort( ( left, right ) => left[ 0 ].localeCompare( right[ 0 ] ) ) - .map( entry => entry[ 1 ] ); + .map( ( entry ) => entry[ 1 ] ); return `\n\n${ androidResourcesSortedList.join( '' ) }\n`; } diff --git a/bin/po2swift.js b/bin/po2swift.js index 214539a533..05bb8029f8 100755 --- a/bin/po2swift.js +++ b/bin/po2swift.js @@ -17,7 +17,7 @@ function po2Swift( poInput ) { }, {} ); const swiftStringsSortedList = Object.entries( swiftStringsMap ) .sort( ( left, right ) => left[ 0 ].localeCompare( right[ 0 ] ) ) - .map( entry => entry[ 1 ] ); + .map( ( entry ) => entry[ 1 ] ); return `import Foundation\n\nprivate func dummy() {\n ${ swiftStringsSortedList.join( '\n ' ) }\n`; }