Skip to content

Commit 5296393

Browse files
author
Valentin Vasilyev
committed
More TS migration steps
1 parent 6f3f45f commit 5296393

File tree

8 files changed

+25
-21
lines changed

8 files changed

+25
-21
lines changed

.DS_Store

6 KB
Binary file not shown.

.github/workflows/node.js.yml

+2
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ jobs:
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727
- run: yarn
28+
- run: yarn lint
29+
- run: yarn build
2830
- run: yarn test

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Nice PG SQL toolkit
1+
Nice PG SQL toolkit
22
============================
33

44
🧰 Tiny SQL toolkit for PG + Node (<200 LOC)

jest.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
testEnvironment: "node",
3-
};
2+
testEnvironment: 'node',
3+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "nice-pg-sql-toolkit",
33
"version": "0.5.0",
4-
"description": "Nice PG SQL toolkit. Loves SQL. Not an ORM. Can do migrations",
4+
"description": "Nice PG SQL toolkit. Loves SQL. Not an ORM.",
55
"main": "dist/index.ts",
66
"types": "dist/index.d.ts",
77
"repository": "https://github.com/fingerprintjs/nice-pg-sql-toolkit",

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export const mapFromColumns = (row: Record<string, unknown>, map: Record<string,
170170
}, {})
171171
}
172172

173-
class UniqueIndexError extends Error {
173+
export class UniqueIndexError extends Error {
174174
readonly table: string
175175
readonly constraint: string
176176
readonly columns: string[]

tests/index.test.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
const {UniqueIndexError} = require("..//src/index");
1+
const { UniqueIndexError } = require('../dist/index')
22

3-
test("it parses single column constraint", () => {
3+
test('it parses single column constraint', () => {
44
let attrs = {
5-
table: "test_table",
6-
constraint: "test_constraint",
7-
detail: "Key (email)=([email protected]) already exists."
8-
};
5+
table: 'test_table',
6+
constraint: 'test_constraint',
7+
detail: 'Key (email)=([email protected]) already exists.',
8+
}
99
let err = new UniqueIndexError(attrs)
10-
expect(err.columns).toEqual(["email"]);
11-
});
10+
expect(err.columns).toEqual(['email'])
11+
})
1212

13-
test("it parses multiple column constraint", () => {
13+
test('it parses multiple column constraint', () => {
1414
let attrs = {
15-
table: "test_table",
16-
constraint: "test_constraint",
17-
detail: "Key (customer_id, display_name)=(customer1234, Corporation1) already exists."
18-
};
15+
table: 'test_table',
16+
constraint: 'test_constraint',
17+
detail: 'Key (customer_id, display_name)=(customer1234, Corporation1) already exists.',
18+
}
1919
let err = new UniqueIndexError(attrs)
20-
expect(err.columns).toEqual(["customer_id", "display_name"]);
21-
});
20+
expect(err.columns).toEqual(['customer_id', 'display_name'])
21+
})

tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"declaration": true,
88
"outDir": "./dist",
99
"noUnusedLocals": true,
10-
"noUnusedParameters": true
10+
"noUnusedParameters": true,
11+
"noImplicitAny": true,
12+
"noImplicitReturns": true
1113
},
1214
"include": ["./src/**/*"],
1315
"exclude": ["./node_modules", "./tests/**/*"]

0 commit comments

Comments
 (0)