|
| 1 | +parser: '@typescript-eslint/parser' |
| 2 | + |
| 3 | +parserOptions: |
| 4 | + ecmaFeatures: |
| 5 | + jsx: true |
| 6 | + ecmaVersion: latest |
| 7 | + sourceType: module |
| 8 | + project: ./tsconfig.json |
| 9 | + |
| 10 | +env: |
| 11 | + browser: true |
| 12 | + es6: true |
| 13 | + node: true |
| 14 | + jest: true |
| 15 | + |
| 16 | +plugins: |
| 17 | + - import |
| 18 | + - '@typescript-eslint' |
| 19 | + |
| 20 | +extends: |
| 21 | + - eslint:recommended |
| 22 | + - plugin:prettier/recommended |
| 23 | + |
| 24 | +rules: |
| 25 | + # 0 = off, 1 = warn, 2 = error |
| 26 | + 'space-before-function-paren': 0 |
| 27 | + 'no-useless-constructor': 0 |
| 28 | + 'no-undef': 2 |
| 29 | + 'no-console': [2, { allow: ['error', 'warn', 'info', 'assert'] }] |
| 30 | + 'comma-dangle': ['error', 'only-multiline'] |
| 31 | + 'no-unused-vars': 0 |
| 32 | + 'no-var': 2 |
| 33 | + 'one-var-declaration-per-line': 2 |
| 34 | + 'prefer-const': 2 |
| 35 | + 'no-const-assign': 2 |
| 36 | + 'no-duplicate-imports': 2 |
| 37 | + 'no-use-before-define': [2, { 'functions': false, 'classes': false }] |
| 38 | + 'eqeqeq': [2, 'always', { 'null': 'ignore' }] |
| 39 | + 'no-case-declarations': 0 |
| 40 | + 'no-restricted-syntax': |
| 41 | + [ |
| 42 | + 2, |
| 43 | + { |
| 44 | + 'selector': 'BinaryExpression[operator=/(==|===|!=|!==)/][left.raw=true], BinaryExpression[operator=/(==|===|!=|!==)/][right.raw=true]', |
| 45 | + 'message': Don't compare for equality against boolean literals, |
| 46 | + }, |
| 47 | + ] |
| 48 | + |
| 49 | + # https://github.com/benmosher/eslint-plugin-import/pull/334 |
| 50 | + 'import/no-duplicates': 2 |
| 51 | + 'import/first': 2 |
| 52 | + 'import/newline-after-import': 2 |
| 53 | + 'import/order': |
| 54 | + [ |
| 55 | + 2, |
| 56 | + { |
| 57 | + 'newlines-between': 'always', |
| 58 | + 'alphabetize': { 'order': 'asc' }, |
| 59 | + 'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'], |
| 60 | + }, |
| 61 | + ] |
| 62 | + |
| 63 | +overrides: |
| 64 | + - files: |
| 65 | + - ./**/*{.ts,.tsx} |
| 66 | + rules: |
| 67 | + 'no-unused-vars': [2, { varsIgnorePattern: '^_', argsIgnorePattern: '^_', ignoreRestSiblings: true }] |
| 68 | + 'no-undef': 0 |
| 69 | + # TypeScript declare merge |
| 70 | + 'no-redeclare': 0 |
| 71 | + 'no-useless-constructor': 0 |
| 72 | + 'no-dupe-class-members': 0 |
| 73 | + 'no-case-declarations': 0 |
| 74 | + 'no-duplicate-imports': 0 |
| 75 | + # TypeScript Interface and Type |
| 76 | + 'no-use-before-define': 0 |
| 77 | + |
| 78 | + '@typescript-eslint/adjacent-overload-signatures': 2 |
| 79 | + '@typescript-eslint/await-thenable': 2 |
| 80 | + '@typescript-eslint/consistent-type-assertions': 2 |
| 81 | + '@typescript-eslint/ban-types': |
| 82 | + [ |
| 83 | + 'error', |
| 84 | + { |
| 85 | + 'types': |
| 86 | + { |
| 87 | + 'String': { 'message': 'Use string instead', 'fixWith': 'string' }, |
| 88 | + 'Number': { 'message': 'Use number instead', 'fixWith': 'number' }, |
| 89 | + 'Boolean': { 'message': 'Use boolean instead', 'fixWith': 'boolean' }, |
| 90 | + 'Function': { 'message': 'Use explicit type instead' }, |
| 91 | + }, |
| 92 | + }, |
| 93 | + ] |
| 94 | + '@typescript-eslint/explicit-member-accessibility': |
| 95 | + [ |
| 96 | + 'error', |
| 97 | + { |
| 98 | + accessibility: 'explicit', |
| 99 | + overrides: |
| 100 | + { |
| 101 | + accessors: 'no-public', |
| 102 | + constructors: 'no-public', |
| 103 | + methods: 'no-public', |
| 104 | + properties: 'no-public', |
| 105 | + parameterProperties: 'explicit', |
| 106 | + }, |
| 107 | + }, |
| 108 | + ] |
| 109 | + '@typescript-eslint/method-signature-style': 2 |
| 110 | + '@typescript-eslint/no-floating-promises': 2 |
| 111 | + '@typescript-eslint/no-implied-eval': 2 |
| 112 | + '@typescript-eslint/no-for-in-array': 2 |
| 113 | + '@typescript-eslint/no-inferrable-types': 2 |
| 114 | + '@typescript-eslint/no-invalid-void-type': 2 |
| 115 | + '@typescript-eslint/no-misused-new': 2 |
| 116 | + '@typescript-eslint/no-misused-promises': 2 |
| 117 | + '@typescript-eslint/no-namespace': 2 |
| 118 | + '@typescript-eslint/no-non-null-asserted-optional-chain': 2 |
| 119 | + '@typescript-eslint/no-throw-literal': 2 |
| 120 | + '@typescript-eslint/no-unnecessary-boolean-literal-compare': 2 |
| 121 | + '@typescript-eslint/prefer-for-of': 2 |
| 122 | + '@typescript-eslint/prefer-nullish-coalescing': 2 |
| 123 | + '@typescript-eslint/switch-exhaustiveness-check': 2 |
| 124 | + '@typescript-eslint/prefer-optional-chain': 2 |
| 125 | + '@typescript-eslint/prefer-readonly': 2 |
| 126 | + '@typescript-eslint/prefer-string-starts-ends-with': 0 |
| 127 | + '@typescript-eslint/no-array-constructor': 2 |
| 128 | + '@typescript-eslint/require-await': 2 |
| 129 | + '@typescript-eslint/return-await': 2 |
| 130 | + '@typescript-eslint/ban-ts-comment': |
| 131 | + [2, { 'ts-expect-error': false, 'ts-ignore': true, 'ts-nocheck': true, 'ts-check': false }] |
| 132 | + '@typescript-eslint/naming-convention': |
| 133 | + [ |
| 134 | + 2, |
| 135 | + { |
| 136 | + selector: 'memberLike', |
| 137 | + format: ['camelCase', 'PascalCase'], |
| 138 | + modifiers: ['private'], |
| 139 | + leadingUnderscore: 'forbid', |
| 140 | + }, |
| 141 | + ] |
| 142 | + '@typescript-eslint/no-unused-vars': |
| 143 | + [2, { varsIgnorePattern: '^_', argsIgnorePattern: '^_', ignoreRestSiblings: true }] |
| 144 | + '@typescript-eslint/member-ordering': |
| 145 | + [ |
| 146 | + 2, |
| 147 | + { |
| 148 | + default: |
| 149 | + [ |
| 150 | + 'public-static-field', |
| 151 | + 'protected-static-field', |
| 152 | + 'private-static-field', |
| 153 | + 'public-static-method', |
| 154 | + 'protected-static-method', |
| 155 | + 'private-static-method', |
| 156 | + 'public-instance-field', |
| 157 | + 'protected-instance-field', |
| 158 | + 'private-instance-field', |
| 159 | + 'public-constructor', |
| 160 | + 'protected-constructor', |
| 161 | + 'private-constructor', |
| 162 | + 'public-instance-method', |
| 163 | + 'protected-instance-method', |
| 164 | + 'private-instance-method', |
| 165 | + ], |
| 166 | + }, |
| 167 | + ] |
0 commit comments