Open History to see the last commit
1// @ts-check
2β
3/** @type {import('eslint').Linter.Config} */
4const config = {
5 root: true,
6 reportUnusedDisableDirectives: true,
7 ignorePatterns: ['**/build', '**/coverage', '**/dist'],
8 parser: '@typescript-eslint/parser',
9 plugins: ['@typescript-eslint', 'import'],
10 extends: [
11 'eslint:recommended',
12 'plugin:@cspell/recommended',
13 'plugin:@typescript-eslint/recommended',
14 'plugin:@typescript-eslint/stylistic',
15 'plugin:import/recommended',
16 'plugin:import/typescript',
17 'prettier',
18 ],
19 env: {
20 browser: true,
21 es2020: true,
22 },
23 parserOptions: {
24 tsconfigRootDir: __dirname,
25 project: true,
26 sourceType: 'module',
27 ecmaVersion: 2020,
28 },
29 settings: {
30 'import/parsers': {
31 '@typescript-eslint/parser': ['.ts', '.tsx'],
32 },
33 'import/resolver': {
34 typescript: true,
35 },
36 react: {
37 version: 'detect',
38 },
39 },
40 rules: {
41 '@cspell/spellchecker': [
42 'error',
43 {
44 cspell: {
45 words: [
46 'tanstack', // Our package scope
47 'tsqd', // Our public interface (TanStack Query Devtools shorthand)
48 'retryer', // Our public interface
49 'Promisable', // Our public interface
50 'extralight', // Our public interface
51 'codemod', // We support our codemod
52 'typecheck', // Field of vite.config.ts
53 'TSES', // @typescript-eslint package's interface
54 'tsup', // We use tsup as builder
55 'solidjs', // Our target framework
56 'tabular-nums', // https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-numeric
57 'todos', // Too general word to be caught as error
58 'vue-demi', // dependency of @tanstack/vue-query
59 ],
60 },
61 },
62 ],
63 '@typescript-eslint/array-type': [
64 'error',
65 { default: 'generic', readonly: 'generic' },
66 ],
67 '@typescript-eslint/ban-types': 'off',
68 '@typescript-eslint/ban-ts-comment': 'off',
69 '@typescript-eslint/consistent-type-definitions': 'off',
70 '@typescript-eslint/consistent-type-imports': [
71 'error',
72 { prefer: 'type-imports' },
73 ],
74 '@typescript-eslint/explicit-module-boundary-types': 'off',
75 '@typescript-eslint/method-signature-style': ['error', 'property'],
76 '@typescript-eslint/naming-convention': [
77 'error',
78 {
79 selector: 'typeParameter',
80 format: ['PascalCase'],
81 leadingUnderscore: 'forbid',
82 trailingUnderscore: 'forbid',
83 custom: {
84 regex: '^(T|T[A-Z][A-Za-z]+)$',
85 match: true,
86 },
87 },
88 ],
89 '@typescript-eslint/no-empty-function': 'off',
90 '@typescript-eslint/no-empty-interface': 'off',
91 '@typescript-eslint/no-explicit-any': 'off',
92 '@typescript-eslint/no-non-null-assertion': 'off',
93 '@typescript-eslint/no-unnecessary-condition': 'error',
94 '@typescript-eslint/no-unnecessary-type-assertion': 'error',
95 '@typescript-eslint/no-unused-vars': 'off',
96 '@typescript-eslint/no-inferrable-types': [
97 'error',
98 { ignoreParameters: true },
99 ],
100 'import/default': 'off',
101 'import/export': 'off',
102 'import/namespace': 'off',
103 'import/newline-after-import': 'error',
104 'import/no-cycle': 'error',
105 'import/no-duplicates': 'off',
106 'import/no-named-as-default-member': 'off',
107 'import/no-unresolved': ['error', { ignore: ['^@tanstack/'] }],
108 'import/no-unused-modules': ['off', { unusedExports: true }],
109 'import/order': [
110 'error',
111 {
112 groups: [
113 'builtin',
114 'external',
115 'internal',
116 'parent',
117 'sibling',
118 'index',
119 'object',
120 'type',
121 ],
122 },
123 ],
124 'no-case-declarations': 'off',
125 'no-empty': 'off',
126 'no-prototype-builtins': 'off',
127 'no-redeclare': 'off',
128 'no-shadow': 'error',
129 'no-undef': 'off',
130 'sort-imports': ['error', { ignoreDeclarationSort: true }],
131 },
132 overrides: [
133 {
134 files: ['**/*.test.{ts,tsx}'],
135 rules: {
136 '@typescript-eslint/no-unnecessary-condition': 'off',
137 },
138 },
139 ],
140}
141β
142module.exports = config