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

fix: enable eslint eqeqeq #12574

Merged
merged 2 commits into from Nov 9, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Expand Up @@ -37,6 +37,7 @@ module.exports = {

// other rules
'consistent-return': 'error',
eqeqeq: 'error',
'no-negated-condition': 'error',
'no-param-reassign': 'error',
'sort-imports': [
Expand Down
6 changes: 3 additions & 3 deletions lib/config/migration.ts
Expand Up @@ -316,11 +316,11 @@ export function migrateConfig(
migratedConfig.automergeType = 'branch';
} else if (key === 'automergeMinor') {
migratedConfig.minor = migratedConfig.minor || {};
migratedConfig.minor.automerge = val == true;
migratedConfig.minor.automerge = !!val;
delete migratedConfig[key];
} else if (key === 'automergeMajor') {
migratedConfig.major = migratedConfig.major || {};
migratedConfig.major.automerge = val == true;
migratedConfig.major.automerge = !!val;
delete migratedConfig[key];
} else if (key === 'multipleMajorPrs') {
delete migratedConfig.multipleMajorPrs;
Expand All @@ -336,7 +336,7 @@ export function migrateConfig(
migratedConfig.separateMinorPatch = val;
} else if (key === 'automergePatch') {
migratedConfig.patch = migratedConfig.patch || {};
migratedConfig.patch.automerge = val == true;
migratedConfig.patch.automerge = !!val;
delete migratedConfig[key];
} else if (key === 'ignoreNodeModules') {
delete migratedConfig.ignoreNodeModules;
Expand Down
2 changes: 1 addition & 1 deletion lib/config/validation.ts
Expand Up @@ -228,7 +228,7 @@ export async function validateConfig(
message: `${currentPath}: ${errorMessage}`,
});
}
} else if (val != null) {
} else if (val !== null) {
const type = optionTypes[key];
if (type === 'boolean') {
if (val !== true && val !== false) {
Expand Down
2 changes: 1 addition & 1 deletion lib/datasource/galaxy-collection/index.ts
Expand Up @@ -109,7 +109,7 @@ export class GalaxyCollectionDatasource extends Datasource {
{ concurrency: 5 } // allow 5 requests at maximum in parallel
);
// filter failed versions
const filteredReleases = enrichedReleases.filter((value) => value != null);
const filteredReleases = enrichedReleases.filter(Boolean);
// extract base information which are only provided on the release from the newest release
const result: ReleaseResult = {
releases: filteredReleases,
Expand Down
2 changes: 1 addition & 1 deletion lib/logger/utils.ts
Expand Up @@ -114,7 +114,7 @@ export function sanitizeValue(_value: unknown, seen = new WeakMap()): any {

const valueType = typeof value;

if (value != null && valueType !== 'function' && valueType === 'object') {
if (value && valueType !== 'function' && valueType === 'object') {
if (value instanceof Date) {
return value;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/ansible-galaxy/collections.ts
Expand Up @@ -120,7 +120,7 @@ function finalize(dependency: PackageDependency): boolean {
return true;
}

if (dependency.currentValue == null && dep.skipReason == null) {
if (!dependency.currentValue && !dep.skipReason) {
dep.skipReason = SkipReason.NoVersion;
}
return true;
Expand Down
4 changes: 1 addition & 3 deletions lib/manager/ansible-galaxy/extract.spec.ts
Expand Up @@ -35,9 +35,7 @@ describe('manager/ansible-galaxy/extract', () => {
const res = extractPackageFile(collections1, 'requirements.yml');
expect(res.deps).toMatchSnapshot();
expect(res.deps).toHaveLength(13);
expect(res.deps.filter((value) => value.skipReason != null)).toHaveLength(
6
);
expect(res.deps.filter((value) => value.skipReason)).toHaveLength(6);
});
it('check collection style requirements file in reverse order and missing empty line', () => {
const res = extractPackageFile(collections2, 'requirements.yml');
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/ansible-galaxy/roles.ts
Expand Up @@ -94,7 +94,7 @@ export function extractRoles(lines: string[]): PackageDependency[] {
};
do {
const localdep = interpretLine(lineMatch, lineNumber, dep);
if (localdep == null) {
if (!localdep) {
break;
}
const line = lines[lineNumber + 1];
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/argocd/extract.ts
Expand Up @@ -12,7 +12,7 @@ function createDependency(
const source = definition.spec?.source;

if (
source == null ||
!source ||
!is.nonEmptyString(source.repoURL) ||
!is.nonEmptyString(source.targetRevision)
) {
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/gradle-wrapper/artifacts.ts
Expand Up @@ -126,7 +126,7 @@ export async function updateArtifacts({
addIfUpdated(status, fileProjectPath)
)
)
).filter((e) => e != null);
).filter(Boolean);
logger.debug(
{ files: updateArtifactsResult.map((r) => r.file.name) },
`Returning updated gradle-wrapper files`
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/gradle/deep/__testutil__/gradle.ts
Expand Up @@ -28,7 +28,7 @@ ${javaVersionOutput}`);
let cachedJavaVersion: number | null = null;

function determineJavaVersion(): number {
if (cachedJavaVersion == null) {
if (!cachedJavaVersion) {
let javaVersionCommand: SpawnSyncReturns<string>;
let error: Error;
try {
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/regex/index.ts
Expand Up @@ -150,7 +150,7 @@ function handleRecursive(
regEx(matchString, 'g')
);
// abort if we have no matchString anymore
if (regexes[index] == null) {
if (!regexes[index]) {
return [];
}
return regexMatchAll(regexes[index], content).flatMap((match) => {
Expand Down
5 changes: 1 addition & 4 deletions lib/manager/terraform/lockfile/index.ts
Expand Up @@ -110,10 +110,7 @@ export async function updateArtifacts({
}
}
// if no updates have been found or there are failed hashes abort
if (
updates.length === 0 ||
updates.some((value) => value.newHashes == null)
) {
if (updates.length === 0 || updates.some((value) => !value.newHashes)) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/manager/terraform/resources.ts
Expand Up @@ -94,7 +94,7 @@ export function analyseTerraformResource(
break;

case TerraformResourceTypes.helm_release:
if (dep.managerData.chart == null) {
if (!dep.managerData.chart) {
dep.skipReason = SkipReason.InvalidName;
} else if (checkIfStringIsPath(dep.managerData.chart)) {
dep.skipReason = SkipReason.LocalChart;
Expand Down
2 changes: 1 addition & 1 deletion lib/util/index.ts
@@ -1,5 +1,5 @@
export function sampleSize(array: string[], n: number): string[] {
const length = array == null ? 0 : array.length;
const length = array ? array.length : 0;
if (!length || n < 1) {
return [];
}
Expand Down
3 changes: 1 addition & 2 deletions lib/workers/repository/onboarding/branch/check.ts
Expand Up @@ -121,5 +121,4 @@ export const isOnboarded = async (config: RenovateConfig): Promise<boolean> => {

export const onboardingPrExists = async (
config: RenovateConfig
): Promise<boolean> =>
(await platform.getBranchPr(config.onboardingBranch)) != null;
): Promise<boolean> => !!(await platform.getBranchPr(config.onboardingBranch));