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 #158

Merged
merged 3 commits into from
Dec 12, 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 @@

[![NPM Version][npm-image]][npm-url]
[![CI](https://github.com/fastify/fastify-funky/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fastify/fastify-funky/actions/workflows/ci.yml)
[![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)

Support for Fastify routes returning functional structures, such as `fp-ts` Either, Task, TaskEither, or plain JavaScript parameterless functions.
Let's go funky, let's go functional!
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
})
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +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"
"test:typescript": "tsd"
},
"dependencies": {
"fastify-plugin": "^5.0.0"
Expand All @@ -27,7 +28,7 @@
"c8": "^10.1.2",
"fastify": "^5.0.0",
"fp-ts": "^2.11.2",
"standard": "^17.0.0",
"neostandard": "^0.11.9",
"tsd": "^0.31.1"
},
"homepage": "https://github.com/fastify/fastify-funky",
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ declare namespace fastifyFunky {
export { fastifyFunky as default }
}

declare function fastifyFunky(...params: Parameters<FastifyFunky>): ReturnType<FastifyFunky>
declare function fastifyFunky (...params: Parameters<FastifyFunky>): ReturnType<FastifyFunky>
export = fastifyFunky
34 changes: 17 additions & 17 deletions types/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FastifyInstance, FastifyPluginCallback, FastifyReply, FastifyRequest } from 'fastify'
import fastify from 'fastify'
import { either, task, taskEither } from 'fp-ts'
import { expectType, expectError, expectAssignable } from 'tsd'
import { expectType, expectAssignable } from 'tsd'

import { fastifyFunky as fastifyFunkyNamed } from '..'
import fastifyFunkyDefault from '..'
Expand Down Expand Up @@ -53,38 +53,38 @@ app.get('/func', (req, reply) => {
})

// this is allowed
app.get("/", (req, reply) => {
app.get('/', (req, reply) => {
expectAssignable<FastifyRequest>(req)
expectAssignable<FastifyReply>(reply)
return { right: { id: 1 } };
});
app.get("/", (req, reply) => {
return { right: { id: 1 } }
})
app.get('/', (req, reply) => {
expectAssignable<FastifyRequest>(req)
expectAssignable<FastifyReply>(reply)
return { left: new Error('error') };
});
app.get("/", (req, reply) => {
return { left: new Error('error') }
})
app.get('/', (req, reply) => {
expectAssignable<FastifyRequest>(req)
expectAssignable<FastifyReply>(reply)
return taskEither.fromEither(either.left(new Error('Invalid state')))
});
app.get("/", (req, reply) => {
})
app.get('/', (req, reply) => {
expectAssignable<FastifyRequest>(req)
expectAssignable<FastifyReply>(reply)
return taskEither.fromTask(task.of(Promise.resolve({})))
});
app.get("/", (req, reply) => {
})
app.get('/', (req, reply) => {
expectAssignable<FastifyRequest>(req)
expectAssignable<FastifyReply>(reply)
return either.of(Promise.resolve({}))
});
app.get("/", (req, reply) => {
})
app.get('/', (req, reply) => {
expectAssignable<FastifyRequest>(req)
expectAssignable<FastifyReply>(reply)
return task.of(Promise.resolve({}))
});
app.get("/", (req, reply) => {
})
app.get('/', (req, reply) => {
expectAssignable<FastifyRequest>(req)
expectAssignable<FastifyReply>(reply)
return taskEither.of(Promise.resolve({}))
});
})
Loading