Skip to content

Commit 686eb19

Browse files
authored
Upgrading biome (#182)
1 parent 2bbdb0d commit 686eb19

25 files changed

+138
-118
lines changed

__tests__/expr.test.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ describe("expr", () => {
256256
${2} | ${2}
257257
`("$# fillNan", ({ replacement, filled }) => {
258258
const df = pl.DataFrame({
259-
a: [1, NaN, 2],
259+
a: [1, Number.NaN, 2],
260260
b: [2, 1, 1],
261261
});
262262
const expected = pl.DataFrame({ fillNan: [1, filled, 2] });
@@ -412,13 +412,13 @@ describe("expr", () => {
412412
expect(actual).toFrameEqual(expected);
413413
});
414414
test("isNan", () => {
415-
const df = pl.DataFrame({ a: [1, NaN, 2] });
415+
const df = pl.DataFrame({ a: [1, Number.NaN, 2] });
416416
const expected = pl.DataFrame({ isNan: [false, true, false] });
417417
const actual = df.select(col("a").isNan().as("isNan"));
418418
expect(actual).toFrameEqual(expected);
419419
});
420420
test("isNotNan", () => {
421-
const df = pl.DataFrame({ a: [1, NaN, 2] });
421+
const df = pl.DataFrame({ a: [1, Number.NaN, 2] });
422422
const expected = pl.DataFrame({ isNotNan: [true, false, true] });
423423
const actual = df.select(col("a").isNotNan().as("isNotNan"));
424424
expect(actual).toFrameEqual(expected);
@@ -1831,18 +1831,19 @@ describe("rolling", () => {
18311831
const expected = pl
18321832
.Series(
18331833
"rolling",
1834-
[null, 0.707107, 0.707107, 0.707107, 0.707107],
1834+
[null, Math.SQRT1_2, Math.SQRT1_2, Math.SQRT1_2, Math.SQRT1_2],
18351835
pl.Float64,
18361836
)
1837+
.round(10)
18371838
.toFrame();
1838-
expect(df.select(col("rolling").rollingStd(2).round(6))).toFrameEqual(
1839+
expect(df.select(col("rolling").rollingStd(2).round(10))).toFrameEqual(
18391840
expected,
18401841
);
18411842
expect(
18421843
df.select(
18431844
col("rolling")
18441845
.rollingStd({ windowSize: 2, center: true, ddof: 4 })
1845-
.round(6),
1846+
.round(10),
18461847
),
18471848
).toFrameEqual(expected);
18481849
});

__tests__/series.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe("typedArrays", () => {
7373
const int64Array = new BigInt64Array([1n, 2n, 3n]);
7474
const actual = pl.Series(int64Array).toArray();
7575

76-
const expected = Array.from(int64Array).map((v: any) => parseInt(v));
76+
const expected = Array.from(int64Array).map((v: any) => Number.parseInt(v));
7777

7878
expect(actual).toEqual(expected);
7979
});

biome.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
"rules": {
99
"recommended": true,
1010
"style": {
11-
"noParameterAssign": "off"
11+
"noParameterAssign": "off",
12+
"useNodejsImportProtocol": "off"
1213
},
1314
"suspicious": {
1415
"noExplicitAny": "off",
1516
"noUnsafeDeclarationMerging": "off",
16-
"noImplicitAnyLet": "off"
17-
17+
"noImplicitAnyLet": "off",
18+
"noThenProperty": "off"
1819
},
1920
"complexity": {
2021
"useLiteralKeys": "off"

bun.lockb

667 Bytes
Binary file not shown.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@
5454
"precommit": "yarn lint && yarn test"
5555
},
5656
"devDependencies": {
57-
"@biomejs/biome": "^1.5.3",
57+
"@biomejs/biome": "^1.6.1",
5858
"@napi-rs/cli": "^2.18.0",
5959
"@types/chance": "^1.1.6",
6060
"@types/jest": "^29.5.12",
61-
"@types/node": "^20.11.17",
61+
"@types/node": "^20.11.26",
6262
"chance": "^1.1.11",
6363
"jest": "^29.7.0",
6464
"source-map-support": "^0.5.21",
6565
"ts-jest": "^29.1.2",
6666
"ts-node": "^10.9.2",
67-
"typedoc": "^0.25.11",
67+
"typedoc": "^0.25.12",
6868
"typescript": "5.4.2"
6969
},
7070
"packageManager": "[email protected]",

polars/dataframe.ts

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import pli from "./internals/polars_internal";
22
import { arrayToJsDataFrame } from "./internals/construction";
3-
import { _GroupBy, DynamicGroupBy, GroupBy, RollingGroupBy } from "./groupby";
4-
import { _LazyDataFrame, LazyDataFrame } from "./lazy/dataframe";
3+
import {
4+
_GroupBy,
5+
DynamicGroupBy,
6+
type GroupBy,
7+
RollingGroupBy,
8+
} from "./groupby";
9+
import { _LazyDataFrame, type LazyDataFrame } from "./lazy/dataframe";
510
import { concat } from "./functions";
611
import { Expr } from "./lazy/expr";
712
import { _Series, Series } from "./series";
813
import { Stream, Writable } from "stream";
9-
import {
14+
import type {
1015
FillNullStrategy,
1116
JoinOptions,
1217
WriteAvroOptions,
@@ -20,14 +25,14 @@ import { DataType } from "./datatypes";
2025
import {
2126
columnOrColumns,
2227
columnOrColumnsStrict,
23-
ColumnSelection,
24-
ColumnsOrExpr,
25-
ExprOrString,
28+
type ColumnSelection,
29+
type ColumnsOrExpr,
30+
type ExprOrString,
2631
isSeriesArray,
27-
ValueOrArray,
32+
type ValueOrArray,
2833
} from "./utils";
2934

30-
import {
35+
import type {
3136
Arithmetic,
3237
Deserialize,
3338
GroupByOps,
@@ -1899,7 +1904,7 @@ export const _DataFrame = (_df: any): DataFrame => {
18991904
[jupyterDisplay]() {
19001905
let rows = 50;
19011906
if (process.env.POLARS_FMT_MAX_ROWS) {
1902-
rows = parseInt(process.env.POLARS_FMT_MAX_ROWS);
1907+
rows = Number.parseInt(process.env.POLARS_FMT_MAX_ROWS);
19031908
}
19041909

19051910
const limited = this.limit(rows);

polars/datatypes/field.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DataType } from "./datatype";
1+
import type { DataType } from "./datatype";
22

33
/**
44
* A field is a name and a datatype.

polars/functions.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* eslint-disable no-redeclare */
22
import { jsTypeToPolarsType } from "./internals/construction";
3-
import { Series, _Series } from "./series";
4-
import { DataFrame, _DataFrame } from "./dataframe";
3+
import { type Series, _Series } from "./series";
4+
import { type DataFrame, _DataFrame } from "./dataframe";
55
import pli from "./internals/polars_internal";
66
import { isDataFrameArray, isSeriesArray } from "./utils";
7-
import { ConcatOptions } from "./types";
7+
import type { ConcatOptions } from "./types";
88

99
/**
1010
* _Repeat a single value n times and collect into a Series._

polars/groupby.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { DataFrame, _DataFrame } from "./dataframe";
1+
import { type DataFrame, _DataFrame } from "./dataframe";
22
import * as utils from "./utils";
33
import util from "util";
4-
import { Expr } from "./lazy/expr";
4+
import type { Expr } from "./lazy/expr";
55
import { col, exclude } from "./lazy/functions";
6-
import { ColumnsOrExpr, StartBy } from "./utils";
6+
import type { ColumnsOrExpr, StartBy } from "./utils";
77

88
const inspect = Symbol.for("nodejs.util.inspect.custom");
99
const inspectOpts = { colors: true, depth: null };

polars/io.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { DataType } from "./datatypes";
1+
import type { DataType } from "./datatypes";
22
import pli from "./internals/polars_internal";
3-
import { DataFrame, _DataFrame } from "./dataframe";
3+
import { type DataFrame, _DataFrame } from "./dataframe";
44
import { isPath } from "./utils";
5-
import { LazyDataFrame, _LazyDataFrame } from "./lazy/dataframe";
6-
import { Readable, Stream } from "stream";
5+
import { type LazyDataFrame, _LazyDataFrame } from "./lazy/dataframe";
6+
import { type Readable, Stream } from "stream";
77
import { concat } from "./functions";
88

99
export interface ReadCsvOptions {

polars/lazy/dataframe.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
import { DataFrame, _DataFrame } from "../dataframe";
1+
import { type DataFrame, _DataFrame } from "../dataframe";
22
import { Expr, exprToLitOrExpr } from "./expr";
33
import pli from "../internals/polars_internal";
44
import {
55
columnOrColumnsStrict,
6-
ColumnSelection,
7-
ColumnsOrExpr,
8-
ExprOrString,
6+
type ColumnSelection,
7+
type ColumnsOrExpr,
8+
type ExprOrString,
99
selectionToExprList,
10-
ValueOrArray,
10+
type ValueOrArray,
1111
} from "../utils";
12-
import { _LazyGroupBy, LazyGroupBy } from "./groupby";
13-
import { Deserialize, GroupByOps, Serialize } from "../shared_traits";
14-
import {
12+
import { _LazyGroupBy, type LazyGroupBy } from "./groupby";
13+
import type { Deserialize, GroupByOps, Serialize } from "../shared_traits";
14+
import type {
1515
LazyOptions,
1616
LazyJoinOptions,
1717
SinkCsvOptions,
1818
SinkParquetOptions,
1919
} from "../types";
20-
import { Series } from "../series";
20+
import type { Series } from "../series";
2121

2222
const inspect = Symbol.for("nodejs.util.inspect.custom");
2323

polars/lazy/expr/datetime.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { DateFunctions } from "../../shared_traits";
2-
import { Expr, _Expr } from "../expr";
1+
import type { DateFunctions } from "../../shared_traits";
2+
import { type Expr, _Expr } from "../expr";
33

44
/**
55
* DateTime functions

polars/lazy/expr/index.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ export type { ExprList as ListNamespace } from "./list";
77
export type { ExprDateTime as DatetimeNamespace } from "./datetime";
88
export type { ExprStruct as StructNamespace } from "./struct";
99

10-
import { DataType } from "../../datatypes";
10+
import type { DataType } from "../../datatypes";
1111
import pli from "../../internals/polars_internal";
1212
import {
13-
ExprOrString,
13+
type ExprOrString,
1414
selectionToExprList,
1515
INSPECT_SYMBOL,
1616
regexToString,
1717
} from "../../utils";
1818
import { Series } from "../../series";
19-
import {
19+
import type {
2020
Arithmetic,
2121
Comparison,
2222
Cumulative,
@@ -27,7 +27,11 @@ import {
2727
Serialize,
2828
EwmOps,
2929
} from "../../shared_traits";
30-
import { InterpolationMethod, FillNullStrategy, RankMethod } from "../../types";
30+
import type {
31+
InterpolationMethod,
32+
FillNullStrategy,
33+
RankMethod,
34+
} from "../../types";
3135
import { isRegExp } from "util/types";
3236
/**
3337
* Expressions that can be used in various contexts.

polars/lazy/expr/list.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Expr, _Expr, exprToLitOrExpr } from "../expr";
2-
import { ListFunctions } from "../../shared_traits";
2+
import type { ListFunctions } from "../../shared_traits";
33
import { Series } from "../../series";
44
import pli from "../../internals/polars_internal";
55
import { concatList } from "../functions";

polars/lazy/expr/string.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { StringFunctions } from "../../shared_traits";
1+
import type { StringFunctions } from "../../shared_traits";
22
import { DataType } from "../../datatypes";
33
import { regexToString } from "../../utils";
44
import { Expr, _Expr, exprToLitOrExpr } from "../expr";

polars/lazy/expr/struct.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { _Expr, Expr } from "../expr";
1+
import { _Expr, type Expr } from "../expr";
22

33
/**
44
* Struct functions

polars/lazy/functions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Expr, _Expr, exprToLitOrExpr } from "./expr";
22
import { DataType } from "../datatypes";
33
import { Series } from "../series";
44
import { DataFrame } from "../dataframe";
5-
import { ExprOrString, range, selectionToExprList } from "../utils";
5+
import { type ExprOrString, range, selectionToExprList } from "../utils";
66
import pli from "../internals/polars_internal";
77

88
/**

polars/lazy/groupby.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Expr } from "./expr";
1+
import type { Expr } from "./expr";
22
import { selectionToExprList } from "../utils";
3-
import { _LazyDataFrame, LazyDataFrame } from "./dataframe";
3+
import { _LazyDataFrame, type LazyDataFrame } from "./dataframe";
44

55
/** @ignore */
66
export const _LazyGroupBy = (_lgb: any): LazyGroupBy => {

polars/series/datetime.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Series, _Series } from ".";
2-
import { DateFunctions } from "../shared_traits";
1+
import { type Series, _Series } from ".";
2+
import type { DateFunctions } from "../shared_traits";
33

44
export type SeriesDateFunctions = DateFunctions<Series>;
55

polars/series/index.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import pli from "../internals/polars_internal";
22
import { arrayToJsSeries } from "../internals/construction";
3-
import { DataType, DTYPE_TO_FFINAME, Optional } from "../datatypes";
3+
import { DataType, DTYPE_TO_FFINAME, type Optional } from "../datatypes";
44
import { DataFrame, _DataFrame } from "../dataframe";
5-
import { SeriesStringFunctions, StringNamespace } from "./string";
6-
import { ListNamespace, SeriesListFunctions } from "./list";
5+
import { SeriesStringFunctions, type StringNamespace } from "./string";
6+
import { type ListNamespace, SeriesListFunctions } from "./list";
77
import { SeriesDateFunctions } from "./datetime";
88
import { SeriesStructFunctions } from "./struct";
99
import { InvalidOperationError } from "../error";
10-
import {
10+
import type {
1111
Arithmetic,
1212
Comparison,
1313
Cumulative,
@@ -19,7 +19,7 @@ import {
1919
EwmOps,
2020
} from "../shared_traits";
2121
import { col } from "../lazy/functions";
22-
import { InterpolationMethod, RankMethod } from "../types";
22+
import type { InterpolationMethod, RankMethod } from "../types";
2323

2424
const inspect = Symbol.for("nodejs.util.inspect.custom");
2525
/**

polars/series/list.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Series, _Series } from ".";
1+
import { type Series, _Series } from ".";
22
import { exprToLitOrExpr } from "..";
33
import { col } from "../lazy/functions";
4-
import { ListFunctions } from "../shared_traits";
4+
import type { ListFunctions } from "../shared_traits";
55

66
export type ListNamespace = ListFunctions<Series>;
77

polars/series/string.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { Expr } from "./../lazy/expr/index";
2-
import { DataType } from "../datatypes";
3-
import { _Series, Series } from ".";
1+
import type { Expr } from "./../lazy/expr/index";
2+
import type { DataType } from "../datatypes";
3+
import { _Series, type Series } from ".";
44
import { regexToString } from "../utils";
55
import { col } from "../lazy/functions";
6-
import { StringFunctions } from "../shared_traits";
6+
import type { StringFunctions } from "../shared_traits";
77

88
/**
99
* namespace containing series string functions

polars/series/struct.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pli from "../internals/polars_internal";
22
import { _DataFrame, DataFrame } from "../dataframe";
3-
import { _Series, Series } from ".";
3+
import { _Series, type Series } from ".";
44
import { _Expr } from "../lazy/expr";
55

66
export interface SeriesStructFunctions {

polars/shared_traits.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { ColumnsOrExpr, StartBy } from "./utils";
2-
import { Expr, _Expr } from "./lazy/expr";
1+
import type { ColumnsOrExpr, StartBy } from "./utils";
2+
import { type Expr, _Expr } from "./lazy/expr";
33

4-
import {
4+
import type {
55
InterpolationMethod,
66
RollingOptions,
77
RollingQuantileOptions,
88
RollingSkewOptions,
99
ClosedWindow,
1010
} from "./types";
11-
import { DataType } from "./datatypes";
11+
import type { DataType } from "./datatypes";
1212

1313
/**
1414
* Arithmetic operations

0 commit comments

Comments
 (0)