Skip to content

Commit 63bf991

Browse files
authored
build(deps-dev): replace standard with neostandard (#157)
1 parent cfc2ddb commit 63bf991

File tree

5 files changed

+47
-42
lines changed

5 files changed

+47
-42
lines changed

Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![CI](https://github.com/fastify/fastify-caching/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/fastify/fastify-caching/actions/workflows/ci.yml)
44
[![NPM version](https://img.shields.io/npm/v/@fastify/caching.svg?style=flat)](https://www.npmjs.com/package/@fastify/caching)
5-
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
5+
[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)
66

77
*@fastify/caching* is a plugin for the [Fastify](http://fastify.dev/) framework
88
that provides server-side caching and mechanisms for manipulating HTTP cache headers according to

eslint.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict'
2+
3+
module.exports = require('neostandard')({
4+
ignores: require('neostandard').resolveIgnoresFromGitignore(),
5+
ts: true
6+
})

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"type": "commonjs",
77
"types": "types/index.d.ts",
88
"scripts": {
9-
"lint": "standard --verbose | snazzy",
10-
"lint:fix": "standard --verbose --fix | snazzy",
9+
"lint": "eslint",
10+
"lint:fix": "eslint --fix",
1111
"test": "npm run test:unit && npm run test:typescript",
1212
"test:typescript": "tsd",
1313
"test:unit": "c8 --100 node --test",
@@ -38,8 +38,7 @@
3838
"@types/node": "^22.0.0",
3939
"c8": "^10.1.2",
4040
"fastify": "^5.0.0",
41-
"snazzy": "^9.0.0",
42-
"standard": "^17.1.0",
41+
"neostandard": "^0.11.9",
4342
"tsd": "^0.31.0"
4443
},
4544
"dependencies": {

types/index.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types='node' />
22

3-
import { FastifyPluginCallback } from 'fastify';
3+
import { FastifyPluginCallback } from 'fastify'
44

55
declare module 'fastify' {
66
interface FastifyInstance {
@@ -33,13 +33,13 @@ declare module 'fastify' {
3333

3434
type FastifyCaching = FastifyPluginCallback<fastifyCaching.FastifyCachingPluginOptions> & {
3535
privacy: fastifyCaching.Privacy;
36-
};
36+
}
3737

3838
type CacheResult<T> = {
3939
item: T,
4040
stored: number,
4141
ttl: number,
42-
} | null;
42+
} | null
4343

4444
declare namespace fastifyCaching {
4545
/**
@@ -130,11 +130,11 @@ declare namespace fastifyCaching {
130130
serverExpiresIn?: number;
131131
}
132132

133-
export const privacy: Privacy;
133+
export const privacy: Privacy
134134

135-
export const fastifyCaching: FastifyCaching;
136-
export { fastifyCaching as default };
135+
export const fastifyCaching: FastifyCaching
136+
export { fastifyCaching as default }
137137
}
138138

139-
declare function fastifyCaching(...params: Parameters<FastifyCaching>): ReturnType<FastifyCaching>
139+
declare function fastifyCaching (...params: Parameters<FastifyCaching>): ReturnType<FastifyCaching>
140140
export = fastifyCaching

types/index.test-d.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
1-
import Fastify, { FastifyReply } from 'fastify';
2-
import { expectAssignable, expectError, expectType } from 'tsd';
1+
import Fastify, { FastifyReply } from 'fastify'
2+
import { expectAssignable, expectError, expectType } from 'tsd'
33
import fastifyCaching, {
44
AbstractCacheCompliantObject,
55
FastifyCachingPluginOptions,
6-
} from '..';
6+
} from '..'
77

8-
const fastify = Fastify({ logger: true });
8+
const fastify = Fastify({ logger: true })
99

1010
const cachingOptions: FastifyCachingPluginOptions = {
1111
privacy: fastifyCaching.privacy.PUBLIC,
1212
expiresIn: 300,
1313
cacheSegment: 'fastify-caching',
14-
};
15-
expectAssignable<FastifyCachingPluginOptions>(cachingOptions);
14+
}
15+
expectAssignable<FastifyCachingPluginOptions>(cachingOptions)
1616

17-
fastify.register(fastifyCaching, cachingOptions);
17+
fastify.register(fastifyCaching, cachingOptions)
1818

19-
expectType<AbstractCacheCompliantObject>(fastify.cache);
20-
expectType<AbstractCacheCompliantObject['get']>(fastify.cache.get);
21-
expectType<AbstractCacheCompliantObject['set']>(fastify.cache.set);
22-
expectType<string>(fastify.cacheSegment);
19+
expectType<AbstractCacheCompliantObject>(fastify.cache)
20+
expectType<AbstractCacheCompliantObject['get']>(fastify.cache.get)
21+
expectType<AbstractCacheCompliantObject['set']>(fastify.cache.set)
22+
expectType<string>(fastify.cacheSegment)
2323
// expectType<number>(fastify.etagMaxLife);
2424

2525
fastify.get('/one', async (request, reply) => {
26-
expectType<(tag?: string, timeToLive?: number) => FastifyReply>(reply.etag);
27-
expectType<(date?: Date) => FastifyReply>(reply.expires);
26+
expectType<(tag?: string, timeToLive?: number) => FastifyReply>(reply.etag)
27+
expectType<(date?: Date) => FastifyReply>(reply.expires)
2828

29-
expectType<FastifyReply>(reply.etag('hello', 6000));
30-
expectType<FastifyReply>(reply.expires(new Date(Date.now() + 6000)));
29+
expectType<FastifyReply>(reply.etag('hello', 6000))
30+
expectType<FastifyReply>(reply.expires(new Date(Date.now() + 6000)))
3131

32-
return { message: 'one' };
33-
});
32+
return { message: 'one' }
33+
})
3434

3535
fastify.get('/two', async (request, reply) => {
3636
expectType<FastifyReply>(
3737
reply.etag('hello', 6000).expires(new Date(Date.now() + 6000))
38-
);
38+
)
3939

40-
return { message: 'two' };
41-
});
40+
return { message: 'two' }
41+
})
4242

4343
// We register a new instance that should trigger a typescript error.
44-
const shouldErrorApp = Fastify({ logger: true });
44+
const shouldErrorApp = Fastify({ logger: true })
4545

4646
const badCachingOptions = {
4747
privacy: fastifyCaching.privacy.PRIVATE,
4848
expiresIn: 'a string instead of a number of second',
4949
cacheSegment: 'fastify-caching',
50-
};
50+
}
5151

52-
expectError(shouldErrorApp.register(fastifyCaching, badCachingOptions));
52+
expectError(shouldErrorApp.register(fastifyCaching, badCachingOptions))
5353

5454
fastify.get('/three', async (request, reply) => {
5555
expectAssignable<Promise<unknown>>(
5656
fastify.cache.get('well-known')
57-
);
57+
)
5858
expectAssignable<Promise<{ item: string; stored: number; ttl: number; } | null>>(
5959
fastify.cache.get<string>('well-known')
60-
);
60+
)
6161
expectType<void>(
6262
fastify.cache.get<string>('well-known', (err, value) => {
63-
expectType<unknown>(err);
64-
expectAssignable<{ item: string; stored: number; ttl: number; } | null>(value);
63+
expectType<unknown>(err)
64+
expectAssignable<{ item: string; stored: number; ttl: number; } | null>(value)
6565
})
66-
);
66+
)
6767

68-
return { message: 'two' };
69-
});
68+
return { message: 'two' }
69+
})

0 commit comments

Comments
 (0)