Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add linting to the scripts directory #26197

Merged
merged 3 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module.exports = {
rules: {
'no-restricted-properties': 'off',
'no-restricted-syntax': 'off',
'no-console': 'off',
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"ensure-deps": "./scripts/ensure-dependencies.sh",
"get-next-version": "node scripts/get-next-version.js",
"postinstall": "node ./scripts/run-postInstall.js",
"lint": "lerna run lint --no-bail --concurrency 2",
"lint": "lerna run lint --no-bail --concurrency 2 && eslint --ext .js,.ts,.json, scripts",
"prepare-release-artifacts": "node ./scripts/prepare-release-artifacts.js",
"npm-release": "node scripts/npm-release.js",
"prestart": "yarn ensure-deps",
Expand Down
2 changes: 0 additions & 2 deletions scripts/add-install-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ const { Octokit } = require('@octokit/core')
const { createAppAuth } = require('@octokit/auth-app')
const { stripIndent } = require('common-tags')

/* eslint-disable no-console */

const { npm, binary } = getNameAndBinary(process.argv)

la(is.unemptyString(npm), 'missing npm url')
Expand Down
1 change: 0 additions & 1 deletion scripts/after-pack-hook.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const fs = require('fs-extra')
const { join } = require('path')
const glob = require('glob')
Expand Down
2 changes: 0 additions & 2 deletions scripts/after-sign-hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const fs = require('fs')
const path = require('path')
let electron_notarize = require('electron-notarize')

/* eslint-disable no-console */

module.exports = async function (params) {
// Only notarize the app on Mac OS.
if (process.platform !== 'darwin') {
Expand Down
1 change: 0 additions & 1 deletion scripts/binary.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
require('@packages/ts/register')

const command = process.argv[2]
Expand Down
3 changes: 0 additions & 3 deletions scripts/binary/binary-cleanup.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,10 @@ const createServerEntryPointBundle = async (buildAppDir) => {
],
})

// eslint-disable-next-line no-console
console.log(`copying server entry point bundle from ${path.join(workingDir, 'index.js')} to ${path.join(buildAppDir, 'packages', 'server', 'index.js')}`)

await fs.copy(path.join(workingDir, 'index.js'), path.join(buildAppDir, 'packages', 'server', 'index.js'))

// eslint-disable-next-line no-console
console.log(`compiling server entry point bundle to ${path.join(buildAppDir, 'packages', 'server', 'index.jsc')}`)

// Use bytenode to compile the entry point bundle. This will save time on the v8 compile step and ensure the integrity of the entry point
Expand Down Expand Up @@ -171,7 +169,6 @@ const buildEntryPointAndCleanup = async (buildAppDir) => {
...serverEntryPointBundleDependencies,
]

// eslint-disable-next-line no-console
console.log(`potentially removing ${potentiallyRemovedDependencies.length} dependencies`)

// 4. Remove all dependencies that are in the snapshot but not in the list of kept dependencies from the binary
Expand Down
1 change: 0 additions & 1 deletion scripts/binary/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
// store the cwd
const cwd = process.cwd()

Expand Down
3 changes: 0 additions & 3 deletions scripts/binary/util/transform-requires.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ const rewritePackageNames = (fileStr, buildRoot, filePath, onFound) => {

const replaceString = `${match[1]}${replaceWith}${afterPkg}`

// eslint-disable-next-line no-console
console.log()
// eslint-disable-next-line no-console
console.log('resolve:', chalk.grey(pkgPath), '\nfrom:', chalk.grey(filePath))
// eslint-disable-next-line no-console
console.log(chalk.yellow(`@packages/${pkg}`), '->', chalk.green(replaceWith))

onFound && onFound(replaceString)
Expand Down
2 changes: 0 additions & 2 deletions scripts/check-node-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ const nodeVersion = process.versions.node.split('.')

// check just major version for now
if (nodeVersionNeeded[0] !== nodeVersion[0]) {
/* eslint-disable no-console */
console.error('🛑 .node-version specified %s', nodeVersionNeededString)
console.error('but current Node is %s', process.versions.node)
/* eslint-enable no-console */
mschile marked this conversation as resolved.
Show resolved Hide resolved
process.exit(1)
}

// eslint-disable-next-line no-console
console.log('✅ current Node version of %s matches the version specified in the .node-version file', process.versions.node)
1 change: 0 additions & 1 deletion scripts/check-terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ if (isMainLinux) {

assert.ok(process.env.COLUMNS === '100', `process.env.COLUMNS=${process.env.COLUMNS} must be set to 100 for snapshots to pass`)

/* eslint-disable no-console */
console.log('stdout.isTTY?', process.stdout.isTTY)
console.log('stderr.isTTY?', process.stderr.isTTY)
1 change: 0 additions & 1 deletion scripts/circle-cache.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const glob = require('glob')
const path = require('path')
const fsExtra = require('fs-extra')
Expand Down
1 change: 0 additions & 1 deletion scripts/circle-env.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const fs = require('fs').promises

async function loadInternalTaskData () {
Expand Down
1 change: 0 additions & 1 deletion scripts/cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ debug('starting the CLI in dev mode with args %o', {

const exit = ({ exitCode }) => {
if (typeof exitCode !== 'number') {
// eslint-disable-next-line no-console
console.error(`missing exit code from execa (received ${exitCode})`)
process.exit(1)
}
Expand Down
2 changes: 0 additions & 2 deletions scripts/get-next-version.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-console */

const path = require('path')
const semver = require('semver')
const bumpCb = require('conventional-recommended-bump')
Expand Down
1 change: 0 additions & 1 deletion scripts/get-platform-key.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
// generate a unique key for each platform+arch combo in CI
// eslint-disable-next-line no-console
console.log(`${process.platform}-${process.arch}`)
1 change: 0 additions & 1 deletion scripts/github-actions/semantic-pull-request/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const { validatePrTitle } = require('./validate-pr-title')
const { validateChangelog } = require('../../semantic-commits/validate-changelog')
const { getLinkedIssues } = require('../../semantic-commits/get-linked-issues')
Expand Down
2 changes: 0 additions & 2 deletions scripts/github-actions/update-browser-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const getVersions = async ({ core }) => {
core.setOutput('latest_beta_version', betaData.version)
core.setOutput('description', description)
} catch (err) {
// eslint-disable-next-line no-console
console.log('Errored checking for new Chrome versions:', err.stack)
core.setOutput('has_update', 'false')
}
Expand Down Expand Up @@ -96,7 +95,6 @@ const updatePRTitle = async ({ context, github, baseBranch, branchName, descript
})

if (!data.length) {
// eslint-disable-next-line no-console
console.log('Could not find PR for branch:', branchName)

return
Expand Down
4 changes: 3 additions & 1 deletion scripts/gulp/tasks/gulpGraphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ export async function syncRemoteGraphQL () {
// TODO(tim): fix
await fs.ensureDir(path.join(monorepoPaths.pkgGraphql, 'src/gen'))
await fs.promises.writeFile(path.join(monorepoPaths.pkgGraphql, 'schemas/cloud.graphql'), body)
} catch {}
} catch (error) {
console.error('Could not sync remote GraphQL schema', error)
}
}

/**
Expand Down
3 changes: 0 additions & 3 deletions scripts/gulp/utils/childProcessUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,16 @@ export const execAsync = async (
const { silent } = options

if (!silent) {
// eslint-disable-next-line no-console
console.log(command)
}

const result = await execAsyncLocal(command, options)

if (!silent && typeof result.stdout === 'string' && result.stdout.length) {
// eslint-disable-next-line no-console
console.log(result.stdout)
}

if (!silent && typeof result.stderr === 'string' && result.stderr.length) {
// eslint-disable-next-line no-console
console.error(result.stderr)
}

Expand Down
2 changes: 0 additions & 2 deletions scripts/import.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-console */

/*
Usage - All arguments are required
--from <path> local path to repository to import
Expand Down
1 change: 0 additions & 1 deletion scripts/npm-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* To easily test if your release will apply locally, you can run:
* yarn test-npm-package-release-script
*/
/* eslint-disable no-console */
const execa = require('execa')
const fs = require('fs')
const semverSortNewestFirst = require('semver/functions/rcompare')
Expand Down
1 change: 0 additions & 1 deletion scripts/prepare-release-artifacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ if (!/^\d+\.\d+\.\d+$/.test(args.version)) {
throw new Error('A valid semantic version (X.Y.Z) must be passed in `--version`.')
}

// eslint-disable-next-line no-console
const log = (...args) => console.log('🏗', ...args)

const exec = args['dry-run'] ?
Expand Down
1 change: 0 additions & 1 deletion scripts/semantic-commits/get-binary-release-data.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const childProcess = require('child_process')
const _ = require('lodash')
const { Octokit } = require('@octokit/core')
Expand Down
1 change: 0 additions & 1 deletion scripts/semantic-commits/get-current-release-data.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const childProcess = require('child_process')

/**
Expand Down
1 change: 0 additions & 1 deletion scripts/semantic-commits/parse-changelog.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const fs = require('fs')
const path = require('path')
const { userFacingChanges } = require('./change-categories')
Expand Down
1 change: 0 additions & 1 deletion scripts/semantic-commits/validate-binary-changelog.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const fs = require('fs')
const path = require('path')
const { validateChangelog } = require('./validate-changelog')
Expand Down
1 change: 0 additions & 1 deletion scripts/semantic-commits/validate-changelog.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const { userFacingChanges } = require('./change-categories')
const { parseChangelog } = require('./parse-changelog')

Expand Down
1 change: 0 additions & 1 deletion scripts/sync-exported-npm-with-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ packlist({ path: currentPackageDir })

const output = `${JSON.stringify(cliPackageConfig, null, 2) }\n`

// eslint-disable-next-line no-console
console.log('Writing to CLI package.json for', exportName)

fs.writeFileSync(path.join(cliPath, 'package.json'), output, 'utf-8')
Expand Down
1 change: 0 additions & 1 deletion scripts/type_check.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ program
})

const log = (msg) => {
// eslint-disable-next-line no-console
console.log(msg)
}

Expand Down
1 change: 0 additions & 1 deletion scripts/unit/github-actions/update-browser-version-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ describe('update browser version github action', () => {
})

expect(github.pulls.update).not.to.be.called
// eslint-disable-next-line no-console
expect(console.log).to.be.calledWith('Could not find PR for branch:', 'some-branch-name')
})
})
Expand Down
4 changes: 0 additions & 4 deletions scripts/unit/npm-release-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ describe('semantic release', () => {
execaStub.returns({ stdout: 'the stdout' })
await releasePackages(['package-1', 'package-2'])

/* eslint-disable no-console */
expect(console.log).to.be.calledWith('Released package-1 successfully:')
expect(console.log).to.be.calledWith('Released package-2 successfully:')
expect(console.log).to.be.calledWith('the stdout')
Expand Down Expand Up @@ -408,7 +407,6 @@ describe('semantic release', () => {

await releasePackages(['package-1', 'package-2'])

/* eslint-disable no-console */
expect(console.log).to.be.calledWith('Releasing package-1 failed:')
expect(console.log).to.be.calledWith('could not release package-1')
expect(console.log).to.be.calledWith('Released package-2 successfully:')
Expand All @@ -422,7 +420,6 @@ describe('semantic release', () => {
execaStub.returns({ stdout: 'the stdout' })
await releasePackages(['package-1', 'package-2'])

/* eslint-disable no-console */
expect(console.log).to.be.calledWith('\nAll packages released successfully')
/* eslint-enable no-console */
})
Expand All @@ -443,7 +440,6 @@ describe('semantic release', () => {

await releasePackages(['package-1', 'package-2', 'package-3'])

/* eslint-disable no-console */
expect(console.log).to.be.calledWith(`
The following packages failed to release:
- package-1
Expand Down
1 change: 0 additions & 1 deletion scripts/unit/semantic-commits/validate-changelog-spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const { expect, use } = require('chai')
const sinonChai = require('sinon-chai')
const sinon = require('sinon')
Expand Down
2 changes: 0 additions & 2 deletions scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const path = require('path')
const fs = require('fs')
const execa = require('execa')

/* eslint-disable no-console */

function getNameAndBinary (args = process.argv) {
const options = minimist(args)

Expand Down
2 changes: 0 additions & 2 deletions scripts/verify-mocha-results.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-console */

// this is a safety script to ensure that Mocha tests ran, by checking:
// 1. that there are N test results in the reports dir (or at least 1, if N is not set)
// 2. each of them contains 0 failures and >0 tests
Expand Down
2 changes: 0 additions & 2 deletions scripts/wait-on-circle-jobs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-console */

const _ = require('lodash')
const minimist = require('minimist')
const Promise = require('bluebird')
Expand Down