Skip to content

Commit

Permalink
Manual lint adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
nvie committed Feb 19, 2025
1 parent 914737c commit 5960a11
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
8 changes: 5 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ export default tseslint.config(

"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unnecessary-condition": ["error", { allowConstantLoopConditions: true }],
"@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
"@typescript-eslint/no-unused-vars": [
"warn",
{ args: "all", argsIgnorePattern: "^_.*", varsIgnorePattern: "^_.*" },
Expand All @@ -60,12 +61,13 @@ export default tseslint.config(
// -------------------------------
{
rules: {
//"@typescript-eslint/consistent-type-definitions": "off",
//"@typescript-eslint/no-empty-function": "off",
//"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
//"no-constant-condition": "off",
//"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/unified-signatures": "off",
//"@typescript-eslint/use-unknown-in-catch-callback-variable": "off",
//"no-constant-condition": "off",
},
},

Expand Down
3 changes: 1 addition & 2 deletions src/builtins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function find<T>(iterable: Iterable<T>, predicate?: Predicate<T>): T | un
const it = iter(iterable);
if (predicate === undefined) {
const value = it.next();
return value.done ? value.value : value.value;
return value.done ? undefined : value.value;
} else {
let res: IteratorResult<T>;
let i = 0;
Expand Down Expand Up @@ -215,7 +215,6 @@ function range_(start: number, stop: number, step: number): IterableIterator<num
* The produced range will be empty if the first value to produce already does
* not meet the value constraint.
*/

export function range(stop: number): IterableIterator<number>;
export function range(start: number, stop: number, step?: number): IterableIterator<number>;
export function range(startOrStop: number, definitelyStop?: number, step = 1): IterableIterator<number> {
Expand Down
2 changes: 1 addition & 1 deletion src/custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function isNullish<T>(x: T): x is NonNullable<T> {
return x != null;
}

function isDefined<T>(x: T): boolean {
function isDefined(x: unknown): boolean {
return x !== undefined;
}

Expand Down
2 changes: 1 addition & 1 deletion src/itertools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ export function* izipMany<T>(...iters: Iterable<T>[]): IterableIterator<T[]> {
export function* permutations<T>(iterable: Iterable<T>, r?: number): IterableIterator<T[]> {
const pool = Array.from(iterable);
const n = pool.length;
const x = r === undefined ? n : r;
const x = r ?? n;

if (x > n) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/more-itertools.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { enumerate, iter, map } from "./builtins";
import { iter, map } from "./builtins";
import { izip, repeat } from "./itertools";
import type { Predicate, Primitive } from "./types";
import { primitiveIdentity } from "./utils";
Expand Down

0 comments on commit 5960a11

Please sign in to comment.