Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

build(deps-dev): replace standard with neostandard #109

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .eslintrc.json

This file was deleted.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 6 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict'

module.exports = require('neostandard')({
ignores: require('neostandard').resolveIgnoresFromGitignore(),
ts: true
})
8 changes: 4 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export interface JsonSchemaToTsProvider<Options extends FromSchemaOptions = From
export type FastifyPluginCallbackJsonSchemaToTs<
Options extends FastifyPluginOptions = Record<never, never>,
Server extends RawServerBase = RawServerDefault,
Logger extends FastifyBaseLogger = FastifyBaseLogger,
> = FastifyPluginCallback<Options, Server, JsonSchemaToTsProvider, Logger>;
Logger extends FastifyBaseLogger = FastifyBaseLogger
> = FastifyPluginCallback<Options, Server, JsonSchemaToTsProvider, Logger>

/**
* FastifyPluginAsync with JSON Schema to Typescript automatic type inference
Expand All @@ -47,5 +47,5 @@ export type FastifyPluginCallbackJsonSchemaToTs<
export type FastifyPluginAsyncJsonSchemaToTs<
Options extends FastifyPluginOptions = Record<never, never>,
Server extends RawServerBase = RawServerDefault,
Logger extends FastifyBaseLogger = FastifyBaseLogger,
> = FastifyPluginAsync<Options, Server, JsonSchemaToTsProvider, Logger>;
Logger extends FastifyBaseLogger = FastifyBaseLogger
> = FastifyPluginAsync<Options, Server, JsonSchemaToTsProvider, Logger>
13 changes: 4 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions types/references.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
required: ['line1', 'city']
} as const
type Address = FromSchema<typeof addressSchema>;
type Address = FromSchema<typeof addressSchema>

const userSchema = {
type: 'object',
Expand All @@ -26,7 +26,7 @@
} as const
type User = FromSchema<typeof userSchema>

const sharedSchema = {

Check failure on line 29 in types/references.test-d.ts

View workflow job for this annotation

GitHub Actions / test / Lint Code

'sharedSchema' is assigned a value but only used as a type
$id: 'shared-schema',
definitions: {
address: addressSchema,
Expand All @@ -36,7 +36,7 @@

type JsonSchemaToTsProviderWithSharedSchema = JsonSchemaToTsProvider<{
references: [typeof sharedSchema];
}>;
}>
const fastify = Fastify().withTypeProvider<JsonSchemaToTsProviderWithSharedSchema>()

expectAssignable<FastifyInstance<RawServerDefault, RawRequestDefaultExpression, RawReplyDefaultExpression, FastifyLoggerInstance, JsonSchemaToTsProviderWithSharedSchema>>(fastify)
Expand Down
Loading