From 5bbb84d596c74e4eb3b01a3b1b9da5fb2afbc63a Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Sun, 8 Dec 2024 12:57:04 +0000 Subject: [PATCH] build(deps-dev): replace standard with neostandard (#222) --- README.md | 2 +- eslint.config.js | 6 ++++++ package.json | 8 ++++---- types/index.d.ts | 12 ++++++------ types/index.test-d.ts | 12 ++++++------ 5 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 eslint.config.js diff --git a/README.md b/README.md index be71c67..58150fd 100644 --- a/README.md +++ b/README.md @@ -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). 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/package.json b/package.json index bcecc6a..2f815fc 100644 --- a/package.json +++ b/package.json @@ -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" }, @@ -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" }, diff --git a/types/index.d.ts b/types/index.d.ts index 8326fcc..28dfe36 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -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; @@ -26,9 +26,9 @@ 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 @@ -36,5 +36,5 @@ declare namespace fastifyMiddie { export { fastifyMiddie as default } } -declare function fastifyMiddie(...params: Parameters): ReturnType +declare function fastifyMiddie (...params: Parameters): ReturnType export = fastifyMiddie diff --git a/types/index.test-d.ts b/types/index.test-d.ts index 1b05a53..7ea0dea 100644 --- a/types/index.test-d.ts +++ b/types/index.test-d.ts @@ -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({}) -expectAssignable({ body: { foo: 'bar' }, query: { bar: 'foo' }}) +expectAssignable({ body: { foo: 'bar' }, query: { bar: 'foo' } }) expectAssignable({}) app.use('/', (_req, _res, next) => {