mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-21 14:41:00 -06:00
chore: add linting to the scripts directory (#26197)
This commit is contained in:
@@ -57,6 +57,7 @@ module.exports = {
|
||||
rules: {
|
||||
'no-restricted-properties': 'off',
|
||||
'no-restricted-syntax': 'off',
|
||||
'no-console': 'off',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
const fs = require('fs-extra')
|
||||
const { join } = require('path')
|
||||
const glob = require('glob')
|
||||
|
||||
@@ -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') {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
require('@packages/ts/register')
|
||||
|
||||
const command = process.argv[2]
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
// store the cwd
|
||||
const cwd = process.cwd()
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -13,12 +13,9 @@ 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 */
|
||||
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)
|
||||
|
||||
@@ -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,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
const glob = require('glob')
|
||||
const path = require('path')
|
||||
const fsExtra = require('fs-extra')
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
const fs = require('fs').promises
|
||||
|
||||
async function loadInternalTaskData () {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const versions = require('../browser-versions')
|
||||
const channel = process.argv[2]
|
||||
|
||||
process.stdout.write(versions[channel]) //eslint-disable-line no-console
|
||||
process.stdout.write(versions[channel])
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
|
||||
const path = require('path')
|
||||
const semver = require('semver')
|
||||
const bumpCb = require('conventional-recommended-bump')
|
||||
|
||||
@@ -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,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')
|
||||
|
||||
@@ -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')
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
|
||||
/*
|
||||
Usage - All arguments are required
|
||||
--from <path> local path to repository to import
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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'] ?
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
const childProcess = require('child_process')
|
||||
const _ = require('lodash')
|
||||
const { Octokit } = require('@octokit/core')
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
const childProcess = require('child_process')
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const { userFacingChanges } = require('./change-categories')
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const { validateChangelog } = require('./validate-changelog')
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
const { userFacingChanges } = require('./change-categories')
|
||||
const { parseChangelog } = require('./parse-changelog')
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -76,7 +76,6 @@ program
|
||||
})
|
||||
|
||||
const log = (msg) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(msg)
|
||||
}
|
||||
|
||||
|
||||
@@ -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')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -373,11 +373,9 @@ 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')
|
||||
/* eslint-enable no-console */
|
||||
})
|
||||
|
||||
it('failures of one package release do not prevent subsequent package releases', async () => {
|
||||
@@ -408,12 +406,10 @@ 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:')
|
||||
expect(console.log).to.be.calledWith('the stdout')
|
||||
/* eslint-enable no-console */
|
||||
})
|
||||
|
||||
it('logs success when all release succeed', async () => {
|
||||
@@ -422,9 +418,7 @@ 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 */
|
||||
})
|
||||
|
||||
it('logs failure when one or more releases fail', async () => {
|
||||
@@ -443,12 +437,10 @@ 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
|
||||
- package-3`)
|
||||
/* eslint-enable no-console */
|
||||
})
|
||||
|
||||
it('returns 0 when all releases succeed', async () => {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
const { expect, use } = require('chai')
|
||||
const sinonChai = require('sinon-chai')
|
||||
const sinon = require('sinon')
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
|
||||
const _ = require('lodash')
|
||||
const minimist = require('minimist')
|
||||
const Promise = require('bluebird')
|
||||
|
||||
Reference in New Issue
Block a user