diff --git a/bin/extract_vtfeatures.js b/bin/extract_vtfeatures.js index 63d09684..62ad9ff9 100644 --- a/bin/extract_vtfeatures.js +++ b/bin/extract_vtfeatures.js @@ -359,7 +359,7 @@ function empty(ar) { } function* parseMultiLineGen(filename, s) { - if (!~s.indexOf('@vt:')) { + if (!s.includes('@vt:')) { return; } const lines = s.split('\n').map(el => el.trim().replace(/[*]/, '').replace(/\s/, '')); @@ -413,7 +413,7 @@ function parseSingleLine(filename, s) { const line = s.trim(); const match = line.match(REX_VT_LINE); if (match !== null) { - if (!~TYPES.indexOf(match[2])) { + if (!TYPES.includes(match[2])) { throw new Error(`unkown vt-command type "${match[2]}" specified in "${filename}"`); } return { diff --git a/bin/install-addons.js b/bin/install-addons.js index 83adea1f..99f0a0aa 100644 --- a/bin/install-addons.js +++ b/bin/install-addons.js @@ -25,7 +25,7 @@ if (fs.existsSync(addonsPath)) { // walk all addon folders fs.readdir(addonsPath, (err, files) => { - files.forEach(folder => { + for (const folder of files) { const addonPath = path.join(addonsPath, folder); // install only if there are dependencies listed @@ -51,6 +51,6 @@ if (fs.existsSync(addonsPath)) { } else { console.log('Skipped', folder); } - }); + } }); } diff --git a/bin/publish.js b/bin/publish.js index fd0015d6..64336fdc 100644 --- a/bin/publish.js +++ b/bin/publish.js @@ -11,7 +11,7 @@ const path = require('path'); // Setup auth fs.writeFileSync(`${process.env['HOME']}/.npmrc`, `//registry.npmjs.org/:_authToken=${process.env['NPM_AUTH_TOKEN']}`); -const isDryRun = process.argv.indexOf('--dry') !== -1; +const isDryRun = process.argv.includes('--dry'); if (isDryRun) { console.log('Publish dry run'); } @@ -36,13 +36,13 @@ const addonPackageDirs = [ path.resolve(__dirname, '../addons/xterm-addon-webgl') ]; console.log(`Checking if addons need to be published`); -addonPackageDirs.forEach(p => { +for (const p of addonPackageDirs) { const addon = path.basename(p); - if (changedFiles.some(e => e.indexOf(addon) !== -1)) { + if (changedFiles.some(e => e.includes(addon))) { console.log(`Try publish ${addon}`); checkAndPublishPackage(p); } -}); +} // Publish website if it's a stable release if (isStableRelease) { @@ -54,7 +54,7 @@ function checkAndPublishPackage(packageDir) { // Determine if this is a stable or beta release const publishedVersions = getPublishedVersions(packageJson); - const isStableRelease = publishedVersions.indexOf(packageJson.version) === -1; + const isStableRelease = !publishedVersions.includes(packageJson.version); // Get the next version let nextVersion = isStableRelease ? packageJson.version : getNextBetaVersion(packageJson); diff --git a/bin/test_api.js b/bin/test_api.js index 7afb34bc..eb068b89 100644 --- a/bin/test_api.js +++ b/bin/test_api.js @@ -21,7 +21,7 @@ let flagArgs = []; if (process.argv.length > 2) { const args = process.argv.slice(2); - flagArgs = args.filter(e => e.startsWith('--')).map(arg => arg.split('=')).reduce((arr, val) => arr.concat([...val], [])); + flagArgs = args.filter(e => e.startsWith('--')).map(arg => arg.split('=')).reduce((arr, val) => arr.concat(val.split(''), [])); console.info(flagArgs); // ability to inject particular test files via // yarn test [testFileA testFileB ...] diff --git a/bin/test_mousemodes.js b/bin/test_mousemodes.js index 976a38e0..6a547ab1 100644 --- a/bin/test_mousemodes.js +++ b/bin/test_mousemodes.js @@ -88,19 +88,19 @@ function evalButtonCode(code) { if (code & 64) { button |= 4 } - let actionS = 'press'; + let action = 'press'; let buttonS = reverseButtons[button]; if (button === 3) { buttonS = ''; - actionS = 'release'; + action = 'release'; } if (move) { - actionS = 'move'; + action = 'move'; } else if (4 <= button && button <= 7) { buttonS = 'wheel'; - actionS = button === 4 ? 'up' : button === 5 ? 'down' : button === 6 ? 'left' : 'right'; + action = button === 4 ? 'up' : button === 5 ? 'down' : button === 6 ? 'left' : 'right'; } - return {button: buttonS, action: actionS, modifier}; + return {button: buttonS, action, modifier}; } // protocols