Skip to content

Commit 5ea5fde

Browse files
committed
add lint and prettier
1 parent 99046fb commit 5ea5fde

File tree

6 files changed

+104
-41
lines changed

6 files changed

+104
-41
lines changed

.eslintrc

Lines changed: 0 additions & 38 deletions
This file was deleted.

.eslintrc.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
module.exports = {
2+
"root": true,
3+
"env": {
4+
"mocha": true,
5+
"node": true,
6+
"es6": true
7+
},
8+
"parser": "@typescript-eslint/parser",
9+
"plugins": [
10+
"@typescript-eslint",
11+
"prettier"
12+
],
13+
"extends": [
14+
"eslint:recommended",
15+
"plugin:@typescript-eslint/eslint-recommended",
16+
"plugin:@typescript-eslint/recommended",
17+
"prettier"
18+
],
19+
"rules": {
20+
"@typescript-eslint/no-require-imports": "error",
21+
"@typescript-eslint/no-unused-vars": ["error", {
22+
"varsIgnorePattern": "^_"
23+
}],
24+
"@typescript-eslint/explicit-function-return-type": ["error", {
25+
"allowExpressions": true
26+
}],
27+
"@typescript-eslint/ban-ts-comment": "error",
28+
"@typescript-eslint/no-explicit-any": "error",
29+
"@typescript-eslint/explicit-module-boundary-types": "error",
30+
"@typescript-eslint/no-use-before-define": "off",
31+
"prefer-const": "error",
32+
"no-consecutive-blank-lines": 0,
33+
"no-console": "error",
34+
"@typescript-eslint/naming-convention": ["error",
35+
{selector: "default", format: ['camelCase']},
36+
{
37+
selector: [
38+
"classProperty", "parameterProperty", "objectLiteralProperty",
39+
"classMethod", "parameter"
40+
],
41+
format: ['camelCase'], leadingUnderscore: "allow"
42+
},
43+
//variable must be in camel or upper case
44+
{selector: "variable", format: ["camelCase", "UPPER_CASE"], leadingUnderscore: "allow"},
45+
//classes and types must be in PascalCase
46+
{selector: ["typeLike", "enum"], format: ['PascalCase']},
47+
{selector: "enumMember", format: null},
48+
{selector: "typeProperty", format: ['PascalCase', 'camelCase']},
49+
//ignore rules on destructured params
50+
{
51+
selector: "variable",
52+
modifiers: ["destructured"],
53+
format: null
54+
}
55+
],
56+
}
57+
}

.prettierc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"printWidth": 120,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"quoteProps": "as-needed",
8+
"trailingComma": "es5",
9+
"bracketSpacing": true,
10+
"arrowParens": "always"
11+
}

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@
4141
"dependencies": {
4242
"@nodefactory/winston": "^3.2.1",
4343
"fastify": "^3.10.1",
44-
"fastify-env": "^2.1.0",
4544
"fastify-compress": "^3.4.1",
4645
"fastify-cors": "^5.1.0",
46+
"fastify-env": "^2.1.0",
4747
"fastify-formbody": "^5.0.0",
48+
"fastify-healthcheck": "^3.0.0",
4849
"fastify-helmet": "^5.1.0",
50+
"fastify-metrics": "^6.0.3",
4951
"fastify-rate-limit": "^5.0.1",
5052
"fastify-sensible": "^3.1.0",
5153
"fastify-swagger": "^3.5.0",
52-
"fastify-metrics": "^6.0.3",
53-
"fastify-healthcheck": "^3.0.0",
5454
"node-cleanup": "^2.1.2",
5555
"pg": "^8.5.1",
5656
"pg-native": "^3.0.0",
@@ -74,9 +74,12 @@
7474
"dotenv": "^8.2.0",
7575
"env-prompt": "^1.2.3",
7676
"eslint": "^7.18.0",
77+
"eslint-config-prettier": "^7.2.0",
78+
"eslint-plugin-prettier": "^3.3.1",
7779
"mocha": "^8.2.1",
7880
"nodemon": "^2.0.7",
7981
"nyc": "^15.1.0",
82+
"prettier": "^2.2.1",
8083
"sinon": "^9.2.3",
8184
"supertest": "^6.1.1",
8285
"tasksfile": "5.1.1",

src/config/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/naming-convention */
12
import { fasitfyEnvOpt } from "fastify-env";
23

34
export const config: fasitfyEnvOpt = {

yarn.lock

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,6 +1603,18 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
16031603
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
16041604
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
16051605

1606+
eslint-config-prettier@^7.2.0:
1607+
version "7.2.0"
1608+
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-7.2.0.tgz#f4a4bd2832e810e8cc7c1411ec85b3e85c0c53f9"
1609+
integrity sha512-rV4Qu0C3nfJKPOAhFujFxB7RMP+URFyQqqOZW9DMRD7ZDTFyjaIlETU3xzHELt++4ugC0+Jm084HQYkkJe+Ivg==
1610+
1611+
eslint-plugin-prettier@^3.3.1:
1612+
version "3.3.1"
1613+
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.1.tgz#7079cfa2497078905011e6f82e8dd8453d1371b7"
1614+
integrity sha512-Rq3jkcFY8RYeQLgk2cCwuc0P7SEFwDravPhsJZOQ5N4YI4DSg50NyqJ/9gdZHzQlHf8MvafSesbNJCcP/FF6pQ==
1615+
dependencies:
1616+
prettier-linter-helpers "^1.0.0"
1617+
16061618
eslint-scope@^4.0.0:
16071619
version "4.0.3"
16081620
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848"
@@ -1794,6 +1806,11 @@ fast-deep-equal@^3.1.1:
17941806
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4"
17951807
integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==
17961808

1809+
fast-diff@^1.1.2:
1810+
version "1.2.0"
1811+
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
1812+
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==
1813+
17971814
fast-glob@^3.1.1:
17981815
version "3.2.5"
17991816
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.5.tgz#7939af2a656de79a4f1901903ee8adcaa7cb9661"
@@ -3680,6 +3697,18 @@ prepend-http@^2.0.0:
36803697
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
36813698
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=
36823699

3700+
prettier-linter-helpers@^1.0.0:
3701+
version "1.0.0"
3702+
resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
3703+
integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==
3704+
dependencies:
3705+
fast-diff "^1.1.2"
3706+
3707+
prettier@^2.2.1:
3708+
version "2.2.1"
3709+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
3710+
integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==
3711+
36833712
process-nextick-args@~2.0.0:
36843713
version "2.0.1"
36853714
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"

0 commit comments

Comments
 (0)