Skip to content

Commit c3f63b4

Browse files
authored
chore: biome 2.x and auto linting/formatting (#58)
<!-- ps-id: ae9db707-a24c-4f60-9e4f-c176d5b9f358 -->
1 parent dca00d2 commit c3f63b4

File tree

11 files changed

+204
-108
lines changed

11 files changed

+204
-108
lines changed

bin/jp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
'use strict';
44

5-
import * as fs from 'fs';
65
import { ParseArgsConfig, parseArgs } from 'node:util';
6+
import * as fs from 'fs';
77
import pkg from '../package.json';
88
import jmespath, { JSONValue } from '../src';
99

biome.json

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
33
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
4-
"files": { "ignoreUnknown": false, "ignore": ["dist", "coverage", "test/compliance"] },
4+
"files": { "ignoreUnknown": false, "includes": ["**", "!**/dist", "!**/coverage", "!**/test/compliance"] },
55
"formatter": {
66
"enabled": true,
77
"useEditorconfig": true,
@@ -12,21 +12,22 @@
1212
"lineWidth": 120,
1313
"attributePosition": "auto",
1414
"bracketSpacing": true,
15-
"ignore": ["**/tests/fixtures/**/*", "**/dist", "**/coverage", "**/.vscode"]
15+
"includes": ["**", "!**/tests/fixtures/**/*", "!**/dist", "!**/coverage", "!**/.vscode"]
1616
},
17-
"organizeImports": { "enabled": true },
17+
"assist": { "actions": { "source": { "organizeImports": "on" } } },
1818
"linter": {
1919
"enabled": true,
2020
"rules": {
2121
"recommended": false,
2222
"complexity": { "noBannedTypes": "error" },
23-
"correctness": { "noUnusedVariables": "warn", "useArrayLiterals": "off" },
23+
"correctness": { "noUnusedVariables": "warn" },
2424
"style": {
2525
"noInferrableTypes": "error",
2626
"noNamespace": "error",
2727
"noNonNullAssertion": "warn",
2828
"useAsConstAssertion": "error",
29-
"useBlockStatements": "error"
29+
"useBlockStatements": "error",
30+
"useArrayLiterals": "off"
3031
},
3132
"suspicious": {
3233
"noEmptyBlockStatements": "off",
@@ -36,15 +37,16 @@
3637
"useNamespaceKeyword": "error"
3738
}
3839
},
39-
"ignore": [
40-
"**/node_modules",
41-
"**/dist",
42-
"**/jest.config.js",
43-
"**/fixtures",
44-
"**/shared-fixtures",
45-
"**/coverage",
46-
"**/__snapshots__",
47-
"src/**/*.js"
40+
"includes": [
41+
"**",
42+
"!**/node_modules",
43+
"!**/dist",
44+
"!**/jest.config.js",
45+
"!**/fixtures",
46+
"!**/shared-fixtures",
47+
"!**/coverage",
48+
"!**/__snapshots__",
49+
"!**/src/**/*.js"
4850
]
4951
},
5052
"javascript": {
@@ -62,22 +64,21 @@
6264
},
6365
"overrides": [
6466
{
65-
"include": ["*.ts", "*.tsx"],
67+
"includes": ["**/*.ts", "**/*.tsx"],
6668
"linter": {
6769
"rules": {
6870
"correctness": {
6971
"noConstAssign": "off",
7072
"noGlobalObjectCalls": "off",
7173
"noInvalidConstructorSuper": "off",
72-
"noNewSymbol": "off",
7374
"noSetterReturn": "off",
7475
"noUndeclaredVariables": "off",
7576
"noUnreachable": "off",
76-
"noUnreachableSuper": "off"
77+
"noUnreachableSuper": "off",
78+
"noInvalidBuiltinInstantiation": "off",
79+
"useValidTypeof": "off"
7780
},
7881
"style": {
79-
"noArguments": "error",
80-
"noVar": "error",
8182
"useConst": "error"
8283
},
8384
"suspicious": {
@@ -89,7 +90,10 @@
8990
"noRedeclare": "off",
9091
"noUnsafeNegation": "off",
9192
"useGetterReturn": "off",
92-
"useValidTypeof": "off"
93+
"noVar": "error"
94+
},
95+
"complexity": {
96+
"noArguments": "error"
9397
}
9498
}
9599
}

package-lock.json

Lines changed: 120 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,22 @@
1414
"module": "dist/jmespath.esm.js",
1515
"typings": "dist/types/index.d.ts",
1616
"types": "dist/types/index.d.ts",
17-
"files": ["dist/"],
17+
"files": [
18+
"dist/"
19+
],
1820
"homepage": "https://github.com/nanoporetech/jmespath-ts#readme",
1921
"bugs": {
2022
"url": "https://github.com/nanoporetech/jmespath-ts/issues",
2123
"mail": ""
2224
},
23-
"keywords": ["jmespath", "jsonpath", "query", "json", "jq", "xpath"],
25+
"keywords": [
26+
"jmespath",
27+
"jsonpath",
28+
"query",
29+
"json",
30+
"jq",
31+
"xpath"
32+
],
2433
"contributors": [],
2534
"repository": {
2635
"type": "git",
@@ -48,7 +57,7 @@
4857
"prepack": "npx clear-package-json package.json --output ./package.json"
4958
},
5059
"devDependencies": {
51-
"@biomejs/biome": "1.9.4",
60+
"@biomejs/biome": "2.0.6",
5261
"@rollup/plugin-json": "^4.1.0",
5362
"@rollup/plugin-node-resolve": "^13.0.0",
5463
"@rollup/plugin-terser": "^0.4.0",

src/Parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ class TokenParser {
490490
let keyName: string;
491491
let value: ExpressionNode;
492492
// tslint:disable-next-line: prettier
493-
for (; ;) {
493+
for (;;) {
494494
keyToken = this.lookaheadToken(0);
495495
if (!identifierTypes.includes(keyToken.type)) {
496496
throw new Error(`Syntax error: expecting an identifier token, got: ${keyToken.type}`);

src/Runtime.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
import type { ExpressionNode } from './AST.type';
2+
import type {
3+
JSONArray,
4+
JSONArrayArray,
5+
JSONArrayKeyValuePairs,
6+
JSONArrayObject,
7+
JSONObject,
8+
JSONValue,
9+
ObjectDict,
10+
} from './JSON.type';
11+
import type { TreeInterpreter } from './TreeInterpreter';
112
import {
213
findFirst,
314
findLast,
@@ -13,18 +24,6 @@ import {
1324
} from './utils/strings';
1425
import { Text } from './utils/text';
1526

16-
import type { ExpressionNode } from './AST.type';
17-
import type {
18-
JSONArray,
19-
JSONArrayArray,
20-
JSONArrayKeyValuePairs,
21-
JSONArrayObject,
22-
JSONObject,
23-
JSONValue,
24-
ObjectDict,
25-
} from './JSON.type';
26-
import type { TreeInterpreter } from './TreeInterpreter';
27-
2827
export enum InputArgument {
2928
TYPE_NUMBER = 0,
3029
TYPE_ANY = 1,

src/TreeInterpreter.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1+
import type { ExpressionNode, ExpressionReference, SliceNode } from './AST.type';
2+
import type { JSONArray, JSONObject, JSONValue } from './JSON.type';
13
import { Token } from './Lexer.type';
4+
import { ScopeEntry } from './Parser.type';
25
import { Runtime } from './Runtime';
36
import { ScopeChain } from './Scope';
47
import { add, div, divide, ensureNumbers, isFalse, mod, mul, strictDeepEqual, sub } from './utils';
58

6-
import type { ExpressionNode, ExpressionReference, SliceNode } from './AST.type';
7-
import type { JSONArray, JSONObject, JSONValue } from './JSON.type';
8-
import { ScopeEntry } from './Parser.type';
9-
109
export class TreeInterpreter {
1110
runtime: Runtime;
1211
private _rootValue: JSONValue | null = null;

0 commit comments

Comments
 (0)