style: no unnecessary boolean literal compare
This commit is contained in:
1 parent
88e1eaa908
commit
186bcbdd56
13 files changed
+19
-20
No files matched your search
@@ -35,7 +35,7 @@ export default function mergeOutputs (outputs: Array<most.Stream<most.Stream<{ms
|
||||
})
|
||||
)
|
||||
.scan((acc, log) => {
|
||||
if (log.fixed === true) {
|
||||
if (log.fixed) {
|
||||
acc.fixedBlocks[log.blockNo] = log.msg
|
||||
} else {
|
||||
delete acc.fixedBlocks[log['prevFixedBlockNo'] as number]
|
||||
|
||||
@@ -129,7 +129,7 @@ async function dependenciesHierarchyForPackage (
|
||||
const getChildrenTree = getTree.bind(null, {
|
||||
currentDepth: 1,
|
||||
currentPackages: currentLockfile.packages ?? {},
|
||||
includeOptionalDependencies: opts.include.optionalDependencies === true,
|
||||
includeOptionalDependencies: opts.include.optionalDependencies,
|
||||
lockfileDir: opts.lockfileDir,
|
||||
maxDepth: opts.depth,
|
||||
modulesDir,
|
||||
@@ -258,7 +258,7 @@ function getTreeHelper (
|
||||
const result: DependencyInfo = { dependencies: [] }
|
||||
if (opts.currentDepth > opts.maxDepth || !opts.currentPackages || !opts.currentPackages[parentId]) return result
|
||||
|
||||
const deps = opts.includeOptionalDependencies === false
|
||||
const deps = !opts.includeOptionalDependencies
|
||||
? opts.currentPackages[parentId].dependencies
|
||||
: {
|
||||
...opts.currentPackages[parentId].dependencies,
|
||||
|
||||
@@ -138,7 +138,7 @@ function pkgAllDeps (
|
||||
os: pkgSnapshot.os,
|
||||
}
|
||||
// TODO: depPath is not the package ID. Should be fixed
|
||||
installable = opts.includeIncompatiblePackages === true || packageIsInstallable(pkgSnapshot.id ?? depPath, pkg, {
|
||||
installable = opts.includeIncompatiblePackages || packageIsInstallable(pkgSnapshot.id ?? depPath, pkg, {
|
||||
engineStrict: opts.engineStrict,
|
||||
lockfileDir: opts.lockfileDir,
|
||||
nodeVersion: opts.currentEngine.nodeVersion,
|
||||
|
||||
@@ -48,7 +48,7 @@ export default async function (
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
||||
const files = await Promise.all<Lockfile | null | undefined>([
|
||||
(opts.useLockfile === true && readWantedLockfile(opts.lockfileDir, lockfileOpts)) ||
|
||||
(opts.useLockfile && readWantedLockfile(opts.lockfileDir, lockfileOpts)) ||
|
||||
(await existsWantedLockfile(opts.lockfileDir) &&
|
||||
logger.warn({
|
||||
message: `A ${WANTED_LOCKFILE} file exists. The current configuration prohibits to read or write a lockfile`,
|
||||
|
||||
@@ -196,7 +196,7 @@ export default async (opts: HeadlessOptions) => {
|
||||
currentEngine: opts.currentEngine,
|
||||
engineStrict: opts.engineStrict,
|
||||
failOnMissingDependencies: true,
|
||||
includeIncompatiblePackages: opts.force === true,
|
||||
includeIncompatiblePackages: opts.force,
|
||||
lockfileDir,
|
||||
})
|
||||
const { directDependenciesByImporterId, graph } = await lockfileToDepGraph(
|
||||
|
||||
@@ -61,7 +61,7 @@ async function renderTreeForPackage (
|
||||
}
|
||||
label += pkg.path
|
||||
let output = `${label}\n`
|
||||
const useColumns = opts.depth === 0 && opts.long === false && !opts.search
|
||||
const useColumns = opts.depth === 0 && !opts.long && !opts.search
|
||||
for (const dependenciesField of [...DEPENDENCIES_FIELDS.sort(), 'unsavedDependencies']) {
|
||||
if (pkg[dependenciesField]?.length) {
|
||||
const depsLabel = chalk.cyanBright(
|
||||
|
||||
@@ -68,7 +68,7 @@ function isEmptyLockfile (lockfile: Lockfile) {
|
||||
type LockfileFile = Omit<Lockfile, 'importers'> & Partial<ProjectSnapshot> & Partial<Pick<Lockfile, 'importers'>>
|
||||
|
||||
function normalizeLockfile (lockfile: Lockfile, forceSharedFormat: boolean) {
|
||||
if (forceSharedFormat === false && R.equals(R.keys(lockfile.importers), ['.'])) {
|
||||
if (!forceSharedFormat && R.equals(R.keys(lockfile.importers), ['.'])) {
|
||||
const lockfileToSave: LockfileFile = {
|
||||
...lockfile,
|
||||
...lockfile.importers['.'],
|
||||
|
||||
@@ -372,7 +372,7 @@ function fetchToStore (
|
||||
if (
|
||||
!opts.force &&
|
||||
(
|
||||
isLocalTarballDep === false ||
|
||||
!isLocalTarballDep ||
|
||||
await tarballIsUpToDate(opts.resolution as any, target, opts.lockfileDir) // eslint-disable-line
|
||||
)
|
||||
) {
|
||||
|
||||
@@ -200,7 +200,7 @@ test('refetch local tarball if its integrity has changed', async t => {
|
||||
await response.files()
|
||||
await response.finishing()
|
||||
|
||||
t.ok(response.body.updated === false, 'resolution not updated')
|
||||
t.notOk(response.body.updated, 'resolution not updated')
|
||||
t.notOk((await response.files()).fromStore, 'unpack tarball if it is not in store yet')
|
||||
t.ok(await response.bundledManifest!())
|
||||
}
|
||||
@@ -224,7 +224,7 @@ test('refetch local tarball if its integrity has changed', async t => {
|
||||
await response.files!()
|
||||
await response.finishing!()
|
||||
|
||||
t.ok(response.body.updated === true, 'resolution updated')
|
||||
t.ok(response.body.updated, 'resolution updated')
|
||||
t.notOk((await response.files!()).fromStore, 'reunpack tarball if its integrity is not up-to-date')
|
||||
t.ok(await response.bundledManifest!())
|
||||
}
|
||||
@@ -248,7 +248,7 @@ test('refetch local tarball if its integrity has changed', async t => {
|
||||
await response.files()
|
||||
await response.finishing()
|
||||
|
||||
t.ok(response.body.updated === false, 'resolution not updated')
|
||||
t.notOk(response.body.updated, 'resolution not updated')
|
||||
t.ok((await response.files()).fromStore, 'do not reunpack tarball if its integrity is up-to-date')
|
||||
t.ok(await response.bundledManifest!())
|
||||
}
|
||||
@@ -285,7 +285,7 @@ test('refetch local tarball if its integrity has changed. The requester does not
|
||||
await response.files()
|
||||
await response.finishing()
|
||||
|
||||
t.ok(response.body.updated === true, 'resolution updated')
|
||||
t.ok(response.body.updated, 'resolution updated')
|
||||
t.notOk((await response.files()).fromStore, 'unpack tarball if it is not in store yet')
|
||||
t.ok(await response.bundledManifest!())
|
||||
}
|
||||
@@ -306,7 +306,7 @@ test('refetch local tarball if its integrity has changed. The requester does not
|
||||
await response.files()
|
||||
await response.finishing()
|
||||
|
||||
t.ok(response.body.updated === true, 'resolution updated')
|
||||
t.ok(response.body.updated, 'resolution updated')
|
||||
t.notOk((await response.files()).fromStore, 'reunpack tarball if its integrity is not up-to-date')
|
||||
t.ok(await response.bundledManifest!())
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export interface StrictInstallOptions {
|
||||
force: boolean
|
||||
update: boolean
|
||||
updateMatching?: (pkgName: string) => boolean
|
||||
updatePackageManifest: boolean
|
||||
updatePackageManifest?: boolean
|
||||
depth: number
|
||||
lockfileDir: string
|
||||
modulesDir: string
|
||||
|
||||
@@ -271,7 +271,7 @@ export async function mutateModules (
|
||||
case 'install': {
|
||||
await installCase({
|
||||
...project,
|
||||
updatePackageManifest: opts.updatePackageManifest ?? opts.update === true,
|
||||
updatePackageManifest: opts.updatePackageManifest ?? opts.update,
|
||||
})
|
||||
break
|
||||
}
|
||||
@@ -454,7 +454,7 @@ async function partitionLinkedPackages (
|
||||
continue
|
||||
}
|
||||
const isInnerLink = await safeIsInnerLink(opts.modulesDir, dependency.alias, {
|
||||
hideAlienModules: opts.lockfileOnly === false,
|
||||
hideAlienModules: !opts.lockfileOnly,
|
||||
projectDir: opts.projectDir,
|
||||
storeDir: opts.storeDir,
|
||||
virtualStoreDir: opts.virtualStoreDir,
|
||||
|
||||
@@ -142,10 +142,10 @@ export default async function linkPackages (
|
||||
return true
|
||||
})
|
||||
if (!opts.include.dependencies) {
|
||||
depNodes = depNodes.filter(({ dev, optional }) => dev !== false || optional)
|
||||
depNodes = depNodes.filter(({ dev, optional }) => dev || optional)
|
||||
}
|
||||
if (!opts.include.devDependencies) {
|
||||
depNodes = depNodes.filter(({ dev }) => dev !== true)
|
||||
depNodes = depNodes.filter(({ dev }) => !dev)
|
||||
}
|
||||
if (!opts.include.optionalDependencies) {
|
||||
depNodes = depNodes.filter(({ optional }) => !optional)
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
"no-multi-str": "off",
|
||||
"no-mixed-operators": "warn",
|
||||
"@typescript-eslint/dot-notation": "off",
|
||||
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
|
||||
"@typescript-eslint/type-annotation-spacing": "error",
|
||||
"brace-style": [
|
||||
|
||||
Reference in new issue
Block a user