From 43ac5c20f1c6a48f628d757440c2d81b1fbc2aa9 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Sun, 8 Dec 2024 22:02:59 +0000 Subject: [PATCH] build(deps-dev): replace standard with neostandard (#254) * build(deps-dev): replace standard with neostandard * chore: add eslint.config.js --- README.md | 2 +- eslint.config.js | 6 ++++++ package.json | 5 +++-- types/example-async.test-d.ts | 6 +++--- types/example-callback.test-d.ts | 6 +++--- types/plugin.d.ts | 4 ++-- types/plugin.test-d.ts | 12 ++++++------ 7 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 eslint.config.js diff --git a/README.md b/README.md index a21d4d0..095588d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![CI](https://github.com/fastify/fastify-plugin/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/fastify/fastify-plugin/actions/workflows/ci.yml) [![NPM version](https://img.shields.io/npm/v/fastify-plugin.svg?style=flat)](https://www.npmjs.com/package/fastify-plugin) -[![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-plugin` is a plugin helper for [Fastify](https://github.com/fastify/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 78194ef..237e689 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "type": "commonjs", "types": "types/plugin.d.ts", "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:coverage": "c8 node --test && c8 report --reporter=html", @@ -33,8 +34,8 @@ "@types/node": "^22.0.0", "c8": "^10.1.2", "fastify": "^5.0.0", + "neostandard": "^0.11.9", "proxyquire": "^2.1.3", - "standard": "^17.1.0", "tsd": "^0.31.0" } } diff --git a/types/example-async.test-d.ts b/types/example-async.test-d.ts index fe2a1cd..b7c4a56 100644 --- a/types/example-async.test-d.ts +++ b/types/example-async.test-d.ts @@ -1,6 +1,6 @@ -import { FastifyPluginAsync } from "fastify"; +import { FastifyPluginAsync } from 'fastify' -type FastifyExampleAsync = FastifyPluginAsync; +type FastifyExampleAsync = FastifyPluginAsync declare namespace fastifyExampleAsync { @@ -14,6 +14,6 @@ declare namespace fastifyExampleAsync { export { fastifyExampleAsync as default } } -declare function fastifyExampleAsync(...params: Parameters): ReturnType +declare function fastifyExampleAsync (...params: Parameters): ReturnType export default fastifyExampleAsync diff --git a/types/example-callback.test-d.ts b/types/example-callback.test-d.ts index c23f1de..301905b 100644 --- a/types/example-callback.test-d.ts +++ b/types/example-callback.test-d.ts @@ -1,6 +1,6 @@ -import { FastifyPluginCallback } from "fastify"; +import { FastifyPluginCallback } from 'fastify' -type FastifyExampleCallback = FastifyPluginCallback; +type FastifyExampleCallback = FastifyPluginCallback declare namespace fastifyExampleCallback { @@ -14,6 +14,6 @@ declare namespace fastifyExampleCallback { export { fastifyExampleCallback as default } } -declare function fastifyExampleCallback(...params: Parameters): ReturnType +declare function fastifyExampleCallback (...params: Parameters): ReturnType export default fastifyExampleCallback diff --git a/types/plugin.d.ts b/types/plugin.d.ts index 502ccca..b04997b 100644 --- a/types/plugin.d.ts +++ b/types/plugin.d.ts @@ -53,9 +53,9 @@ declare function fastifyPlugin< TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault, Logger extends FastifyBaseLogger = FastifyBaseLogger, Fn extends FastifyPluginCallback | FastifyPluginAsync = FastifyPluginCallback ->( +> ( fn: Fn extends unknown ? Fn extends (...args: any) => Promise ? FastifyPluginAsync : FastifyPluginCallback : Fn, options?: fastifyPlugin.PluginMetadata | string -): Fn; +): Fn export = fastifyPlugin diff --git a/types/plugin.test-d.ts b/types/plugin.test-d.ts index 70ec5a7..d3066a5 100644 --- a/types/plugin.test-d.ts +++ b/types/plugin.test-d.ts @@ -1,10 +1,10 @@ -import fastifyPlugin from '..'; -import fastify, { FastifyPluginCallback, FastifyPluginAsync, FastifyError, FastifyInstance, FastifyPluginOptions, RawServerDefault, FastifyTypeProviderDefault, FastifyBaseLogger } from 'fastify'; +import fastifyPlugin from '..' +import fastify, { FastifyPluginCallback, FastifyPluginAsync, FastifyError, FastifyInstance, FastifyPluginOptions, RawServerDefault, FastifyTypeProviderDefault, FastifyBaseLogger } from 'fastify' import { expectAssignable, expectError, expectNotType, expectType } from 'tsd' -import { Server } from "node:https" -import { TypeBoxTypeProvider } from "@fastify/type-provider-typebox" -import fastifyExampleCallback from './example-callback.test-d'; -import fastifyExampleAsync from './example-async.test-d'; +import { Server } from 'node:https' +import { TypeBoxTypeProvider } from '@fastify/type-provider-typebox' +import fastifyExampleCallback from './example-callback.test-d' +import fastifyExampleAsync from './example-async.test-d' interface Options { foo: string