Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
at main 5.2 kB view raw
1module.exports = { 2 parser: '@typescript-eslint/parser', 3 parserOptions: { 4 ecmaVersion: 9, 5 sourceType: 'module', 6 ecmaFeatures: { 7 modules: true, 8 jsx: true, 9 }, 10 }, 11 12 ignorePatterns: [ 13 'node_modules/', 14 'dist/', 15 'dist-prod/', 16 'build/', 17 'coverage/', 18 'benchmark/', 19 'docs/', 20 ], 21 22 settings: { 23 react: { 24 version: 'detect', 25 }, 26 }, 27 28 extends: ['eslint:recommended', 'prettier'], 29 30 plugins: ['@typescript-eslint', 'prettier', 'es5'], 31 32 rules: { 33 'no-undef': 'off', 34 'no-empty': 'off', 35 'sort-keys': 'off', 36 'no-console': ['error', { allow: ['warn', 'error'] }], 37 'prefer-arrow/prefer-arrow-functions': 'off', 38 39 'es5/no-for-of': 'off', 40 'es5/no-generators': 'off', 41 'es5/no-typeof-symbol': 'warn', 42 43 'no-unused-vars': [ 44 'warn', 45 { 46 argsIgnorePattern: '^_', 47 }, 48 ], 49 50 'prettier/prettier': [ 51 'error', 52 { 53 singleQuote: true, 54 arrowParens: 'avoid', 55 trailingComma: 'es5', 56 }, 57 ], 58 }, 59 60 overrides: [ 61 { 62 extends: ['plugin:@typescript-eslint/recommended'], 63 files: ['*.ts', '*.tsx'], 64 rules: { 65 '@typescript-eslint/explicit-module-boundary-types': 'off', 66 '@typescript-eslint/no-use-before-define': 'off', 67 '@typescript-eslint/ban-types': 'off', 68 '@typescript-eslint/ban-ts-comment': 'off', 69 '@typescript-eslint/member-ordering': 'off', 70 '@typescript-eslint/explicit-member-accessibility': 'off', 71 '@typescript-eslint/no-object-literal-type-assertion': 'off', 72 '@typescript-eslint/explicit-function-return-type': 'off', 73 '@typescript-eslint/interface-name-prefix': 'off', 74 '@typescript-eslint/no-non-null-assertion': 'off', 75 '@typescript-eslint/no-misused-new': 'off', 76 '@typescript-eslint/no-explicit-any': 'off', 77 '@typescript-eslint/array-type': 'off', 78 'import/no-internal-modules': 'off', 79 80 'no-restricted-syntax': [ 81 'error', 82 { 83 selector: 'PropertyDefinition[value]', 84 message: 85 'Property definitions with value initializers aren’t transpiled', 86 }, 87 { 88 selector: 'MemberExpression[optional=true]', 89 message: 90 'Optional chaining (?.) operator is outside of specified browser support', 91 }, 92 { 93 selector: 'LogicalExpression[operator="??"]', 94 message: 95 'Nullish coalescing (??) operator is outside of specified browser support', 96 }, 97 { 98 selector: 'AssignmentExpression[operator="??="]', 99 message: 100 'Nullish coalescing assignment (??=) is outside of specified browser support', 101 }, 102 { 103 selector: 'SequenceExpression', 104 message: 105 'Sequence expressions are to be avoided since they can be confusing', 106 }, 107 { 108 selector: 109 ':not(ForStatement) > VariableDeclaration[declarations.length>1]', 110 message: 111 'Only one variable declarator per variable declaration is preferred', 112 }, 113 ], 114 115 '@typescript-eslint/no-import-type-side-effects': 'error', 116 '@typescript-eslint/consistent-type-imports': [ 117 'error', 118 { 119 disallowTypeAnnotations: false, 120 fixStyle: 'separate-type-imports', 121 }, 122 ], 123 124 '@typescript-eslint/no-unused-vars': [ 125 'error', 126 { 127 argsIgnorePattern: '^_', 128 }, 129 ], 130 }, 131 }, 132 133 { 134 extends: ['plugin:react/recommended'], 135 files: ['*.tsx'], 136 plugins: ['react-hooks'], 137 rules: { 138 'react-hooks/rules-of-hooks': 'error', 139 'react-hooks/exhaustive-deps': 'warn', 140 'react/react-in-jsx-scope': 'off', 141 'react/prop-types': 'off', 142 'react/no-children-prop': 'off', 143 }, 144 }, 145 146 { 147 files: ['*.test.ts', '*.test.tsx', '*.spec.ts', '*.spec.tsx'], 148 globals: { vi: true }, 149 rules: { 150 'no-restricted-syntax': 'off', 151 '@typescript-eslint/ban-ts-comment': 'off', 152 '@typescript-eslint/no-import-type-side-effects': 'off', 153 '@typescript-eslint/consistent-type-imports': 'off', 154 'react-hooks/rules-of-hooks': 'off', 155 'react-hooks/exhaustive-deps': 'off', 156 'es5/no-for-of': 'off', 157 'es5/no-generators': 'off', 158 'es5/no-typeof-symbol': 'off', 159 }, 160 }, 161 162 { 163 files: ['*.js'], 164 rules: { 165 '@typescript-eslint/no-var-requires': 'off', 166 'consistent-return': 'warn', 167 'no-magic-numbers': 'off', 168 'es5/no-es6-methods': 'off', 169 }, 170 }, 171 172 { 173 files: ['*.jsx'], 174 extends: ['plugin:react/recommended'], 175 rules: { 176 'consistent-return': 'warn', 177 'no-magic-numbers': 'off', 178 'react/jsx-key': 'off', 179 'react/jsx-handler-names': 'off', 180 'es5/no-es6-methods': 'off', 181 }, 182 }, 183 184 { 185 files: ['examples/**/*.jsx'], 186 rules: { 187 'react/prop-types': 'off', 188 }, 189 }, 190 ], 191};