Skip to content

Commit 7b506be

Browse files
committedMar 31, 2025·
chore: update eslint
1 parent adb700a commit 7b506be

File tree

5 files changed

+15
-21
lines changed

5 files changed

+15
-21
lines changed
 

‎.eslintignore

-1
This file was deleted.

‎.eslintrc

-8
This file was deleted.

‎eslint.config.mjs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import unjs from "eslint-config-unjs";
2+
3+
// https://github.com/unjs/eslint-config
4+
export default unjs({
5+
ignores: [],
6+
rules: {
7+
quotes: "off",
8+
"@typescript-eslint/no-require-imports": "off",
9+
"unicorn/prefer-at": "off",
10+
"unicorn/no-null": "off",
11+
"unicorn/prefer-string-raw": "off",
12+
"unicorn/prefer-includes": "off",
13+
},
14+
});

‎src/index.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,7 @@ export function destr<T = unknown>(value: any, options: Options = {}): T {
3535
}
3636

3737
const _value = value.trim();
38-
if (
39-
// eslint-disable-next-line unicorn/prefer-at
40-
value[0] === '"' &&
41-
value.endsWith('"') &&
42-
!value.includes("\\")
43-
) {
38+
if (value[0] === '"' && value.endsWith('"') && !value.includes("\\")) {
4439
return _value.slice(1, -1) as T;
4540
}
4641

@@ -56,7 +51,6 @@ export function destr<T = unknown>(value: any, options: Options = {}): T {
5651
return undefined as T;
5752
}
5853
if (_lval === "null") {
59-
// eslint-disable-next-line unicorn/no-null
6054
return null as T;
6155
}
6256
if (_lval === "nan") {

‎test/index.test.ts

-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ describe("destr", () => {
99
{ input: 123 },
1010
{ input: true },
1111
{ input: false },
12-
/* eslint-disable-next-line unicorn/no-null */
1312
{ input: null },
1413
{ input: Number.POSITIVE_INFINITY },
1514
{ input: Number.NEGATIVE_INFINITY },
@@ -32,10 +31,8 @@ describe("destr", () => {
3231
});
3332

3433
it("parses string 'null' as `null`", () => {
35-
/* eslint-disable unicorn/no-null */
3634
expect(destr("null")).toBeNull();
3735
expect(destr("NULL")).toBeNull();
38-
/* eslint-enable unicorn/no-null */
3936
});
4037

4138
it("parses string 'NaN' as `Number.NaN` case-insensitively", () => {
@@ -74,7 +71,6 @@ describe("destr", () => {
7471
{ input: "[]", output: [] },
7572
{ input: '{ "key": "value" }', output: { key: "value" } },
7673
{ input: '{ "constructor": "value" }', output: { constructor: "value" } },
77-
// eslint-disable-next-line unicorn/no-null
7874
{ input: '{ "constructor": null }', output: { constructor: null } },
7975
{ input: "[1,2,3]", output: [1, 2, 3] },
8076
];
@@ -89,7 +85,6 @@ describe("destr", () => {
8985
.spyOn(console, "warn")
9086
.mockImplementation((message: string) => console.log(message));
9187

92-
// eslint-disable-next-line unicorn/consistent-function-scoping
9388
const warnMessage = (key: string) =>
9489
`[destr] Dropping "${key}" key to prevent prototype pollution.`;
9590

0 commit comments

Comments
 (0)
Please sign in to comment.