|
| 1 | +// Copyright Kani Contributors |
| 2 | +// SPDX-License-Identifier: Apache-2.0 OR MIT |
| 3 | +const tseslint = require('typescript-eslint'); |
| 4 | +const eslintPluginPrettier = require('eslint-plugin-prettier'); |
| 5 | +const eslintConfigLove = require('eslint-config-love').default || require('eslint-config-love'); |
| 6 | +const eslintConfigPrettier = require('eslint-config-prettier'); |
| 7 | +const eslintPluginHeader = require('eslint-plugin-header'); |
| 8 | +const eslintPluginNoNull = require('eslint-plugin-no-null'); |
| 9 | +const eslintPluginTsdoc = require('eslint-plugin-tsdoc'); |
| 10 | +const importPlugin = require('eslint-plugin-import'); |
| 11 | + |
| 12 | +module.exports = tseslint.config( |
| 13 | + { |
| 14 | + ignores: [ |
| 15 | + 'node_modules/**', |
| 16 | + '**/*.json', |
| 17 | + '**/*.gen.ts', |
| 18 | + 'dist/**', |
| 19 | + 'types/*.d.ts', |
| 20 | + 'out/**', |
| 21 | + '*.js', // Ignore all JS files at root level |
| 22 | + ], |
| 23 | + }, |
| 24 | + eslintConfigLove, |
| 25 | + eslintConfigPrettier, |
| 26 | + { |
| 27 | + files: ['**/*.ts', '**/*.tsx'], |
| 28 | + languageOptions: { |
| 29 | + parser: require('@typescript-eslint/parser'), |
| 30 | + parserOptions: { |
| 31 | + tsconfigRootDir: __dirname, |
| 32 | + }, |
| 33 | + }, |
| 34 | + plugins: { |
| 35 | + '@typescript-eslint': require('@typescript-eslint/eslint-plugin'), |
| 36 | + header: eslintPluginHeader, |
| 37 | + 'no-null': eslintPluginNoNull, |
| 38 | + tsdoc: eslintPluginTsdoc, |
| 39 | + prettier: eslintPluginPrettier, |
| 40 | + import: importPlugin, |
| 41 | + }, |
| 42 | + rules: { |
| 43 | + curly: 2, |
| 44 | + 'tsdoc/syntax': 'warn', |
| 45 | + 'no-async-promise-executor': 'off', |
| 46 | + '@typescript-eslint/no-misused-promises': 'off', |
| 47 | + '@typescript-eslint/typedef': 'warn', |
| 48 | + '@typescript-eslint/prefer-regexp-exec': 'off', |
| 49 | + '@typescript-eslint/consistent-type-assertions': 'off', |
| 50 | + '@typescript-eslint/ban-ts-ignore': 'off', |
| 51 | + '@typescript-eslint/class-name-casing': 'off', |
| 52 | + '@typescript-eslint/no-inferrable-types': 'off', |
| 53 | + '@typescript-eslint/no-unnecessary-type-assertion': 'off', |
| 54 | + '@typescript-eslint/no-use-before-define': 'off', |
| 55 | + '@typescript-eslint/camelcase': 'off', |
| 56 | + 'no-useless-escape': 'off', |
| 57 | + '@typescript-eslint/require-await': 'off', |
| 58 | + '@typescript-eslint/no-non-null-assertion': 'off', |
| 59 | + '@typescript-eslint/no-explicit-any': 'off', |
| 60 | + '@typescript-eslint/no-unsafe-argument': 'off', |
| 61 | + '@typescript-eslint/explicit-function-return-type': 'warn', |
| 62 | + '@typescript-eslint/no-namespace': 'off', |
| 63 | + 'no-inner-declarations': 'off', |
| 64 | + 'no-extra-semi': 'off', |
| 65 | + 'no-null/no-null': 'error', |
| 66 | + '@typescript-eslint/no-empty-function': 'off', |
| 67 | + '@typescript-eslint/no-unused-vars': 'off', |
| 68 | + '@typescript-eslint/no-var-requires': 'off', |
| 69 | + '@typescript-eslint/no-unsafe-member-access': 'off', |
| 70 | + '@typescript-eslint/no-unsafe-assignment': 'off', |
| 71 | + '@typescript-eslint/no-unsafe-return': 'off', |
| 72 | + '@typescript-eslint/no-unsafe-call': 'off', |
| 73 | + '@typescript-eslint/restrict-template-expressions': 'off', |
| 74 | + '@typescript-eslint/no-floating-promises': 'off', |
| 75 | + '@typescript-eslint/ban-ts-comment': 'off', |
| 76 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 77 | + 'no-constant-condition': ['error', { checkLoops: false }], |
| 78 | + 'no-empty': 'off', |
| 79 | + // Additional overrides for eslint-config-love compatibility |
| 80 | + '@typescript-eslint/naming-convention': 'off', |
| 81 | + '@typescript-eslint/strict-boolean-expressions': 'off', |
| 82 | + '@typescript-eslint/consistent-type-imports': 'off', |
| 83 | + '@typescript-eslint/array-type': 'off', |
| 84 | + '@typescript-eslint/no-base-to-string': 'off', |
| 85 | + '@typescript-eslint/promise-function-async': 'off', |
| 86 | + '@typescript-eslint/prefer-promise-reject-errors': 'off', |
| 87 | + '@typescript-eslint/return-await': 'off', |
| 88 | + '@typescript-eslint/prefer-optional-chain': 'off', |
| 89 | + '@typescript-eslint/lines-between-class-members': 'off', |
| 90 | + '@typescript-eslint/no-confusing-void-expression': 'off', |
| 91 | + eqeqeq: 'off', |
| 92 | + 'object-shorthand': 'off', |
| 93 | + 'no-useless-return': 'off', |
| 94 | + 'no-template-curly-in-string': 'off', |
| 95 | + '@typescript-eslint/prefer-nullish-coalescing': 'off', |
| 96 | + '@typescript-eslint/prefer-readonly': 'off', |
| 97 | + '@typescript-eslint/method-signature-style': 'off', |
| 98 | + // Additional overrides for new rules in [email protected] |
| 99 | + '@typescript-eslint/no-magic-numbers': 'off', |
| 100 | + '@typescript-eslint/max-params': 'off', |
| 101 | + '@typescript-eslint/no-unnecessary-template-expression': 'off', |
| 102 | + '@typescript-eslint/no-unnecessary-condition': 'off', |
| 103 | + '@typescript-eslint/prefer-for-of': 'off', |
| 104 | + '@typescript-eslint/prefer-destructuring': 'off', |
| 105 | + '@typescript-eslint/init-declarations': 'off', |
| 106 | + 'no-plusplus': 'off', |
| 107 | + 'no-param-reassign': 'off', |
| 108 | + radix: 'off', |
| 109 | + 'no-await-in-loop': 'off', |
| 110 | + 'logical-assignment-operators': 'off', |
| 111 | + 'no-console': 'off', |
| 112 | + 'no-useless-assignment': 'off', |
| 113 | + 'import/enforce-node-protocol-usage': 'off', |
| 114 | + 'prefer-named-capture-group': 'off', |
| 115 | + 'promise/avoid-new': 'off', |
| 116 | + complexity: 'off', |
| 117 | + 'arrow-body-style': 'off', |
| 118 | + 'max-depth': 'off', |
| 119 | + '@typescript-eslint/no-require-imports': 'off', |
| 120 | + 'eslint-comments/require-description': 'off', |
| 121 | + '@typescript-eslint/no-unsafe-type-assertion': 'off', |
| 122 | + 'no-negated-condition': 'off', |
| 123 | + '@typescript-eslint/class-methods-use-this': 'off', |
| 124 | + 'max-lines': 'off', |
| 125 | + 'guard-for-in': 'off', |
| 126 | + 'sort-imports': [ |
| 127 | + 'error', |
| 128 | + { |
| 129 | + ignoreCase: false, |
| 130 | + ignoreDeclarationSort: true, |
| 131 | + ignoreMemberSort: false, |
| 132 | + memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], |
| 133 | + allowSeparatedGroups: true, |
| 134 | + }, |
| 135 | + ], |
| 136 | + 'import/no-unresolved': 'off', |
| 137 | + 'import/order': [ |
| 138 | + 'error', |
| 139 | + { |
| 140 | + groups: [ |
| 141 | + 'builtin', |
| 142 | + 'external', |
| 143 | + 'internal', |
| 144 | + ['sibling', 'parent'], |
| 145 | + 'index', |
| 146 | + 'unknown', |
| 147 | + ], |
| 148 | + 'newlines-between': 'always', |
| 149 | + alphabetize: { |
| 150 | + order: 'asc', |
| 151 | + caseInsensitive: true, |
| 152 | + }, |
| 153 | + }, |
| 154 | + ], |
| 155 | + }, |
| 156 | + settings: { |
| 157 | + 'import/resolver': { |
| 158 | + typescript: { |
| 159 | + project: './tsconfig.json', |
| 160 | + }, |
| 161 | + }, |
| 162 | + }, |
| 163 | + } |
| 164 | +); |
0 commit comments