Skip to content

Commit 1630ade

Browse files
committed
fix: remove max-len linting bypasses
1 parent 02512d1 commit 1630ade

25 files changed

+7
-103
lines changed

lib/base-cmd.js

-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ class BaseCommand {
124124
} else if (!this.npm.config.isDefault('expect-result-count')) {
125125
const expected = this.npm.config.get('expect-result-count')
126126
if (expected !== entries) {
127-
/* eslint-disable-next-line max-len */
128127
log.warn(this.name, `Expected ${expected} result${expected === 1 ? '' : 's'}, got ${entries}`)
129128
process.exitCode = 1
130129
}

lib/cli/entry.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable max-len */
2-
31
// Separated out for easier unit testing
42
module.exports = async (process, validateEngines) => {
53
// set it here so that regardless of what happens later, we don't

lib/cli/validate-engines.js

-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ const npm = `v${version}`
1111
module.exports = (process, getCli) => {
1212
const node = process.version
1313

14-
/* eslint-disable-next-line max-len */
1514
const unsupportedMessage = `npm ${npm} does not support Node.js ${node}. This version of npm supports the following node versions: \`${engines}\`. You can find the latest version at https://nodejs.org/.`
1615

17-
/* eslint-disable-next-line max-len */
1816
const brokenMessage = `ERROR: npm ${npm} is known not to run on Node.js ${node}. This version of npm supports the following node versions: \`${engines}\`. You can find the latest version at https://nodejs.org/.`
1917

2018
// coverage ignored because this is only hit in very unsupported node versions

lib/commands/cache.js

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const localeCompare = require('@isaacs/string-locale-compare')('en')
1010
const { log, output } = require('proc-log')
1111

1212
const searchCachePackage = async (path, parsed, cacheKeys) => {
13-
/* eslint-disable-next-line max-len */
1413
const searchMFH = new RegExp(`^make-fetch-happen:request-cache:.*(?<!/[@a-zA-Z]+)/${parsed.name}/-/(${parsed.name}[^/]+.tgz)$`)
1514
const searchPack = new RegExp(`^make-fetch-happen:request-cache:.*/${parsed.escapedName}$`)
1615
const results = new Set()
@@ -181,7 +180,6 @@ class Cache extends BaseCommand {
181180
output.standard(`Corrupted content removed: ${stats.badContentCount}`)
182181
}
183182
if (stats.reclaimedCount) {
184-
/* eslint-disable-next-line max-len */
185183
output.standard(`Content garbage-collected: ${stats.reclaimedCount} (${stats.reclaimedSize} bytes)`)
186184
}
187185
if (stats.missingContent) {

lib/commands/doctor.js

-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ class Doctor extends BaseCommand {
128128

129129
if (!allOk) {
130130
if (this.npm.silent) {
131-
/* eslint-disable-next-line max-len */
132131
throw new Error('Some problems found. Check logs or disable silent mode for recommendations.')
133132
} else {
134133
throw new Error('Some problems found. See above for recommendations.')

lib/commands/install.js

-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ class Install extends ArboristWorkspaceCmd {
115115
if (forced) {
116116
log.warn(
117117
'install',
118-
/* eslint-disable-next-line max-len */
119118
`Forcing global npm install with incompatible version ${npmManifest.version} into node ${process.version}`
120119
)
121120
} else {

lib/commands/org.js

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class Org extends BaseCommand {
6161

6262
if (!['owner', 'admin', 'developer'].find(x => x === role)) {
6363
throw new Error(
64-
/* eslint-disable-next-line max-len */
6564
'Third argument `role` must be one of `owner`, `admin`, or `developer`, with `developer` being the default value if omitted.'
6665
)
6766
}

lib/commands/publish.js

-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class Publish extends BaseCommand {
6161
if (err.code !== 'EPRIVATE') {
6262
throw err
6363
}
64-
// eslint-disable-next-line max-len
6564
log.warn('publish', `Skipping workspace ${this.npm.chalk.cyan(name)}, marked as ${this.npm.chalk.bold('private')}`)
6665
}
6766
}
@@ -161,7 +160,6 @@ class Publish extends BaseCommand {
161160
const latestSemverIsGreater = !!latestVersion && semver.gte(latestVersion, manifest.version)
162161

163162
if (latestSemverIsGreater && isDefaultTag) {
164-
/* eslint-disable-next-line max-len */
165163
throw new Error(`Cannot implicitly apply the "latest" tag because published version ${latestVersion} is higher than the new version ${manifest.version}. You must specify a tag using --tag.`)
166164
}
167165

@@ -238,7 +236,6 @@ class Publish extends BaseCommand {
238236
const changes = []
239237
const pkg = await pkgJson.fix(spec.fetchSpec, { changes })
240238
if (changes.length && logWarnings) {
241-
/* eslint-disable-next-line max-len */
242239
log.warn('publish', 'npm auto-corrected some errors in your package.json when publishing. Please run "npm pkg fix" to address these errors.')
243240
log.warn('publish', `errors corrected:\n${changes.join('\n')}`)
244241
}

lib/commands/sbom.js

-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class SBOM extends BaseCommand {
2727
const packageLockOnly = this.npm.config.get('package-lock-only')
2828

2929
if (!sbomFormat) {
30-
/* eslint-disable-next-line max-len */
3130
throw this.usageError(`Must specify --sbom-format flag with one of: ${SBOM_FORMATS.join(', ')}.`)
3231
}
3332

@@ -40,7 +39,6 @@ class SBOM extends BaseCommand {
4039
const arb = new Arborist(opts)
4140

4241
const tree = packageLockOnly ? await arb.loadVirtual(opts).catch(() => {
43-
/* eslint-disable-next-line max-len */
4442
throw this.usageError('A package lock or shrinkwrap file is required in package-lock-only mode')
4543
}) : await arb.loadActual(opts)
4644

lib/commands/token.js

-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ class Token extends BaseCommand {
7373
for (const token of tokens) {
7474
const level = token.readonly ? 'Read only token' : 'Publish token'
7575
const created = String(token.created).slice(0, 10)
76-
/* eslint-disable-next-line max-len */
7776
output.standard(`${chalk.blue(level)} ${token.token}… with id ${chalk.cyan(token.id)} created ${created}`)
7877
if (token.cidr_whitelist) {
7978
output.standard(`with IP whitelist: ${chalk.green(token.cidr_whitelist.join(','))}`)
@@ -99,7 +98,6 @@ class Token extends BaseCommand {
9998
toRemove.push(matches[0].key)
10099
} else if (matches.length > 1) {
101100
throw new Error(
102-
/* eslint-disable-next-line max-len */
103101
`Token ID "${id}" was ambiguous, a new token may have been created since you last ran \`npm token list\`.`
104102
)
105103
} else {

lib/commands/version.js

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class Version extends BaseCommand {
2222
static workspaces = true
2323
static ignoreImplicitWorkspace = false
2424

25-
/* eslint-disable-next-line max-len */
2625
static usage = ['[<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]']
2726

2827
static async completion (opts) {

lib/utils/did-you-mean.js

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const didYouMean = (pkg, scmd) => {
1919
.map(str => [`run ${str}`, `run the "${str}" package script`]),
2020
...Object.keys(bin)
2121
.filter(cmd => isClose(scmd, cmd))
22-
/* eslint-disable-next-line max-len */
2322
.map(str => [`exec ${str}`, `run the "${str}" command from either this or a remote npm package`]),
2423
]
2524

lib/utils/format-search-stream.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable max-len */
21
const { stripVTControlCharacters: strip } = require('node:util')
32
const { Minipass } = require('minipass')
43

@@ -83,7 +82,10 @@ class TextOutputStream extends Minipass {
8382
constructor (opts) {
8483
super()
8584
// Consider a search for "cowboys" and "boy". If we highlight "boys" first the "cowboys" string will no longer string match because of the ansi highlighting added to "boys". If we highlight "boy" second then the ansi reset at the end will make the highlighting only on "cowboy" with a normal "s". Neither is perfect but at least the first option doesn't do partial highlighting. So, we sort strings smaller to larger
86-
this.#args = opts.args.map(s => s.toLowerCase()).filter(Boolean).sort((a, b) => a.length - b.length)
85+
this.#args = opts.args
86+
.map(s => s.toLowerCase())
87+
.filter(Boolean)
88+
.sort((a, b) => a.length - b.length)
8789
this.#chalk = opts.npm.chalk
8890
this.#exclude = opts.exclude
8991
this.#parseable = opts.parseable

lib/utils/reify-output.js

-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ const reifyOutput = (npm, arb) => {
5050
switch (d.action) {
5151
case 'REMOVE':
5252
if (showDiff) {
53-
/* eslint-disable-next-line max-len */
5453
output.standard(`${chalk.blue('remove')} ${d.actual.name} ${d.actual.package.version}`)
5554
}
5655
summary.removed++
@@ -63,7 +62,6 @@ const reifyOutput = (npm, arb) => {
6362
break
6463
case 'CHANGE':
6564
if (showDiff) {
66-
/* eslint-disable-next-line max-len */
6765
output.standard(`${chalk.cyan('change')} ${d.actual.name} ${d.actual.package.version} => ${d.ideal.package.version}`)
6866
}
6967
summary.changed++

lib/utils/tar.js

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ const logTar = (tarball, { unicode = false, json, key } = {}) => {
3636
log.notice('', `package size: ${formatBytes(tarball.size)}`)
3737
log.notice('', `unpacked size: ${formatBytes(tarball.unpackedSize)}`)
3838
log.notice('', `shasum: ${tarball.shasum}`)
39-
/* eslint-disable-next-line max-len */
4039
log.notice('', `integrity: ${tarball.integrity.toString().slice(0, 20)}[...]${tarball.integrity.toString().slice(80)}`)
4140
if (tarball.bundled.length) {
4241
log.notice('', `bundled deps: ${tarball.bundled.length}`)

lib/utils/verify-signatures.js

-10
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,17 @@ class VerifySignatures {
7575
const verifiedBold = this.npm.chalk.bold('verified')
7676
if (this.verifiedSignatureCount) {
7777
if (this.verifiedSignatureCount === 1) {
78-
/* eslint-disable-next-line max-len */
7978
output.standard(`${this.verifiedSignatureCount} package has a ${verifiedBold} registry signature`)
8079
} else {
81-
/* eslint-disable-next-line max-len */
8280
output.standard(`${this.verifiedSignatureCount} packages have ${verifiedBold} registry signatures`)
8381
}
8482
output.standard('')
8583
}
8684

8785
if (this.verifiedAttestationCount) {
8886
if (this.verifiedAttestationCount === 1) {
89-
/* eslint-disable-next-line max-len */
9087
output.standard(`${this.verifiedAttestationCount} package has a ${verifiedBold} attestation`)
9188
} else {
92-
/* eslint-disable-next-line max-len */
9389
output.standard(`${this.verifiedAttestationCount} packages have ${verifiedBold} attestations`)
9490
}
9591
output.standard('')
@@ -98,10 +94,8 @@ class VerifySignatures {
9894
if (missing.length) {
9995
const missingClr = this.npm.chalk.redBright('missing')
10096
if (missing.length === 1) {
101-
/* eslint-disable-next-line max-len */
10297
output.standard(`1 package has a ${missingClr} registry signature but the registry is providing signing keys:`)
10398
} else {
104-
/* eslint-disable-next-line max-len */
10599
output.standard(`${missing.length} packages have ${missingClr} registry signatures but the registry is providing signing keys:`)
106100
}
107101
output.standard('')
@@ -121,7 +115,6 @@ class VerifySignatures {
121115
if (invalidSignatures.length === 1) {
122116
output.standard(`1 package has an ${invalidClr} registry signature:`)
123117
} else {
124-
/* eslint-disable-next-line max-len */
125118
output.standard(`${invalidSignatures.length} packages have ${invalidClr} registry signatures:`)
126119
}
127120
output.standard('')
@@ -136,7 +129,6 @@ class VerifySignatures {
136129
if (invalidAttestations.length === 1) {
137130
output.standard(`1 package has an ${invalidClr} attestation:`)
138131
} else {
139-
/* eslint-disable-next-line max-len */
140132
output.standard(`${invalidAttestations.length} packages have ${invalidClr} attestations:`)
141133
}
142134
output.standard('')
@@ -147,10 +139,8 @@ class VerifySignatures {
147139
}
148140

149141
if (invalid.length === 1) {
150-
/* eslint-disable-next-line max-len */
151142
output.standard(`Someone might have tampered with this package since it was published on the registry!`)
152143
} else {
153-
/* eslint-disable-next-line max-len */
154144
output.standard(`Someone might have tampered with these packages since they were published on the registry!`)
155145
}
156146
output.standard('')

tap-snapshots/test/lib/commands/install.js.test.cjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ silly logfile done cleaning log files
134134
verbose stack Error: The developer of this package has specified the following through devEngines
135135
verbose stack Invalid engine "runtime"
136136
verbose stack Invalid name "nondescript" does not match "node" for "runtime"
137-
verbose stack at Install.checkDevEngines ({CWD}/lib/base-cmd.js:182:27)
137+
verbose stack at Install.checkDevEngines ({CWD}/lib/base-cmd.js:181:27)
138138
verbose stack at MockNpm.#exec ({CWD}/lib/npm.js:251:7)
139139
verbose stack at MockNpm.exec ({CWD}/lib/npm.js:207:9)
140140
error code EBADDEVENGINES
@@ -199,7 +199,7 @@ warn EBADDEVENGINES }
199199
verbose stack Error: The developer of this package has specified the following through devEngines
200200
verbose stack Invalid engine "runtime"
201201
verbose stack Invalid name "nondescript" does not match "node" for "runtime"
202-
verbose stack at Install.checkDevEngines ({CWD}/lib/base-cmd.js:182:27)
202+
verbose stack at Install.checkDevEngines ({CWD}/lib/base-cmd.js:181:27)
203203
verbose stack at MockNpm.#exec ({CWD}/lib/npm.js:251:7)
204204
verbose stack at MockNpm.exec ({CWD}/lib/npm.js:207:9)
205205
error code EBADDEVENGINES
@@ -225,7 +225,7 @@ silly logfile done cleaning log files
225225
verbose stack Error: The developer of this package has specified the following through devEngines
226226
verbose stack Invalid engine "runtime"
227227
verbose stack Invalid name "nondescript" does not match "node" for "runtime"
228-
verbose stack at Install.checkDevEngines ({CWD}/lib/base-cmd.js:182:27)
228+
verbose stack at Install.checkDevEngines ({CWD}/lib/base-cmd.js:181:27)
229229
verbose stack at MockNpm.#exec ({CWD}/lib/npm.js:251:7)
230230
verbose stack at MockNpm.exec ({CWD}/lib/npm.js:207:9)
231231
error code EBADDEVENGINES

test/lib/cli/exit-handler.js

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ t.cleanSnapshot = (path) => cleanDate(cleanCwd(path))
4646
mockGlobals(t, {
4747
process: Object.assign(new EventEmitter(), {
4848
// these are process properties that are needed in the running code and tests
49-
// eslint-disable-next-line max-len
5049
...pick(process, 'version', 'execPath', 'stdout', 'stderr', 'stdin', 'cwd', 'chdir', 'env', 'umask'),
5150
pid: 123456,
5251
argv: ['/node', ...process.argv.slice(1)],

test/lib/cli/validate-engines.js

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ t.test('validate engines', async t => {
2323
node: 'v4.5.6',
2424
npm: 'v1.2.3',
2525
engines: '>=0',
26-
/* eslint-disable-next-line max-len */
2726
unsupportedMessage: 'npm v1.2.3 does not support Node.js v4.5.6. This version of npm supports the following node versions: `>=0`. You can find the latest version at https://nodejs.org/.',
2827
})
2928

test/lib/commands/audit.js

-6
Original file line numberDiff line numberDiff line change
@@ -825,12 +825,9 @@ t.test('audit signatures', async t => {
825825
packuments: [{
826826
version: '1.0.0',
827827
dist: {
828-
// eslint-disable-next-line max-len
829828
integrity: 'sha512-e+qfbn/zf1+rCza/BhIA//Awmf0v1pa5HQS8Xk8iXrn9bgytytVLqYD0P7NSqZ6IELTgq+tcDvLPkQjNHyWLNg==',
830829
tarball: 'https://registry.npmjs.org/sigstore/-/sigstore-1.0.0.tgz',
831-
// eslint-disable-next-line max-len
832830
attestations: { url: 'https://registry.npmjs.org/-/npm/v1/attestations/[email protected]', provenance: { predicateType: 'https://slsa.dev/provenance/v0.2' } },
833-
// eslint-disable-next-line max-len
834831
signatures: [{ keyid: 'SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA', sig: 'MEQCIBlpcHT68iWOpx8pJr3WUzD1EqQ7tb0CmY36ebbceR6IAiAVGRaxrFoyh0/5B7H1o4VFhfsHw9F8G+AxOZQq87q+lg==' }],
835832
},
836833
}],
@@ -844,12 +841,9 @@ t.test('audit signatures', async t => {
844841
packuments: [{
845842
version: '1.0.0',
846843
dist: {
847-
// eslint-disable-next-line max-len
848844
integrity: 'sha512-1dxsQwESDzACJjTdYHQ4wJ1f/of7jALWKfJEHSBWUQB/5UTJUx9SW6GHXp4mZ1KvdBRJCpGjssoPFGi4hvw8/A==',
849845
tarball: 'https://registry.npmjs.org/tuf-js/-/tuf-js-1.0.0.tgz',
850-
// eslint-disable-next-line max-len
851846
attestations: { url: 'https://registry.npmjs.org/-/npm/v1/attestations/[email protected]', provenance: { predicateType: 'https://slsa.dev/provenance/v0.2' } },
852-
// eslint-disable-next-line max-len
853847
signatures: [{ keyid: 'SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA', sig: 'MEYCIQDgGQeY2QLkLuoO9YxOqFZ+a6zYuaZpXhc77kUfdCUXDQIhAJp/vV+9Xg1bfM5YlTvKIH9agUEOu5T76+tQaHY2vZyO' }],
854848
},
855849
}],

test/lib/commands/cache.js

-14
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ t.test('cache add single pkg', async t => {
7878
})
7979
await npm.exec('cache', ['add', pkg])
8080
t.equal(joinedOutput(), '')
81-
// eslint-disable-next-line max-len
8281
t.resolves(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package/-/test-package-1.0.0.tgz'))
83-
// eslint-disable-next-line max-len
8482
t.resolves(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package'))
8583
})
8684

@@ -113,20 +111,15 @@ t.test('cache add multiple pkgs', async t => {
113111
})
114112
await npm.exec('cache', ['add', pkg, pkg2])
115113
t.equal(joinedOutput(), '')
116-
// eslint-disable-next-line max-len
117114
t.resolves(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package/-/test-package-1.0.0.tgz'))
118-
// eslint-disable-next-line max-len
119115
t.resolves(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package'))
120-
// eslint-disable-next-line max-len
121116
t.resolves(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package-two/-/test-package-two-1.0.0.tgz'))
122-
// eslint-disable-next-line max-len
123117
t.resolves(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package-two'))
124118
})
125119

126120
t.test('cache ls', async t => {
127121
const keys = [
128122
'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package',
129-
// eslint-disable-next-line max-len
130123
'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package/-/test-package-1.0.0.tgz',
131124
]
132125
const { npm, joinedOutput } = await loadMockNpm(t)
@@ -204,10 +197,8 @@ t.test('cache ls tagged', async t => {
204197

205198
t.test('cache ls scoped and scoped slash', async t => {
206199
const keys = [
207-
// eslint-disable-next-line max-len
208200
'make-fetch-happen:request-cache:https://registry.npmjs.org/@fritzy/staydown/-/@fritzy/staydown-3.1.1.tgz',
209201
'make-fetch-happen:request-cache:https://registry.npmjs.org/@fritzy%2fstaydown',
210-
// eslint-disable-next-line max-len
211202
'make-fetch-happen:request-cache:https://registry.npmjs.org/@gar/npm-expansion/-/@gar/npm-expansion-2.1.0.tgz',
212203
'make-fetch-happen:request-cache:https://registry.npmjs.org/@gar%2fnpm-expansion',
213204
]
@@ -248,16 +239,11 @@ t.test('cache ls missing packument version not an object', async t => {
248239
t.test('cache rm', async t => {
249240
const { npm, joinedOutput } = await loadMockNpm(t)
250241
const cache = path.join(npm.cache, '_cacache')
251-
// eslint-disable-next-line max-len
252242
await cacache.put(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package', '{}')
253-
// eslint-disable-next-line max-len
254243
await cacache.put(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package/-/test-package-1.0.0.tgz', 'test data')
255-
// eslint-disable-next-line max-len
256244
await npm.exec('cache', ['rm', 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package/-/test-package-1.0.0.tgz'])
257245
t.matchSnapshot(joinedOutput(), 'logs deleting single entry')
258-
// eslint-disable-next-line max-len
259246
t.resolves(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package'))
260-
// eslint-disable-next-line max-len
261247
t.rejects(cacache.get(cache, 'make-fetch-happen:request-cache:https://registry.npmjs.org/test-package/-/test-package-1.0.0.tgz'))
262248
})
263249

test/lib/commands/help-search.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const t = require('tap')
22
const { load: loadMockNpm } = require('../../fixtures/mock-npm.js')
33

4-
/* eslint-disable max-len */
54
const docsFixtures = {
65
dir1: {
76
'npm-exec.md': 'the exec command\nhelp has multiple lines of exec help\none of them references exec',
@@ -19,7 +18,6 @@ const docsFixtures = {
1918
'npm-extra-useless.md': 'exec\nexec\nexec',
2019
},
2120
}
22-
/* eslint-enable max-len */
2321

2422
const execHelpSearch = async (t, exec = [], opts) => {
2523
const { npm, ...rest } = await loadMockNpm(t, {

0 commit comments

Comments
 (0)