From 74dabbdb7456120ae7f8c541dd67287261eb06a3 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Sun, 8 Dec 2024 10:45:26 +0000 Subject: [PATCH 1/3] build(deps-dev): replace standard with neostandard --- package.json | 6 +++--- types/index.d.ts | 10 +++++----- types/index.test-d.ts | 26 +++++++++++++------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index dcd593f..0cd4f0c 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "type": "commonjs", "types": "types/index.d.ts", "scripts": { - "lint": "standard", - "lint:fix": "standard --fix", + "lint": "eslint", + "lint:fix": "eslint --fix", "unit": "tap test/**/*.test.js", "test": "npm run unit && npm run test:typescript", "test:typescript": "tsd" @@ -26,8 +26,8 @@ "devDependencies": { "@fastify/pre-commit": "^2.1.0", "fastify": "^5.0.0", + "neostandard": "^0.11.9", "sanitize-filename": "^1.6.3", - "standard": "^17.1.0", "tap": "^18.7.2", "tsd": "^0.31.0" }, diff --git a/types/index.d.ts b/types/index.d.ts index 26bbf1f..9f4645f 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -6,12 +6,12 @@ declare namespace SerializerSelector { export type SerializerFactory = ( externalSchemas?: unknown, options?: Options - ) => SerializerCompiler; + ) => SerializerCompiler export type SerializerCompiler = ( externalSchemas?: unknown, options?: Options - ) => Serializer; + ) => Serializer export type Serializer = (doc: any) => string @@ -35,11 +35,11 @@ declare namespace SerializerSelector { } export type { Options } - export const SerializerSelector: FastJsonStringifyFactory; - export function StandaloneSerializer(options: StandaloneOptions): SerializerFactory; + export const SerializerSelector: FastJsonStringifyFactory + export function StandaloneSerializer (options: StandaloneOptions): SerializerFactory export { SerializerSelector as default } } -declare function SerializerSelector(...params: Parameters): ReturnType +declare function SerializerSelector (...params: Parameters): ReturnType export = SerializerSelector diff --git a/types/index.test-d.ts b/types/index.test-d.ts index d1dbd85..e240d5d 100644 --- a/types/index.test-d.ts +++ b/types/index.test-d.ts @@ -1,4 +1,4 @@ -import { expectAssignable, expectError, expectType } from "tsd"; +import { expectAssignable, expectError, expectType } from 'tsd' import SerializerSelector, { RouteDefinition, Serializer, @@ -6,20 +6,20 @@ import SerializerSelector, { SerializerFactory, SerializerSelector as SerializerSelectorNamed, StandaloneSerializer, -} from ".."; +} from '..' /** * SerializerSelector */ { - const compiler = SerializerSelector(); - expectType(compiler); + const compiler = SerializerSelector() + expectType(compiler) } { - const compiler = SerializerSelectorNamed(); - expectType(compiler); + const compiler = SerializerSelectorNamed() + expectType(compiler) } { @@ -35,11 +35,11 @@ import SerializerSelector, { const externalSchemas1 = {} const factory = SerializerSelector() - expectType(factory); + expectType(factory) const compiler = factory(externalSchemas1, {}) - expectType(compiler); + expectType(compiler) const serializeFunc = compiler({ schema: sampleSchema }) - expectType(serializeFunc); + expectType(serializeFunc) expectType(serializeFunc({ name: 'hello' })) } @@ -55,8 +55,8 @@ const reader = StandaloneSerializer({ expectAssignable(route) return {} as Serializer }, -}); -expectType(reader); +}) +expectType(reader) const writer = StandaloneSerializer({ readMode: false, @@ -64,8 +64,8 @@ const writer = StandaloneSerializer({ expectAssignable(route) expectAssignable(code) }, -}); -expectType(writer); +}) +expectType(writer) { const base = { From e8596538ee4b8bf9c5adc6de3130ef6c69a0dc65 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Sun, 8 Dec 2024 10:54:19 +0000 Subject: [PATCH 2/3] chore: add eslint.config.js --- eslint.config.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 eslint.config.js diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..89fd678 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,6 @@ +'use strict' + +module.exports = require('neostandard')({ + ignores: require('neostandard').resolveIgnoresFromGitignore(), + ts: true +}) From 4a565dfa7c60f4a781ae8b59d52e3cf73b1b5d80 Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Sun, 8 Dec 2024 16:21:38 +0100 Subject: [PATCH 3/3] fix linting --- types/index.test-d.ts | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/types/index.test-d.ts b/types/index.test-d.ts index e240d5d..641c476 100644 --- a/types/index.test-d.ts +++ b/types/index.test-d.ts @@ -23,26 +23,24 @@ import SerializerSelector, { } { - { - const sampleSchema = { - $id: 'example1', - type: 'object', - properties: { - name: { type: 'string' } - } + const sampleSchema = { + $id: 'example1', + type: 'object', + properties: { + name: { type: 'string' } } + } - const externalSchemas1 = {} + const externalSchemas1 = {} - const factory = SerializerSelector() - expectType(factory) - const compiler = factory(externalSchemas1, {}) - expectType(compiler) - const serializeFunc = compiler({ schema: sampleSchema }) - expectType(serializeFunc) + const factory = SerializerSelector() + expectType(factory) + const compiler = factory(externalSchemas1, {}) + expectType(compiler) + const serializeFunc = compiler({ schema: sampleSchema }) + expectType(serializeFunc) - expectType(serializeFunc({ name: 'hello' })) - } + expectType(serializeFunc({ name: 'hello' })) } /**