Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

.eslintrc.cjs

96 lines2.5 KB

1// @ts-check
2​
3/** @type {import('eslint').Linter.Config} */
4const config = {
5 root: true,
6 parser: '@typescript-eslint/parser',
7 plugins: ['@typescript-eslint', 'import'],
8 extends: [
9 'plugin:@typescript-eslint/eslint-recommended',
10 'plugin:@typescript-eslint/recommended',
11 'plugin:import/recommended',
12 'plugin:import/typescript',
13 'prettier',
14 ],
15 env: {
16 browser: true,
17 es2020: true,
18 },
19 parserOptions: {
20 tsconfigRootDir: __dirname,
21 project: './tsconfig.json',
22 sourceType: 'module',
23 ecmaVersion: 2020,
24 },
25 settings: {
26 'import/parsers': {
27 '@typescript-eslint/parser': ['.ts', '.tsx'],
28 },
29 'import/resolver': {
30 typescript: true,
31 },
32 react: {
33 version: 'detect',
34 },
35 },
36 rules: {
37 '@typescript-eslint/array-type': [
38 'error',
39 { default: 'generic', readonly: 'generic' },
40 ],
41 '@typescript-eslint/ban-types': 'off',
42 '@typescript-eslint/ban-ts-comment': 'off',
43 '@typescript-eslint/consistent-type-imports': [
44 'error',
45 { prefer: 'type-imports' },
46 ],
47 '@typescript-eslint/explicit-module-boundary-types': 'off',
48 '@typescript-eslint/no-empty-interface': 'off',
49 '@typescript-eslint/no-explicit-any': 'off',
50 '@typescript-eslint/no-non-null-assertion': 'off',
51 '@typescript-eslint/no-unnecessary-condition': 'error',
52 '@typescript-eslint/no-unnecessary-type-assertion': 'error',
53 '@typescript-eslint/no-unused-vars': 'off',
54 '@typescript-eslint/no-inferrable-types': [
55 'error',
56 { ignoreParameters: true },
57 ],
58 'import/default': 'off',
59 'import/export': 'off',
60 'import/namespace': 'off',
61 'import/newline-after-import': 'error',
62 'import/no-cycle': 'error',
63 'import/no-duplicates': 'off',
64 'import/no-named-as-default-member': 'off',
65 'import/no-unresolved': ['error', { ignore: ['^@tanstack/'] }],
66 'import/no-unused-modules': ['off', { unusedExports: true }],
67 'import/order': [
68 'error',
69 {
70 groups: [
71 'builtin',
72 'external',
73 'internal',
74 'parent',
75 'sibling',
76 'index',
77 'object',
78 'type',
79 ],
80 },
81 ],
82 'no-redeclare': 'off',
83 'no-shadow': 'error',
84 'sort-imports': ['error', { ignoreDeclarationSort: true }],
85 },
86 overrides: [
87 {
88 files: ['**/*.test.{ts,tsx}'],
89 rules: {
90 '@typescript-eslint/no-unnecessary-condition': 'off',
91 },
92 },
93 ],
95​
96module.exports = config