|
1 | 1 | module.exports = {
|
2 |
| - parser: '@typescript-eslint/parser', |
| 2 | + parser: "@typescript-eslint/parser", |
3 | 3 | parserOptions: {
|
4 |
| - project: 'tsconfig.json', |
| 4 | + project: "tsconfig.json", |
5 | 5 | tsconfigRootDir: __dirname,
|
6 |
| - sourceType: 'module', |
| 6 | + sourceType: "module", |
7 | 7 | },
|
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"], |
13 | 10 | root: true,
|
14 | 11 | env: {
|
15 | 12 | node: true,
|
16 | 13 | jest: true,
|
17 | 14 | },
|
18 |
| - ignorePatterns: ['.eslintrc.js'], |
| 15 | + ignorePatterns: [".eslintrc.js"], |
19 | 16 | 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"], |
24 | 90 | },
|
25 | 91 | };
|
0 commit comments