Skip to content

Commit

Permalink
chore: lint with eslint v9
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Sep 25, 2024
1 parent 8881231 commit 6392dbd
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 20 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

7 changes: 0 additions & 7 deletions .eslintrc

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ const defaultPlanet = {
name: "earth",
specs: {
gravity: {
$resolve: (val) => parseFloat(val),
$resolve: (val) => Number.parseFloat(val),
$default: "9.8",
},
moons: {
$resolve: (val = ["moon"]) => [].concat(val),
$resolve: (val = ["moon"]) => [val].flat(),
$schema: {
title: "planet moons",
},
Expand Down
12 changes: 12 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import unjs from "eslint-config-unjs";

// https://github.com/unjs/eslint-config
export default unjs({
ignores: [
"web"
],
rules: {
"unicorn/no-null": 0,
"unicorn/prevent-abbreviations": 0
},
});
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async function main() {

if (action !== "load" || !entryPath) {
console.error("Usage: untyped load <entryPath> [--write]");
// eslint-disable-next-line unicorn/no-process-exit

process.exit(1);
}

Expand All @@ -32,6 +32,6 @@ async function main() {
// eslint-disable-next-line unicorn/prefer-top-level-await
main().catch((error) => {
console.error(error);
// eslint-disable-next-line unicorn/no-process-exit

process.exit(1);
});
2 changes: 1 addition & 1 deletion src/generator/dts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ function generateJSDoc(schema: Schema, opts: GenerateTypesOptions): string[] {
) {
const stringified = JSON.stringify(schema.default);
if (stringified) {
buff.push(`@default ${stringified.replace(/\*\//g, "*\\/")}`);
buff.push(`@default ${stringified.replace(/\*\//g, String.raw`*\/`)}`);
}
}

Expand Down
1 change: 0 additions & 1 deletion src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ async function _resolveSchema(
}
if (typeof node.$resolve === "function") {
schema.default = await node.$resolve(schema.default, async (key) => {
// eslint-disable-next-line unicorn/no-await-expression-member
return (await _resolveSchema(getValue(ctx.root, key), key, ctx))
.default;
});
Expand Down
1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export type JSType =
| "any"
| "array";

// eslint-disable-next-line no-use-before-define
export type ResolveFn = (
value: unknown,
get: (key: string) => Promise<unknown>,
Expand Down
2 changes: 1 addition & 1 deletion test/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ describe("transform (jsdoc)", () => {
function expectCodeToMatch(code: string, pattern: RegExp, expected: any) {
const [, result] = code.match(pattern) || [];
expect(result).toBeDefined();
// eslint-disable-next-line no-new-func, unicorn/new-for-builtins
// eslint-disable-next-line unicorn/new-for-builtins
const obj = Function(
'"use strict";return (' + result.replace(/;$/, "") + ")",
)();
Expand Down
2 changes: 1 addition & 1 deletion web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
// https://v3.nuxtjs.org/concepts/typescript
"extends": "./.nuxt/tsconfig.json",
"extends": "./.nuxt/tsconfig.json"
}

0 comments on commit 6392dbd

Please sign in to comment.