diff --git a/README.md b/README.md index f6de1d5..e0e040d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![CI](https://github.com/fastify/fastify-schedule/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fastify/fastify-schedule/actions/workflows/ci.yml) [![NPM version](https://img.shields.io/npm/v/@fastify/schedule.svg?style=flat)](https://www.npmjs.com/package/@fastify/schedule) [![NPM downloads](https://img.shields.io/npm/dm/@fastify/schedule.svg?style=flat)](https://www.npmjs.com/package/@fastify/schedule) -[![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 for scheduling periodic jobs. Provides an instance of [toad-scheduler](https://github.com/kibertoad/toad-scheduler) on fastify instance. Jobs are stopped automatically when the fastify instance is stopped. 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 4dc0a20..1478c1d 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,11 @@ "type": "commonjs", "types": "types/index.d.ts", "scripts": { + "lint": "eslint", + "lint:fix": "eslint --fix", "test": "npm run test:unit && npm run test:typescript", "test:unit": "c8 --100 node --test", - "test:typescript": "tsd", - "lint": "standard", - "lint:fix": "standard --fix" + "test:typescript": "tsd" }, "dependencies": { "fastify-plugin": "^5.0.0" @@ -30,8 +30,8 @@ "@types/node": "^22.0.0", "c8": "^10.1.2", "fastify": "^5.0.0", + "neostandard": "^0.11.9", "prettier": "^3.2.5", - "standard": "^17.1.0", "toad-scheduler": "^3.0.1", "tsd": "^0.31.1" }, diff --git a/types/index.d.ts b/types/index.d.ts index 1b24274..3fa9a27 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,18 +1,18 @@ -import { FastifyPluginCallback } from "fastify"; -import { ToadScheduler } from "toad-scheduler"; +import { FastifyPluginCallback } from 'fastify' +import { ToadScheduler } from 'toad-scheduler' -declare module "fastify" { +declare module 'fastify' { interface FastifyInstance { scheduler: ToadScheduler; } } -type FastifySchedule = FastifyPluginCallback; +type FastifySchedule = FastifyPluginCallback declare namespace fastifySchedule { export const fastifySchedule: FastifySchedule export { fastifySchedule as default } } -declare function fastifySchedule(...params: Parameters): ReturnType +declare function fastifySchedule (...params: Parameters): ReturnType export = fastifySchedule diff --git a/types/index.test-d.ts b/types/index.test-d.ts index 056048d..6128a15 100644 --- a/types/index.test-d.ts +++ b/types/index.test-d.ts @@ -1,26 +1,26 @@ -import { FastifyInstance, FastifyPluginCallback } from "fastify"; -import fastify from "fastify"; -import { expectType } from "tsd"; +import { FastifyInstance, FastifyPluginCallback } from 'fastify' +import fastify from 'fastify' +import { expectType } from 'tsd' -import { fastifySchedule as fastifyScheduleNamed } from ".."; -import fastifyScheduleDefault from ".."; -import * as fastifyScheduleStar from ".."; -import fastifyScheduleCjsImport = require(".."); -const fastifyScheduleCjs = require("./"); +import { fastifySchedule as fastifyScheduleNamed } from '..' +import fastifyScheduleDefault from '..' +import * as fastifyScheduleStar from '..' +import fastifyScheduleCjsImport = require('..') +const fastifyScheduleCjs = require('./') -const app: FastifyInstance = fastify(); -app.register(fastifyScheduleNamed); -app.register(fastifyScheduleDefault); -app.register(fastifyScheduleCjs); -app.register(fastifyScheduleCjsImport.default); -app.register(fastifyScheduleCjsImport.fastifySchedule); -app.register(fastifyScheduleStar.default); -app.register(fastifyScheduleStar.fastifySchedule); +const app: FastifyInstance = fastify() +app.register(fastifyScheduleNamed) +app.register(fastifyScheduleDefault) +app.register(fastifyScheduleCjs) +app.register(fastifyScheduleCjsImport.default) +app.register(fastifyScheduleCjsImport.fastifySchedule) +app.register(fastifyScheduleStar.default) +app.register(fastifyScheduleStar.fastifySchedule) -expectType(fastifyScheduleNamed); -expectType(fastifyScheduleDefault); -expectType(fastifyScheduleCjsImport.default); -expectType(fastifyScheduleCjsImport.fastifySchedule); -expectType(fastifyScheduleStar.default); -expectType(fastifyScheduleStar.fastifySchedule); -expectType(fastifyScheduleCjs); +expectType(fastifyScheduleNamed) +expectType(fastifyScheduleDefault) +expectType(fastifyScheduleCjsImport.default) +expectType(fastifyScheduleCjsImport.fastifySchedule) +expectType(fastifyScheduleStar.default) +expectType(fastifyScheduleStar.fastifySchedule) +expectType(fastifyScheduleCjs)