Skip to content

Commit 85bd672

Browse files
committed
Added linter + prettier + compodoc tsconfig file
1 parent 8e6fc55 commit 85bd672

6 files changed

+134
-17
lines changed

.eslintrc.js

+79-13
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,91 @@
11
module.exports = {
2-
parser: '@typescript-eslint/parser',
2+
parser: "@typescript-eslint/parser",
33
parserOptions: {
4-
project: 'tsconfig.json',
4+
project: "tsconfig.json",
55
tsconfigRootDir: __dirname,
6-
sourceType: 'module',
6+
sourceType: "module",
77
},
8-
plugins: ['@typescript-eslint/eslint-plugin'],
9-
extends: [
10-
'plugin:@typescript-eslint/recommended',
11-
'plugin:prettier/recommended',
12-
],
8+
plugins: ["@typescript-eslint/eslint-plugin", "simple-import-sort"],
9+
extends: ["plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
1310
root: true,
1411
env: {
1512
node: true,
1613
jest: true,
1714
},
18-
ignorePatterns: ['.eslintrc.js'],
15+
ignorePatterns: [".eslintrc.js"],
1916
rules: {
20-
'@typescript-eslint/interface-name-prefix': 'off',
21-
'@typescript-eslint/explicit-function-return-type': 'off',
22-
'@typescript-eslint/explicit-module-boundary-types': 'off',
23-
'@typescript-eslint/no-explicit-any': 'off',
17+
"simple-import-sort/imports": "error",
18+
"simple-import-sort/exports": "error",
19+
20+
"@typescript-eslint/explicit-function-return-type": "off",
21+
"@typescript-eslint/explicit-module-boundary-types": "off",
22+
"@typescript-eslint/no-explicit-any": "error",
23+
24+
"no-multiple-empty-lines": ["error", { max: 3 }],
25+
/**
26+
* Array has several methods for filtering, mapping, and folding.
27+
* If we forget to write return statement in a callback of those,
28+
* it’s probably a mistake. If you don’t want to use a return or
29+
* don’t need the returned results, consider using `.forEach` instead.
30+
*/
31+
"array-callback-return": "warn",
32+
/**
33+
* Using a single import statement per module will make the code clearer
34+
* because you can see everything being imported from that module on one line.
35+
*/
36+
"no-duplicate-imports": "warn",
37+
/**
38+
* Comparing a variable against itself is usually an error, either a typo or
39+
* refactoring error. It is confusing to the reader and may potentially introduce
40+
* a runtime error. The only time you would compare a variable against itself is
41+
* when you are testing for NaN. However, it is far more appropriate to use
42+
* `typeof x === 'number' && isNaN(x)` or the `Number.isNaN ES2015` function
43+
* for that use case rather than leaving the reader of the code to determine the intent of self comparison.
44+
*/
45+
"no-self-compare": "warn",
46+
/**
47+
* ECMAScript 6 allows programmers to create strings containing variable or
48+
* expressions using template literals, instead of string concatenation,
49+
* by writing expressions like ${variable} between two backtick quotes (`).
50+
* It can be easy to use the wrong quotes when wanting to use template literals,
51+
* by writing "${variable}", and end up with the literal value "${variable}" instead
52+
* of a string containing the value of the injected expressions.
53+
*/
54+
"no-template-curly-in-string": "error",
55+
56+
/**
57+
* Private class members that are declared and not used anywhere in the code
58+
* are most likely an error due to incomplete refactoring. Such class members
59+
* take up space in the code and can lead to confusion by readers.
60+
*/
61+
"no-unused-private-class-members": "warn",
62+
63+
/**
64+
* JavaScript allows the omission of curly braces when a block contains
65+
* only one statement. However, it is considered by many to be best practice
66+
* to never omit curly braces around blocks, even when they are optional,
67+
* because it can lead to bugs and reduces code clarity.
68+
*/
69+
curly: ["warn", "all"],
70+
71+
/**
72+
* Disallow unnecessary computed property keys in objects and classes
73+
*/
74+
"no-useless-computed-key": "warn",
75+
76+
/**
77+
* When Object.assign is called using an object literal as the first argument,
78+
* this rule requires using the object spread syntax instead. This rule also
79+
* warns on cases where an Object.assign call is made using a single argument
80+
* that is an object literal, in this case, the Object.assign call is not needed.
81+
*/
82+
"prefer-object-spread": "warn",
83+
84+
/**
85+
* Anyone not yet in an ES6 environment would not want to apply this rule.
86+
* Others may find the terseness of the shorthand syntax harder to read
87+
* and may not want to encourage it with this rule.
88+
*/
89+
"object-shorthand": ["error", "never"],
2490
},
2591
};

.prettierrc

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
2-
"singleQuote": true,
3-
"trailingComma": "all"
4-
}
2+
"singleQuote": false,
3+
"trailingComma": "all",
4+
"printWidth": 89,
5+
"semi": true,
6+
"bracketSpacing": true,
7+
"arrowParens": "always"
8+
}

.shellcheckrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# For reading shit like .env files etc.
2+
external-sources=true

.swcrc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://json.schemastore.org/swcrc",
3+
"sourceMaps": true,
4+
"jsc": {
5+
"parser": {
6+
"syntax": "typescript",
7+
"decorators": true,
8+
"dynamicImport": true
9+
},
10+
"transform": {
11+
"legacyDecorator": true,
12+
"decoratorMetadata": true
13+
},
14+
"baseUrl": "./"
15+
},
16+
"minify": false
17+
}

compodoc.tsconfig.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"include": [
3+
"src/**/*"
4+
],
5+
"exclude": [
6+
"node_modules/",
7+
"src/migrations/*",
8+
"src/migrations/**/*",
9+
"docs/",
10+
"dist/",
11+
"coverage/",
12+
"**/*.spec.ts",
13+
"logs/",
14+
".husky/"
15+
]
16+
17+
}

tsconfig.json

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"ts-node": {
3+
"require": ["tsconfig-paths/register"]
4+
},
25
"compilerOptions": {
36
"module": "commonjs",
47
"declaration": true,
@@ -16,6 +19,14 @@
1619
"noImplicitAny": true,
1720
"strictBindCallApply": true,
1821
"forceConsistentCasingInFileNames": true,
19-
"noFallthroughCasesInSwitch": true
22+
"noFallthroughCasesInSwitch": true,
23+
"paths": {
24+
"@/*": ["src/*"],
25+
"@base/*": ["src/base/*"],
26+
"@config/*": ["src/config/*"],
27+
"@irancell/*": ["src/irancell/*"],
28+
"@contractor/*": ["src/sub-contractor/*"],
29+
"@fusion-plan/*": ["src/fusion-plan/*"]
30+
}
2031
}
2132
}

0 commit comments

Comments
 (0)