Skip to content
This repository was archived by the owner on Jan 23, 2022. It is now read-only.

Commit 22c6390

Browse files
committed
🎉 add custom eslint-config
1 parent ef0fe37 commit 22c6390

File tree

9 files changed

+60
-42
lines changed

9 files changed

+60
-42
lines changed

.eslintrc.json

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,20 @@
44
"es2021": true,
55
"node": true
66
},
7-
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier", "plugin:prettier/recommended"],
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/recommended",
10+
"prettier",
11+
"@casper124578/eslint-config",
12+
"plugin:prettier/recommended"
13+
],
814
"parser": "@typescript-eslint/parser",
915
"parserOptions": {
1016
"ecmaVersion": 12,
1117
"sourceType": "module"
1218
},
1319
"plugins": ["@typescript-eslint", "prettier"],
1420
"rules": {
15-
"quotes": ["error", "double"],
16-
"semi": ["error", "always"],
17-
"no-multi-spaces": ["error"],
18-
"eqeqeq": ["warn", "always"],
19-
"no-unused-vars": "off",
20-
"no-duplicate-case": ["error"],
21-
"no-extra-semi": ["error"],
22-
"no-unreachable": ["error"],
23-
"default-case": ["warn"],
24-
"default-case-last": ["error"],
25-
"no-useless-catch": ["warn"],
2621
"prettier/prettier": ["error"],
2722
"@typescript-eslint/no-explicit-any": "off",
2823
"@typescript-eslint/explicit-module-boundary-types": "off",

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.0.19
4+
5+
- Add [custom ESLint config](https://github.com/dev-caspertheghost/eslint-config)
6+
37
## 0.0.18
48

59
- Update docs

package-lock.json

Lines changed: 19 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@casper124578/mysql.ts",
3-
"version": "0.0.18",
3+
"version": "0.0.19",
44
"description": "A simple mysql wrapper for node.js",
55
"main": "dist/index.js",
66
"private": false,
@@ -9,6 +9,7 @@
99
"build:tsc": "tsc --noEmit",
1010
"test": "ts-node tests/index.test.ts",
1111
"lint": "eslint . --ext .ts,.tsx",
12+
"lint:fix": "eslint . --fix --ext .ts,.tsx",
1213
"format": "prettier --write \"**/*.{js,jsx,json,ts,tsx,yml,md}\" --ignore-path .gitignore"
1314
},
1415
"keywords": [
@@ -34,6 +35,7 @@
3435
"mysql": "^2.18.1"
3536
},
3637
"devDependencies": {
38+
"@casper124578/eslint-config": "^0.0.3",
3739
"@types/mysql": "^2.15.18",
3840
"@typescript-eslint/eslint-plugin": "^4.23.0",
3941
"@typescript-eslint/parser": "^4.23.0",

src/BuilderTypes.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
import { QueryValue, BuilderTypeOptions } from "./types";
22

33
/**
4-
* Defaults: `nullable = true`, `length = 255`
4+
* defaults: `nullable = true`, `length = 255`
55
*/
66
export function string({ nullable = true, length = 255, DEFAULT }: BuilderTypeOptions): string {
77
return `varchar(${length}) ${_returnNullable(nullable)} ${_returnDefault(DEFAULT)}`;
88
}
99

1010
/**
11-
* Defaults: `nullable = true`, `length = 8`
11+
* defaults: `nullable = true`, `length = 8`
1212
*/
1313
export function int({ nullable = true, length = 8, DEFAULT }: BuilderTypeOptions<number>): string {
1414
return `int(${length}) ${_returnNullable(nullable)} ${_returnDefault(DEFAULT)}`;
1515
}
1616

1717
/**
18-
* Defaults: `nullable = true`
18+
* defaults: `nullable = true`
1919
*/
2020
export function text({ nullable = true, DEFAULT }: Omit<BuilderTypeOptions, "length">): string {
2121
return `text ${_returnNullable(nullable)} ${_returnDefault(DEFAULT)}`;
2222
}
2323

2424
/**
25-
* Defaults: `nullable = true`
25+
* defaults: `nullable = true`
2626
*/
2727
export function date({ nullable = true, DEFAULT }: Omit<BuilderTypeOptions, "length">) {
2828
return `DATE ${_returnNullable(nullable)} ${_returnDefault(DEFAULT)}`;
2929
}
3030

3131
/**
32-
* Defaults: `nullable = true`, `DEFAULT = {}`
32+
* defaults: `nullable = true`, `DEFAULT = {}`
3333
*/
3434
export function json({ nullable = true, DEFAULT = {} }: Omit<BuilderTypeOptions<any>, "length">) {
3535
return `JSON ${_returnNullable(nullable)} ${_returnDefault(DEFAULT)}`;
3636
}
3737

3838
/**
39-
* Defaults: `nullable = true`
39+
* defaults: `nullable = true`
4040
*/
4141
export function timestamp({ nullable = true, DEFAULT }: Omit<BuilderTypeOptions, "length">) {
4242
return `TIMESTAMP ${_returnNullable(nullable)} ${_returnDefault(DEFAULT)}`;

src/Connection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class Connection<Tables> {
9494
const connection = mysql.createConnection(this.config);
9595

9696
return new Promise((resolve, reject) => {
97-
return connection.connect(async (err) => {
97+
connection.connect(async (err) => {
9898
if (err) {
9999
return reject(err);
100100
}

src/QueryBuilder.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class QueryBuilder<Tables, T = any> {
1919
}
2020

2121
/**
22-
* Select 1 or more items from a table
22+
* select 1 or more items from a table
2323
* @param {string|string[]} selector
2424
* @example
2525
*
@@ -48,7 +48,7 @@ export class QueryBuilder<Tables, T = any> {
4848
}
4949

5050
/**
51-
* Insert data into a table
51+
* insert data into a table
5252
* @param tableName The name of the table
5353
* @param data Data that needs to be inserted
5454
*/
@@ -64,7 +64,7 @@ export class QueryBuilder<Tables, T = any> {
6464
}
6565

6666
/**
67-
* Update data from a table
67+
* update data from a table
6868
* @param tableName The name of the table
6969
* @param data Data that needs to be updated
7070
*/
@@ -84,7 +84,7 @@ export class QueryBuilder<Tables, T = any> {
8484
}
8585

8686
/**
87-
* Delete something from the table
87+
* delete something from the table
8888
* @param selector The table name
8989
* @example
9090
* // delete an item with 'where'
@@ -140,7 +140,7 @@ export class QueryBuilder<Tables, T = any> {
140140
}
141141

142142
/**
143-
* Rename a table
143+
* rename a table
144144
* @param oldName The old table name you want to rename
145145
* @param newName The new name
146146
*/
@@ -151,7 +151,7 @@ export class QueryBuilder<Tables, T = any> {
151151
}
152152

153153
/**
154-
* Drop a database or a table
154+
* drop a database or a table
155155
* @param {string} name The table or database you want to drop
156156
* @param {"table"|"database"} type `table` or `database`
157157
* @param {boolean} ifExists Check if the table/database exists when dropping
@@ -170,7 +170,7 @@ export class QueryBuilder<Tables, T = any> {
170170
}
171171

172172
/**
173-
* Delete a column in a database table
173+
* delete a column in a database table
174174
* @param tableName The name of the table
175175
* @param columnName The name of the column you want to drop
176176
*/
@@ -187,7 +187,7 @@ export class QueryBuilder<Tables, T = any> {
187187
}
188188

189189
/**
190-
* Create a raw query
190+
* create a raw query
191191
* @param query The raw query
192192
* @param values Values that are needed for insert, update, ..
193193
* @example
@@ -206,7 +206,7 @@ export class QueryBuilder<Tables, T = any> {
206206
}
207207

208208
/**
209-
* Create a table
209+
* create a table
210210
* @param name The name of the table
211211
* @param primary The primary key
212212
* @param columns The columns that need to be inserted
@@ -230,7 +230,7 @@ export class QueryBuilder<Tables, T = any> {
230230
}
231231

232232
/**
233-
* Same as `QueryBuilder#createTable` but only create the table if it doesn't exist
233+
* same as `QueryBuilder#createTable` but only create the table if it doesn't exist
234234
* @see [https://github.com/Dev-CasperTheGhost/mysql.ts/blob/main/docs/Query.md#create-table](https://github.com/Dev-CasperTheGhost/mysql.ts/blob/main/docs/Query.md#create-table)
235235
*/
236236
createTableIfNotExists(name: string, primary: keyof T | undefined, columns: Partial<Record<keyof T, string>>) {
@@ -243,7 +243,7 @@ export class QueryBuilder<Tables, T = any> {
243243
}
244244

245245
/**
246-
* Add more columns to a table
246+
* add more columns to a table
247247
* @param name The name of the table
248248
* @param columns The columns to add
249249
* @example
@@ -267,7 +267,7 @@ export class QueryBuilder<Tables, T = any> {
267267
}
268268

269269
/**
270-
* Reset the query string and values
270+
* reset the query string and values
271271
*/
272272
resetQuery() {
273273
this.query = "";
@@ -277,7 +277,7 @@ export class QueryBuilder<Tables, T = any> {
277277
}
278278

279279
/**
280-
* Execute the query
280+
* execute the query
281281
*/
282282
async exec(options?: Omit<mysql.QueryOptions, "sql" | "values">): Promise<T[] | undefined> {
283283
if (this.config.debugExec === true) {

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ConnectionConfig } from "./types";
33
import { QueryBuilder } from "./QueryBuilder";
44

55
/**
6-
* Create the connection to the database
6+
* create the connection to the database
77
* @param {ConnectionConfig} config The connection config
88
* @see [https://github.com/mysqljs/mysql#connection-options](https://github.com/mysqljs/mysql#connection-options)
99
* @returns The connection

src/types.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ export interface ConnectionConfig extends MySQLConnectionConfig {
44
reconnect?: boolean;
55

66
/**
7-
* This will show the full query & values when a query is executed with the `QueryBuilder#exec` method
7+
* this will show the full query & values when a query is executed with the `QueryBuilder#exec` method
88
*/
99
debugExec?: boolean;
1010

1111
/**
12-
* When no results are found for a query:
12+
* when no results are found for a query:
1313
*
1414
* `false` = return `undefined`
1515
*
@@ -33,22 +33,22 @@ export interface StatisticsPacket {
3333

3434
export interface ChangeUserOptions {
3535
/**
36-
* The name of the new user (defaults to the previous one)
36+
* the name of the new user (defaults to the previous one)
3737
*/
3838
user?: string;
3939

4040
/**
41-
* The password of the new user (defaults to the previous one)
41+
* the password of the new user (defaults to the previous one)
4242
*/
4343
password?: string;
4444

4545
/**
46-
* The new charset (defaults to the previous one)
46+
* the new charset (defaults to the previous one)
4747
*/
4848
charset?: string;
4949

5050
/**
51-
* The new database (defaults to the previous one)
51+
* the new database (defaults to the previous one)
5252
*/
5353
database?: string;
5454
}

0 commit comments

Comments
 (0)