diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 7c24548..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "env": { - "es2021": true, - "node": true - }, - "extends": [ - "standard" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint" - ], - "rules": { - }, - "ignorePatterns": ["dist/"] -} diff --git a/README.md b/README.md index 22064f2..b4d4601 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # @fastify/type-provider-json-schema-to-ts +[![CI](https://github.com/fastify/fastify-type-provider-json-schema-to-ts/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fastify/fastify-type-provider-json-schema-to-ts/actions/workflows/ci.yml) +[![NPM version](https://img.shields.io/npm/v/@fastify/type-provider-json-schema-to-ts.svg?style=flat)](https://www.npmjs.com/package/@fastify/type-provider-json-schema-to-ts) +[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard) + A Type Provider for [json-schema-to-ts](https://github.com/ThomasAribart/json-schema-to-ts) ## Install 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 +}) diff --git a/index.ts b/index.ts index 69dd1d0..3c0fd37 100644 --- a/index.ts +++ b/index.ts @@ -30,8 +30,8 @@ export interface JsonSchemaToTsProvider, Server extends RawServerBase = RawServerDefault, - Logger extends FastifyBaseLogger = FastifyBaseLogger, -> = FastifyPluginCallback; + Logger extends FastifyBaseLogger = FastifyBaseLogger +> = FastifyPluginCallback /** * FastifyPluginAsync with JSON Schema to Typescript automatic type inference @@ -47,5 +47,5 @@ export type FastifyPluginCallbackJsonSchemaToTs< export type FastifyPluginAsyncJsonSchemaToTs< Options extends FastifyPluginOptions = Record, Server extends RawServerBase = RawServerDefault, - Logger extends FastifyBaseLogger = FastifyBaseLogger, -> = FastifyPluginAsync; + Logger extends FastifyBaseLogger = FastifyBaseLogger +> = FastifyPluginAsync diff --git a/package.json b/package.json index cb365ab..a0c05e8 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "build": "rimraf dist && mkdir dist && tsc --outDir dist", "test": "npm run build && npm run test:typescript", "test:typescript": "tsc --strict --noEmit && tsd", - "lint": "eslint \"**/*.ts\"", - "lint:fix": "eslint \"**/*.ts\" --fix", + "lint": "eslint", + "lint:fix": "eslint --fix", "prepublishOnly": "npm run build" }, "repository": { @@ -35,15 +35,10 @@ "devDependencies": { "@fastify/pre-commit": "^2.1.0", "@types/node": "^20.14.2", - "@typescript-eslint/eslint-plugin": "^7.13.0", - "@typescript-eslint/parser": "^7.13.0", - "eslint": "^8.57.0", - "eslint-config-standard": "^17.1.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-n": "^16.6.2", - "eslint-plugin-promise": "^6.2.0", + "eslint": "^9.17.0", "fastify": "^5.0.0", "fastify-tsconfig": "^2.0.0", + "neostandard": "^0.12.0", "rimraf": "^5.0.7", "tsd": "^0.31.0", "typescript": "~5.4.5" diff --git a/types/references.test-d.ts b/types/references.test-d.ts index c9c99e0..1bb5f3a 100644 --- a/types/references.test-d.ts +++ b/types/references.test-d.ts @@ -13,7 +13,7 @@ const addressSchema = { }, required: ['line1', 'city'] } as const -type Address = FromSchema; +type Address = FromSchema const userSchema = { type: 'object', @@ -26,6 +26,7 @@ const userSchema = { } as const type User = FromSchema +// eslint-disable-next-line @typescript-eslint/no-unused-vars const sharedSchema = { $id: 'shared-schema', definitions: { @@ -36,7 +37,7 @@ const sharedSchema = { type JsonSchemaToTsProviderWithSharedSchema = JsonSchemaToTsProvider<{ references: [typeof sharedSchema]; -}>; +}> const fastify = Fastify().withTypeProvider() expectAssignable>(fastify)