Skip to content

Commit

Permalink
Update to ES6 var/let, see phetsims/chipper#786
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid authored and zepumph committed Oct 22, 2024
1 parent da6d994 commit 61777c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eslint/rules/string-require-statement-match.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ module.exports = function( context ) {
if ( rhs && rhs.indexOf( 'string!' ) === 0 ) {

const lastSlash = rhs.lastIndexOf( '/' );
const key = rhs.substring( lastSlash + 1 );
let key = rhs.substring( lastSlash + 1 );

// For a11y strings, no need to prefix vars with "a11y"
if ( key.indexOf( 'a11y.' ) === 0 ) {
key = key.replace( 'a11y.', '' );
}

// Convert various separators to whitespace
const withWhitespace = key.replace( /\./g, ' ' ).replace( /-/g, ' ' ).replace( /_/g, ' ' );
const withWhitespace = key.replace( /[.\-_]/g, ' ' );

// Convert whitespace delimited string to camel case and append string suffix
const desiredVarName = toCamelCase( withWhitespace ) + 'String';
Expand Down

0 comments on commit 61777c7

Please sign in to comment.