build: update eslint + eslint plugins (#22777)

* build: run eslint --fix

* chore: manually fix all hasOwnProperty errors

* chore: manually fix all void 0 vs undefined errors

* chore: manually fix all async-in-promise errors

* chore: manually fix lexical declaration in case block
This commit is contained in:
Samuel Attard 2020-03-20 08:12:18 -07:00 committed by GitHub
parent 42f138282f
commit b87b501161
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 280 additions and 280 deletions

View file

@ -18,7 +18,7 @@ const CHECK_INTERVAL = 5000
const CACHE_DIR = path.resolve(__dirname, '.cache')
const NO_NOTES = 'No notes'
const FOLLOW_REPOS = [ 'electron/electron', 'electron/node' ]
const FOLLOW_REPOS = ['electron/electron', 'electron/node']
const breakTypes = new Set(['breaking-change'])
const docTypes = new Set(['doc', 'docs'])
@ -222,7 +222,7 @@ const parseCommitMessage = (commitMessage, owner, repo, commit = {}) => {
// Edge case: manual backport where commit has `owner/repo#pull` notation
if (commitMessage.toLowerCase().includes('backport') &&
((match = commitMessage.match(/\b(\w+)\/(\w+)#(\d+)\b/)))) {
const [ , owner, repo, number ] = match
const [, owner, repo, number] = match
if (FOLLOW_REPOS.includes(`${owner}/${repo}`)) {
setPullRequest(commit, owner, repo, number)
}
@ -231,7 +231,7 @@ const parseCommitMessage = (commitMessage, owner, repo, commit = {}) => {
// Edge case: manual backport where commit has a link to the backport PR
if (commitMessage.includes('ackport') &&
((match = commitMessage.match(/https:\/\/github\.com\/(\w+)\/(\w+)\/pull\/(\d+)/)))) {
const [ , owner, repo, number ] = match
const [, owner, repo, number] = match
if (FOLLOW_REPOS.includes(`${owner}/${repo}`)) {
setPullRequest(commit, owner, repo, number)
}
@ -257,8 +257,8 @@ const parseCommitMessage = (commitMessage, owner, repo, commit = {}) => {
}
const getLocalCommitHashes = async (dir, ref) => {
const args = ['log', '-z', `--format=%H`, ref]
return (await runGit(dir, args)).split(`\0`).map(hash => hash.trim())
const args = ['log', '-z', '--format=%H', ref]
return (await runGit(dir, args)).split('\0').map(hash => hash.trim())
}
/*
@ -272,13 +272,13 @@ const getLocalCommitDetails = async (module, point1, point2) => {
const fieldSep = '||'
const format = ['%H', '%P', '%aE', '%B'].join(fieldSep)
const args = ['log', '-z', '--cherry-pick', '--right-only', '--first-parent', `--format=${format}`, `${point1}..${point2}`]
const commits = (await runGit(dir, args)).split(`\0`).map(field => field.trim())
const commits = (await runGit(dir, args)).split('\0').map(field => field.trim())
const details = []
for (const commit of commits) {
if (!commit) {
continue
}
const [ hash, parentHashes, email, commitMessage ] = commit.split(fieldSep, 4).map(field => field.trim())
const [hash, parentHashes, email, commitMessage] = commit.split(fieldSep, 4).map(field => field.trim())
details.push(parseCommitMessage(commitMessage, owner, repo, {
email,
hash,
@ -496,7 +496,7 @@ const getNotes = async (fromRef, toRef, newVersion) => {
if (!shouldIncludeMultibranchChanges(newVersion)) {
// load all the prDatas
await Promise.all(
pool.commits.map(commit => new Promise(async (resolve) => {
pool.commits.map(commit => (async () => {
const { pr } = commit
if (typeof pr === 'object') {
const prData = await getPullRequest(pr.number, pr.owner, pr.repo)
@ -504,8 +504,7 @@ const getNotes = async (fromRef, toRef, newVersion) => {
commit.prData = prData
}
}
resolve()
}))
})())
)
// remove items that already landed in a previous major/minor series
@ -616,22 +615,22 @@ const renderCommit = (commit, explicitLinks) => {
}
const commonVerbs = {
'Added': [ 'Add' ],
'Backported': [ 'Backport' ],
'Cleaned': [ 'Clean' ],
'Disabled': [ 'Disable' ],
'Ensured': [ 'Ensure' ],
'Exported': [ 'Export' ],
'Fixed': [ 'Fix', 'Fixes' ],
'Handled': [ 'Handle' ],
'Improved': [ 'Improve' ],
'Made': [ 'Make' ],
'Removed': [ 'Remove' ],
'Repaired': [ 'Repair' ],
'Reverted': [ 'Revert' ],
'Stopped': [ 'Stop' ],
'Updated': [ 'Update' ],
'Upgraded': [ 'Upgrade' ]
Added: ['Add'],
Backported: ['Backport'],
Cleaned: ['Clean'],
Disabled: ['Disable'],
Ensured: ['Ensure'],
Exported: ['Export'],
Fixed: ['Fix', 'Fixes'],
Handled: ['Handle'],
Improved: ['Improve'],
Made: ['Make'],
Removed: ['Remove'],
Repaired: ['Repair'],
Reverted: ['Revert'],
Stopped: ['Stop'],
Updated: ['Update'],
Upgraded: ['Upgrade']
}
for (const [key, values] of Object.entries(commonVerbs)) {
for (const value of values) {
@ -649,7 +648,7 @@ const renderCommit = (commit, explicitLinks) => {
}
const renderNotes = (notes, explicitLinks) => {
const rendered = [ `# Release Notes for ${notes.name}\n\n` ]
const rendered = [`# Release Notes for ${notes.name}\n\n`]
const renderSection = (title, commits) => {
if (commits.length === 0) {