|
1 | 1 | module.exports = {
|
2 |
| - root: true, |
3 | 2 | env: {
|
4 | 3 | browser: false,
|
5 | 4 | es2020: true,
|
6 | 5 | jest: true,
|
7 | 6 | node: true,
|
8 | 7 | },
|
9 |
| - extends: [ 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended' ], |
| 8 | + ignorePatterns: ['coverage', 'lib', 'cdk.out', 'dist', 'node_modules'], |
| 9 | + extends: [ |
| 10 | + 'plugin:@typescript-eslint/recommended', |
| 11 | + 'plugin:prettier/recommended', |
| 12 | + ], |
10 | 13 | parser: '@typescript-eslint/parser',
|
11 |
| - plugins: ['@typescript-eslint'], |
| 14 | + plugins: ['@typescript-eslint', 'prettier'], |
12 | 15 | settings: {
|
13 | 16 | 'import/resolver': {
|
14 | 17 | node: {},
|
15 | 18 | typescript: {
|
16 |
| - project: './tsconfig.es.json', |
| 19 | + project: './tsconfig.json', |
17 | 20 | alwaysTryTypes: true,
|
18 | 21 | },
|
19 | 22 | },
|
20 | 23 | },
|
21 | 24 | rules: {
|
22 |
| - '@typescript-eslint/ban-ts-ignore': ['off'], |
23 |
| - '@typescript-eslint/camelcase': ['off'], |
24 |
| - '@typescript-eslint/explicit-function-return-type': [ 'error', { allowExpressions: true } ], |
25 |
| - '@typescript-eslint/explicit-member-accessibility': 'error', |
26 |
| - '@typescript-eslint/indent': [ 'error', 2, { SwitchCase: 1 } ], |
27 |
| - '@typescript-eslint/interface-name-prefix': ['off'], |
28 |
| - '@typescript-eslint/member-delimiter-style': [ 'error', { multiline: { delimiter: 'none' } } ], |
| 25 | + '@typescript-eslint/explicit-function-return-type': [ |
| 26 | + 'error', |
| 27 | + { allowExpressions: true }, |
| 28 | + ], // Enforce return type definitions for functions |
| 29 | + '@typescript-eslint/explicit-member-accessibility': 'error', // Enforce explicit accessibility modifiers on class properties and methods (public, private, protected) |
29 | 30 | '@typescript-eslint/member-ordering': [
|
| 31 | + // Standardize the order of class members |
30 | 32 | 'error',
|
31 | 33 | {
|
32 | 34 | default: {
|
33 | 35 | memberTypes: [
|
34 | 36 | 'signature',
|
35 |
| - 'public-field', // = ["public-static-field", "public-instance-field"] |
36 |
| - 'protected-field', // = ["protected-static-field", "protected-instance-field"] |
37 |
| - 'private-field', // = ["private-static-field", "private-instance-field"] |
| 37 | + 'public-field', |
| 38 | + 'protected-field', |
| 39 | + 'private-field', |
38 | 40 | 'constructor',
|
39 |
| - 'public-method', // = ["public-static-method", "public-instance-method"] |
40 |
| - 'protected-method', // = ["protected-static-method", "protected-instance-method"] |
41 |
| - 'private-method', // = ["private-static-method", "private-instance-method"] |
| 41 | + 'public-method', |
| 42 | + 'protected-method', |
| 43 | + 'private-method', |
42 | 44 | ],
|
43 | 45 | order: 'alphabetically',
|
44 | 46 | },
|
45 | 47 | },
|
46 | 48 | ],
|
47 |
| - '@typescript-eslint/no-explicit-any': 'error', |
48 |
| - '@typescript-eslint/no-inferrable-types': ['off'], |
49 |
| - '@typescript-eslint/no-unused-vars': [ 'error', { argsIgnorePattern: '^_' } ], |
50 |
| - '@typescript-eslint/no-use-before-define': ['off'], |
51 |
| - '@typescript-eslint/semi': [ 'error', 'always' ], |
52 |
| - 'array-bracket-spacing': [ 'error', 'always', { singleValue: false } ], |
53 |
| - 'arrow-body-style': [ 'error', 'as-needed' ], |
54 |
| - 'computed-property-spacing': [ 'error', 'never' ], |
55 |
| - 'func-style': [ 'warn', 'expression' ], |
56 |
| - indent: [ 'error', 2, { SwitchCase: 1 } ], |
57 |
| - 'keyword-spacing': 'error', |
58 |
| - 'newline-before-return': 2, |
59 |
| - 'no-console': 0, |
60 |
| - 'no-multi-spaces': [ 'error', { ignoreEOLComments: false } ], |
61 |
| - 'no-multiple-empty-lines': [ 'error', { max: 1, maxBOF: 0 } ], |
62 |
| - 'no-throw-literal': 'error', |
63 |
| - 'object-curly-spacing': [ 'error', 'always' ], |
64 |
| - 'prefer-arrow-callback': 'error', |
65 |
| - quotes: [ 'error', 'single', { allowTemplateLiterals: true } ], |
66 |
| - semi: [ 'error', 'always' ] |
67 |
| - } |
| 49 | + '@typescript-eslint/no-explicit-any': 'error', // Disallow usage of the any type |
| 50 | + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], // Disallow unused variables, except for variables starting with an underscore |
| 51 | + '@typescript-eslint/no-use-before-define': ['off'], // Check if this rule is needed |
| 52 | + 'no-unused-vars': 'off', // Disable eslint core rule, since it's replaced by @typescript-eslint/no-unused-vars |
| 53 | + // Rules from eslint core https://eslint.org/docs/latest/rules/ |
| 54 | + 'array-bracket-spacing': ['error', 'never'], // Disallow spaces inside of array brackets |
| 55 | + 'computed-property-spacing': ['error', 'never'], // Disallow spaces inside of computed properties |
| 56 | + 'func-style': ['warn', 'expression'], // Enforce function expressions instead of function declarations |
| 57 | + 'keyword-spacing': 'error', // Enforce spaces after keywords and before parenthesis, e.g. if (condition) instead of if(condition) |
| 58 | + 'padding-line-between-statements': [ |
| 59 | + // Require an empty line before return statements |
| 60 | + 'error', |
| 61 | + { blankLine: 'always', prev: '*', next: 'return' }, |
| 62 | + ], |
| 63 | + 'no-console': 0, // Allow console.log statements |
| 64 | + 'no-multi-spaces': ['error', { ignoreEOLComments: false }], // Disallow multiple spaces except for comments |
| 65 | + 'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }], // Enforce no empty line at the beginning & end of files and max 1 empty line between consecutive statements |
| 66 | + 'no-throw-literal': 'error', // Disallow throwing literals as exceptions, e.g. throw 'error' instead of throw new Error('error') |
| 67 | + 'object-curly-spacing': ['error', 'always'], // Enforce spaces inside of curly braces in objects |
| 68 | + 'prefer-arrow-callback': 'error', // Enforce arrow functions instead of anonymous functions for callbacks |
| 69 | + quotes: ['error', 'single', { allowTemplateLiterals: true }], // Enforce single quotes except for template strings |
| 70 | + semi: ['error', 'always'], // Require semicolons instead of ASI (automatic semicolon insertion) at the end of statements |
| 71 | + }, |
68 | 72 | };
|
0 commit comments