Skip to content

Commit d4f3692

Browse files
authored
Merge pull request #2073 from wellwelwel/refactor-ts-1
refactor: resolve small eslint rules and TS settings
2 parents 2b1520f + af3f934 commit d4f3692

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1317
-1941
lines changed

.eslintrc

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"extends": ["prettier", "eslint:recommended", "plugin:markdown/recommended"],
2+
"extends": ["prettier", "eslint:recommended", "plugin:markdown/recommended"],
33
"parserOptions": {
4-
"ecmaVersion": 2022
4+
"ecmaVersion": "latest"
55
},
66
"plugins": ["markdown", "async-await"],
77
"env": {
@@ -39,16 +39,24 @@
3939
},
4040
"overrides": [
4141
{
42-
"files": ["**/*.ts"],
42+
"files": ["**/*.ts"],
4343
"parser": "@typescript-eslint/parser",
44-
"extends": [
45-
"plugin:@typescript-eslint/recommended",
46-
"prettier"
47-
],
48-
"plugins": ["@typescript-eslint"]
44+
"extends": ["plugin:@typescript-eslint/recommended"],
45+
"plugins": ["@typescript-eslint"],
46+
"rules": {
47+
"@typescript-eslint/no-empty-interface": "off",
48+
"@typescript-eslint/no-explicit-any": "off",
49+
"no-restricted-syntax": [
50+
"error",
51+
{
52+
"selector": "ImportDeclaration[source.value=/^\\./][source.value!=/\\.(js)$/]",
53+
"message": "Local imports must have the explicit extension"
54+
}
55+
]
56+
}
4957
},
5058
{
51-
"files": ["**/*.md/*js"],
59+
"files": ["**/*.md/*js"],
5260
"rules": {
5361
"no-undef": "off",
5462
"no-unused-vars": "off",

index.d.ts

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import * as mysql from './typings/mysql/index.js';
12
import {
23
Connection as PromiseConnection,
34
Pool as PromisePool,
45
PoolConnection as PromisePoolConnection,
5-
} from './promise';
6+
} from './promise.js';
67

7-
import * as mysql from './typings/mysql';
8-
export * from './typings/mysql';
8+
export * from './typings/mysql/index.js';
99

1010
export interface Connection extends mysql.Connection {
1111
execute<
@@ -72,7 +72,13 @@ export interface Connection extends mysql.Connection {
7272
): mysql.Query;
7373
ping(callback?: (err: mysql.QueryError | null) => any): void;
7474
unprepare(sql: string): mysql.PrepareStatementInfo;
75-
prepare(sql: string, callback?: (err: mysql.QueryError | null, statement: mysql.PrepareStatementInfo) => any): mysql.Prepare;
75+
prepare(
76+
sql: string,
77+
callback?: (
78+
err: mysql.QueryError | null,
79+
statement: mysql.PrepareStatementInfo
80+
) => any
81+
): mysql.Prepare;
7682
serverHandshake(args: any): any;
7783
writeOk(args?: mysql.OkPacketParams): void;
7884
writeError(args?: mysql.ErrorPacketParams): void;
@@ -154,12 +160,19 @@ export interface Pool extends mysql.Connection {
154160
callback: (err: NodeJS.ErrnoException, connection: PoolConnection) => any
155161
): void;
156162
releaseConnection(connection: PoolConnection | PromisePoolConnection): void;
163+
on(event: string, listener: (args: any[]) => void): this;
157164
on(event: 'connection', listener: (connection: PoolConnection) => any): this;
158165
on(event: 'acquire', listener: (connection: PoolConnection) => any): this;
159166
on(event: 'release', listener: (connection: PoolConnection) => any): this;
160167
on(event: 'enqueue', listener: () => any): this;
161168
unprepare(sql: string): mysql.PrepareStatementInfo;
162-
prepare(sql: string, callback?: (err: mysql.QueryError | null, statement: mysql.PrepareStatementInfo) => any): mysql.Prepare;
169+
prepare(
170+
sql: string,
171+
callback?: (
172+
err: mysql.QueryError | null,
173+
statement: mysql.PrepareStatementInfo
174+
) => any
175+
): mysql.Prepare;
163176
promise(promiseImpl?: PromiseConstructor): PromisePool;
164177
config: mysql.PoolOptions;
165178
}
@@ -195,7 +208,14 @@ export interface ConnectionConfig extends ConnectionOptions {
195208
getDefaultFlags(options?: ConnectionOptions): string[];
196209
getCharsetNumber(charset: string): number;
197210
getSSLProfile(name: string): { ca: string[] };
198-
parseUrl(url: string): { host: string, port: number, database: string, user: string, password: string, [key: string]: any };
211+
parseUrl(url: string): {
212+
host: string;
213+
port: number;
214+
database: string;
215+
user: string;
216+
password: string;
217+
[key: string]: any;
218+
};
199219
}
200220

201221
export interface PoolOptions extends mysql.PoolOptions, ConnectionOptions {}

0 commit comments

Comments
 (0)