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

infra(unicorn): no-negated-condition #2507

Merged
merged 6 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ module.exports = defineConfig({
'unicorn/no-array-callback-reference': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/no-await-expression-member': 'off',
'unicorn/no-negated-condition': 'off',
'unicorn/no-object-as-default-parameter': 'off',
'unicorn/no-useless-switch-case': 'off',
'unicorn/numeric-separators-style': 'off',
Expand Down
4 changes: 2 additions & 2 deletions scripts/apidoc/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ async function loadRemote(url: string): Promise<DocsApiDiffIndex> {
throw new Error(
`Failed to load remote diff index from ${url}: ${res.statusText}`
);
} else {
return res.json() as Promise<DocsApiDiffIndex>;
}

return res.json() as Promise<DocsApiDiffIndex>;
});
}

Expand Down
22 changes: 11 additions & 11 deletions src/modules/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,17 +456,7 @@
}

while (range != null) {
if (!range[0].includes('-')) {
// handle non-ranges
if (isCaseInsensitive && Number.isNaN(Number(range[0]))) {
rangeCodes.push(
range[0].toUpperCase().charCodeAt(0),
range[0].toLowerCase().charCodeAt(0)
);
} else {
rangeCodes.push(range[0].charCodeAt(0));
}
} else {
if (range[0].includes('-')) {
// handle ranges
const rangeMinMax = range[0].split('-').map((x) => x.charCodeAt(0));
min = rangeMinMax[0];
Expand All @@ -490,6 +480,16 @@
rangeCodes.push(i);
}
}
} else {
// handle non-ranges
if (isCaseInsensitive && Number.isNaN(Number(range[0]))) {
rangeCodes.push(
range[0].toUpperCase().charCodeAt(0),
range[0].toLowerCase().charCodeAt(0)
);

Check warning on line 489 in src/modules/helpers/index.ts

View check run for this annotation

Codecov / codecov/patch

src/modules/helpers/index.ts#L486-L489

Added lines #L486 - L489 were not covered by tests
} else {
rangeCodes.push(range[0].charCodeAt(0));
}
}

ranges = ranges.substring(range[0].length);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/image/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class ImageModule extends ModuleBase {
const { width = 640, height = 480, category } = options;

return `https://loremflickr.com/${width}/${height}${
category != null ? `/${category}` : ''
category == null ? '' : `/${category}`
}?lock=${this.faker.number.int()}`;
}

Expand Down