Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![CI](https://github.com/fastify/fastify-response-validation/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/fastify/fastify-response-validation/actions/workflows/ci.yml)
[![NPM version](https://img.shields.io/npm/v/@fastify/response-validation.svg?style=flat)](https://www.npmjs.com/package/@fastify/response-validation)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)

A simple plugin that enables response validation for Fastify.
The use of this plugin will slow down your overall performance, so we suggest using it only during development.
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
})
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
"ajv-formats": "^3.0.1",
"c8": "^10.1.2",
"fastify": "^5.0.0",
"standard": "^17.1.0",
"neostandard": "^0.11.9",
"tsd": "^0.31.0"
},
"scripts": {
"lint": "standard",
"lint": "eslint",
"lint:fix": "eslint --fix",
"test": "npm run test:unit && npm run test:typescript",
"test:unit": "c8 --100 node --test",
"test:typescript": "tsd"
Expand Down
9 changes: 5 additions & 4 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { FastifyPluginCallback, RawServerBase, RawServerDefault } from "fastify";
import Ajv, { Options as AjvOptions } from "ajv";
import { FastifyPluginCallback, RawServerBase, RawServerDefault } from 'fastify'
import Ajv, { Options as AjvOptions } from 'ajv'

declare module 'fastify' {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface RouteShorthandOptions<RawServer extends RawServerBase = RawServerDefault> {
responseValidation?: boolean;
responseStatusCodeValidation?: boolean;
}
}

type FastifyResponseValidation = FastifyPluginCallback<fastifyResponseValidation.Options>;
type FastifyResponseValidation = FastifyPluginCallback<fastifyResponseValidation.Options>

declare namespace fastifyResponseValidation {
export interface Options {
Expand All @@ -23,5 +24,5 @@ declare namespace fastifyResponseValidation {
export { fastifyResponseValidation as default }
}

declare function fastifyResponseValidation(...params: Parameters<FastifyResponseValidation>): ReturnType<FastifyResponseValidation>
declare function fastifyResponseValidation (...params: Parameters<FastifyResponseValidation>): ReturnType<FastifyResponseValidation>
export = fastifyResponseValidation
26 changes: 13 additions & 13 deletions types/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import fastify, {
FastifyInstance,
} from 'fastify';
import plugin from '..';
import Ajv from 'ajv';
import Ajv2019 from "ajv/dist/2019";
import Ajv2020 from "ajv/dist/2020";
} from 'fastify'
import plugin from '..'
import Ajv from 'ajv'
import Ajv2019 from 'ajv/dist/2019'
import Ajv2020 from 'ajv/dist/2020'

const app: FastifyInstance = fastify();
app.register(plugin);
app.register(plugin, {});
app.register(plugin, { ajv: { coerceTypes: true } });
app.register(plugin, { responseValidation: true });
app.register(plugin, { responseValidation: false });
app.register(plugin, { responseStatusCodeValidation: true });
app.register(plugin, { responseStatusCodeValidation: false });
const app: FastifyInstance = fastify()
app.register(plugin)
app.register(plugin, {})
app.register(plugin, { ajv: { coerceTypes: true } })
app.register(plugin, { responseValidation: true })
app.register(plugin, { responseValidation: false })
app.register(plugin, { responseStatusCodeValidation: true })
app.register(plugin, { responseStatusCodeValidation: false })
app.register(plugin, { ajv: { plugins: [require('ajv-formats')] } })
app.register(plugin, { ajv: { plugins: [require('ajv-errors')] } })
app.register(plugin, { ajv: { plugins: [[require('ajv-errors'), {}]] } })
Expand Down
Loading