Skip to content

Commit 147b2c1

Browse files
chore: Configure eslint (#51)
* Configure eslint * Added .prettierrc file
1 parent 7694f75 commit 147b2c1

File tree

4 files changed

+1077
-15
lines changed

4 files changed

+1077
-15
lines changed

.eslintrc.js

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
module.exports = {
2+
"env": {
3+
"es2021": true,
4+
"node": true,
5+
"jest": true
6+
},
7+
"parser": "@typescript-eslint/parser",
8+
"plugins": [
9+
"@typescript-eslint",
10+
"prettier",
11+
"sonarjs",
12+
"no-secrets",
13+
"jsonc",
14+
"pii",
15+
"no-unsanitized"
16+
],
17+
"extends": [
18+
"google",
19+
"prettier",
20+
"plugin:sonarjs/recommended",
21+
"plugin:node/recommended",
22+
"plugin:jsonc/base",
23+
"plugin:pii/recommended",
24+
"plugin:no-unsanitized/DOM",
25+
"plugin:prettier/recommended",
26+
"plugin:@typescript-eslint/recommended"
27+
],
28+
"parserOptions": {
29+
"ecmaVersion": latest,
30+
"sourceType": "module"
31+
},
32+
"settings": {
33+
"import/resolver": {
34+
"typescript": {}
35+
}
36+
},
37+
"rules": {
38+
"semi": "error",
39+
"no-console": "warn",
40+
"no-tabs": "off",
41+
"indent": "off",
42+
"space-infix-ops": "off",
43+
"no-trailing-spaces": "error",
44+
"space-before-blocks": "error",
45+
"quotes": "off",
46+
"camelcase": "error",
47+
"node/no-unpublished-import": "off",
48+
"node/no-unsupported-features/es-syntax": "off",
49+
"node/no-missing-import": [
50+
"error",
51+
{
52+
"allowModules": [],
53+
"resolvePaths": ["/path/to/a/modules/directory"],
54+
"tryExtensions": [".js", ".ts", ".json", ".node"]
55+
}
56+
],
57+
"valid-jsdoc": "off",
58+
"node/handle-callback-err": "error",
59+
"node/no-path-concat": "error",
60+
"node/no-process-exit": "error",
61+
"node/global-require": "error",
62+
"node/no-sync": "error",
63+
"no-secrets/no-secrets": "error",
64+
"pii/no-email": "off",
65+
"no-invalid-this": "off",
66+
"spaced-comment": "off",
67+
"prefer-destructuring": ["error", { "object": true, "array": true }],
68+
"@typescript-eslint/no-explicit-any": "off",
69+
"no-unused-vars": "off",
70+
"@typescript-eslint/no-unused-vars": [
71+
"warn",
72+
{ "argsIgnorePattern": "req|res", "varsIgnorePattern": "prop" }
73+
],
74+
"@typescript-eslint/ban-types": [
75+
"error",
76+
{
77+
"types": {
78+
// un-ban a type that's banned by default
79+
"{}": false
80+
},
81+
"extendDefaults": true
82+
}
83+
],
84+
"linebreak-style": "off",
85+
"object-curly-spacing": "off",
86+
"comma-dangle": "off",
87+
"new-cap": "off",
88+
"require-await": "error",
89+
"require-jsdoc": "off",
90+
"sonarjs/cognitive-complexity": "off",
91+
"sonarjs/no-duplicate-string": "off",
92+
"sonarjs/no-identical-expressions": "off",
93+
"sonarjs/no-identical-functions": "off",
94+
"@typescript-eslint/quotes": ["error", "double"],
95+
"@typescript-eslint/explicit-function-return-type": "off",
96+
"prettier/prettier": [
97+
"error",
98+
{
99+
"endOfLine": "auto",
100+
"useTabs": true
101+
}
102+
]
103+
}
104+
}

.prettierrc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"semi": true,
3+
"printWidth": 100,
4+
"singleQuote": false,
5+
"trailingComma": "all",
6+
"jsxSingleQuote": false,
7+
"bracketSpacing": true,
8+
"tabWidth": 4,
9+
"useTabs": true,
10+
"endOfLine": "lf",
11+
"extends": ["plugin:react/recommended", "prettier"]
12+
}

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@
4747
"@types/jsonwebtoken": "8.5.9",
4848
"@types/passport": "1.0.11",
4949
"@types/passport-google-oauth20": "2.0.11",
50+
"@typescript-eslint/eslint-plugin": "^5.38.1",
51+
"@typescript-eslint/parser": "^5.38.1",
5052
"add": "2.0.6",
5153
"all-contributors-cli": "6.22.0",
54+
"eslint": "^8.24.0",
5255
"jest": "29.1.2",
5356
"ts-node": "10.9.1",
5457
"ts-node-dev": "2.0.0",

0 commit comments

Comments
 (0)