From 4fb3dbe48b5b75d5b652b55947b7b661464b307f Mon Sep 17 00:00:00 2001 From: Sam Reid Date: Tue, 15 Oct 2024 08:47:18 -0600 Subject: [PATCH] Convert to TypeScript, see https://github.com/phetsims/chipper/issues/1465 --- js/grunt/{fixEOL.js => fixEOL.ts} | 9 ++------- js/grunt/generateDevelopmentHTML.ts | 2 +- js/grunt/generateREADME.ts | 2 +- js/grunt/getA11yViewHTMLFromTemplate.ts | 2 +- js/phet-io/formatPhetioAPI.ts | 2 +- 5 files changed, 6 insertions(+), 11 deletions(-) rename js/grunt/{fixEOL.js => fixEOL.ts} (70%) diff --git a/js/grunt/fixEOL.js b/js/grunt/fixEOL.ts similarity index 70% rename from js/grunt/fixEOL.js rename to js/grunt/fixEOL.ts index dbe71793c..861ffa72a 100644 --- a/js/grunt/fixEOL.js +++ b/js/grunt/fixEOL.ts @@ -3,16 +3,11 @@ /** * Fix end of lines for a string based on the operating system this code is being run on. * See https://github.com/phetsims/chipper/issues/933 + * * @author Michael Kauzmann (PhET Interactive Simulations) */ - // modules const os = require( 'os' ); -/** - * @public - * - * @returns {string} - */ -module.exports = string => string.split( '\r' ).join( '' ).split( '\n' ).join( os.EOL ); \ No newline at end of file +export default ( string: string ): string => string.split( '\r' ).join( '' ).split( '\n' ).join( os.EOL ); \ No newline at end of file diff --git a/js/grunt/generateDevelopmentHTML.ts b/js/grunt/generateDevelopmentHTML.ts index 2a55eb7e0..4ca719154 100644 --- a/js/grunt/generateDevelopmentHTML.ts +++ b/js/grunt/generateDevelopmentHTML.ts @@ -14,7 +14,7 @@ import * as _ from 'lodash'; import IntentionalAny from '../../../phet-core/js/types/IntentionalAny.js'; const ChipperStringUtils = require( '../common/ChipperStringUtils' ); -const fixEOL = require( './fixEOL' ); +import fixEOL from './fixEOL'; const getPreloads = require( './getPreloads' ); const getStringRepos = require( './getStringRepos' ); const writeFileAndGitAdd = require( '../../../perennial-alias/js/common/writeFileAndGitAdd' ); diff --git a/js/grunt/generateREADME.ts b/js/grunt/generateREADME.ts index 443031abd..9ce692078 100644 --- a/js/grunt/generateREADME.ts +++ b/js/grunt/generateREADME.ts @@ -9,7 +9,7 @@ const ChipperStringUtils = require( '../common/ChipperStringUtils' ); -const fixEOL = require( './fixEOL' ); +import fixEOL from './fixEOL'; const getPhetLibs = require( './getPhetLibs' ); const getTitleStringKey = require( './getTitleStringKey' ); const writeFileAndGitAdd = require( '../../../perennial-alias/js/common/writeFileAndGitAdd' ); diff --git a/js/grunt/getA11yViewHTMLFromTemplate.ts b/js/grunt/getA11yViewHTMLFromTemplate.ts index 36ae0bc81..7a8745103 100644 --- a/js/grunt/getA11yViewHTMLFromTemplate.ts +++ b/js/grunt/getA11yViewHTMLFromTemplate.ts @@ -8,7 +8,7 @@ const ChipperConstants = require( '../common/ChipperConstants' ); const ChipperStringUtils = require( '../common/ChipperStringUtils' ); -const fixEOL = require( './fixEOL' ); +import fixEOL from './fixEOL'; const getTitleStringKey = require( './getTitleStringKey' ); import * as grunt from 'grunt'; diff --git a/js/phet-io/formatPhetioAPI.ts b/js/phet-io/formatPhetioAPI.ts index b723a2488..080a95689 100644 --- a/js/phet-io/formatPhetioAPI.ts +++ b/js/phet-io/formatPhetioAPI.ts @@ -11,7 +11,7 @@ */ const assert = require( 'assert' ); -const fixEOL = require( '../grunt/fixEOL' ); +import fixEOL from '../grunt/fixEOL'; import IntentionalAny from '../../../phet-core/js/types/IntentionalAny.ts';