Skip to content

Commit

Permalink
build(deps-dev): replace standard with neostandard (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Dec 8, 2024
1 parent 67acf18 commit 5bbb84d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
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/middie/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/fastify/middie/actions/workflows/ci.yml)
[![NPM version](https://img.shields.io/npm/v/@fastify/middie.svg?style=flat)](https://www.npmjs.com/package/@fastify/middie)
[![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)

*@fastify/middie* is the plugin that adds middleware support on steroids to [Fastify](https://www.npmjs.com/package/fastify).

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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"types": "types/index.d.ts",
"scripts": {
"coverage": "tap --cov --coverage-report=html test.js",
"lint": "standard",
"lint:fix": "standard --fix",
"test": "standard && tap test/*.test.js && tsd",
"lint": "eslint",
"lint:fix": "eslint --fix",
"test": "tap test/*.test.js && tsd",
"test:unit": "tap",
"test:typescript": "tsd"
},
Expand Down Expand Up @@ -42,9 +42,9 @@
"cors": "^2.8.5",
"fastify": "^5.0.0",
"helmet": "^8.0.0",
"neostandard": "^0.11.9",
"serve-static": "^1.15.0",
"simple-get": "^4.0.1",
"standard": "^17.1.0",
"tap": "^18.7.2",
"tsd": "^0.31.0"
},
Expand Down
12 changes: 6 additions & 6 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as connect from 'connect'
import { FastifyPluginCallback } from 'fastify'
import * as http from "http";
import * as http from 'http'

declare module "fastify" {
declare module 'fastify' {
interface FastifyInstance {
use(fn: fastifyMiddie.Handler): this;
use(route: string, fn: fastifyMiddie.Handler): this;
Expand All @@ -26,15 +26,15 @@ declare namespace fastifyMiddie {
body?: any;
query?: any;
}
export type NextFunction = (err?: any) => void;
export type SimpleHandleFunction = (req: http.IncomingMessage & IncomingMessageExtended, res: http.ServerResponse) => void;
export type NextHandleFunction = (req: connect.IncomingMessage & IncomingMessageExtended, res: http.ServerResponse, next: NextFunction) => void;
export type NextFunction = (err?: any) => void
export type SimpleHandleFunction = (req: http.IncomingMessage & IncomingMessageExtended, res: http.ServerResponse) => void
export type NextHandleFunction = (req: connect.IncomingMessage & IncomingMessageExtended, res: http.ServerResponse, next: NextFunction) => void

export type Handler = SimpleHandleFunction | NextHandleFunction

export const fastifyMiddie: FastifyMiddie
export { fastifyMiddie as default }
}

declare function fastifyMiddie(...params: Parameters<FastifyMiddie>): ReturnType<FastifyMiddie>
declare function fastifyMiddie (...params: Parameters<FastifyMiddie>): ReturnType<FastifyMiddie>
export = fastifyMiddie
12 changes: 6 additions & 6 deletions types/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import fastify from "fastify";
import middiePlugin, {MiddiePluginOptions, IncomingMessageExtended, FastifyMiddieOptions} from "..";
import { expectAssignable, expectType, expectDeprecated } from "tsd";
import fastify from 'fastify'
import middiePlugin, { MiddiePluginOptions, IncomingMessageExtended, FastifyMiddieOptions } from '..'
import { expectAssignable, expectType, expectDeprecated } from 'tsd'

const app = fastify();
app.register(middiePlugin);
const app = fastify()
app.register(middiePlugin)

expectAssignable<MiddiePluginOptions>({})

expectAssignable<IncomingMessageExtended>({ body: { foo: 'bar' }, query: { bar: 'foo' }})
expectAssignable<IncomingMessageExtended>({ body: { foo: 'bar' }, query: { bar: 'foo' } })
expectAssignable<IncomingMessageExtended>({})

app.use('/', (_req, _res, next) => {
Expand Down

0 comments on commit 5bbb84d

Please sign in to comment.