Skip to content

Commit f8e659e

Browse files
authored
build(deps-dev): replace standard with neostandard (#155)
* build(deps-dev): replace standard with neostandard * chore: add eslint.config.js * chore: rebase
1 parent 2b7ce89 commit f8e659e

File tree

5 files changed

+123
-115
lines changed

5 files changed

+123
-115
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-mysql/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/fastify/fastify-mysql/actions/workflows/ci.yml)
44
[![NPM version](https://img.shields.io/npm/v/@fastify/mysql.svg?style=flat)](https://www.npmjs.com/package/@fastify/mysql)
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 MySQL connection plugin; with this you can share the same MySQL connection pool in every part of your server.
88
Under the hood the [mysql2](https://github.com/sidorares/node-mysql2) is used. If you don't use the `connectionString` option, the options that you pass to `register` will be passed to the MySQL pool builder.

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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"type": "commonjs",
77
"types": "types/index.d.ts",
88
"scripts": {
9-
"lint": "standard",
9+
"lint": "eslint",
10+
"lint:fix": "eslint --fix",
1011
"mariadb": "docker run -d -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes --rm mariadb:10.1",
1112
"mysql": "npm run mysql:8.0",
1213
"mysql:5.7": "docker run -d -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes --rm mysql:5.7",
@@ -40,7 +41,7 @@
4041
"@types/node": "^22.0.0",
4142
"c8": "^10.1.2",
4243
"fastify": "^5.0.0",
43-
"standard": "^17.1.0",
44+
"neostandard": "^0.12.0",
4445
"tsd": "^0.31.1"
4546
},
4647
"publishConfig": {

types/index.d.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FastifyPluginCallback } from "fastify";
1+
import { FastifyPluginCallback } from 'fastify'
22
import {
33
Connection,
44
ConnectionOptions,
@@ -9,54 +9,54 @@ import {
99
ProcedureCallPacket,
1010
ResultSetHeader,
1111
RowDataPacket,
12-
} from "mysql2";
12+
} from 'mysql2'
1313
import {
1414
Connection as PromiseConnection,
1515
Pool as PromisePool,
16-
} from "mysql2/promise";
16+
} from 'mysql2/promise'
1717

18-
type FastifyMysql = FastifyPluginCallback<fastifyMysql.FastifyMySQLOptions>;
18+
type FastifyMysql = FastifyPluginCallback<fastifyMysql.FastifyMySQLOptions>
1919

2020
declare namespace fastifyMysql {
2121

22-
type MySQLPoolConnection = MySQLPool | MySQLConnection | MySQLPromisePool | MySQLPromiseConnection;
23-
export function isMySQLPool(obj: MySQLPoolConnection): obj is MySQLPool;
24-
export function isMySQLPromisePool(obj: MySQLPoolConnection): obj is MySQLPromisePool;
25-
export function isMySQLConnection(obj: MySQLPoolConnection): obj is MySQLConnection;
26-
export function isMySQLPromiseConnection(obj: MySQLPoolConnection): obj is MySQLPromiseConnection;
22+
type MySQLPoolConnection = MySQLPool | MySQLConnection | MySQLPromisePool | MySQLPromiseConnection
23+
export function isMySQLPool (obj: MySQLPoolConnection): obj is MySQLPool
24+
export function isMySQLPromisePool (obj: MySQLPoolConnection): obj is MySQLPromisePool
25+
export function isMySQLConnection (obj: MySQLPoolConnection): obj is MySQLConnection
26+
export function isMySQLPromiseConnection (obj: MySQLPoolConnection): obj is MySQLPromiseConnection
2727

2828
// upstream package missed type
29-
type escapeId = (val: any, forbidQualified?: boolean) => string;
29+
type escapeId = (val: any, forbidQualified?: boolean) => string
3030

3131
interface BaseClient {
3232
format: typeof format;
3333
escape: typeof escape;
3434
escapeId: escapeId;
3535
}
3636

37-
export type MySQLConnection = Pick<Connection, "query" | "execute"> & {
37+
export type MySQLConnection = Pick<Connection, 'query' | 'execute'> & {
3838
connection: Connection;
39-
} & BaseClient;
39+
} & BaseClient
4040

41-
export type MySQLPool = Pick<Pool, "query" | "execute" | "getConnection"> & {
41+
export type MySQLPool = Pick<Pool, 'query' | 'execute' | 'getConnection'> & {
4242
pool: Pool;
43-
} & BaseClient;
43+
} & BaseClient
4444

4545
export type MySQLPromiseConnection = Pick<
4646
PromiseConnection,
47-
"query" | "execute"
47+
'query' | 'execute'
4848
> & {
4949
connection: PromiseConnection;
50-
} & BaseClient;
50+
} & BaseClient
5151

5252
export type MySQLPromisePool = Pick<
5353
PromisePool,
54-
"query" | "execute" | "getConnection"
54+
'query' | 'execute' | 'getConnection'
5555
> & {
5656
pool: PromisePool;
57-
} & BaseClient;
57+
} & BaseClient
5858

59-
export type ConnectionType = "connection" | "pool";
59+
export type ConnectionType = 'connection' | 'pool'
6060

6161
export interface FastifyMySQLOptions extends PoolOptions, ConnectionOptions {
6262
type?: ConnectionType;
@@ -66,7 +66,7 @@ declare namespace fastifyMysql {
6666
}
6767

6868
export type MySQLProcedureCallPacket<
69-
T = [MySQLRowDataPacket[], MySQLResultSetHeader] | MySQLResultSetHeader,
69+
T = [MySQLRowDataPacket[], MySQLResultSetHeader] | MySQLResultSetHeader
7070
> = ProcedureCallPacket<T>
7171
export type MySQLResultSetHeader = ResultSetHeader
7272
export type MySQLRowDataPacket = RowDataPacket
@@ -80,5 +80,5 @@ declare namespace fastifyMysql {
8080
}
8181
}
8282

83-
declare function fastifyMysql(...params: Parameters<FastifyMysql>): ReturnType<FastifyMysql>
83+
declare function fastifyMysql (...params: Parameters<FastifyMysql>): ReturnType<FastifyMysql>
8484
export = fastifyMysql

0 commit comments

Comments
 (0)