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

eslint.config.mjs

63 lines1.7 KB

1import js from '@eslint/js'
2import tsParser from '@typescript-eslint/parser'
3import tsPlugin from '@typescript-eslint/eslint-plugin'
4import reactPlugin from 'eslint-plugin-react'
5import prettierPlugin from 'eslint-plugin-prettier'
6import prettierConfig from 'eslint-config-prettier'
7import globals from 'globals'
8import { includeIgnoreFile } from '@eslint/compat'
9import { fileURLToPath } from 'url'
10​
11const gitignorePath = fileURLToPath(new URL('.gitignore', import.meta.url))
12​
13export default [
14 includeIgnoreFile(gitignorePath, 'Imported .gitignore patterns'),
15 {
16 files: ['src/**/*.{js,jsx,ts,tsx,mjs}'],
17 languageOptions: {
18 ecmaVersion: 2022,
19 sourceType: `module`,
20 parser: tsParser,
21 parserOptions: {
22 ecmaFeatures: {
23 jsx: true,
24 },
25 },
26 globals: {
27 ...globals.browser,
28 ...globals.es2021,
29 ...globals.node,
30 },
31 },
32 settings: {
33 react: {
34 version: `detect`,
35 },
36 },
37 plugins: {
38 '@typescript-eslint': tsPlugin,
39 react: reactPlugin,
40 prettier: prettierPlugin,
41 },
42 rules: {
43 ...js.configs.recommended.rules,
44 ...tsPlugin.configs.recommended.rules,
45 ...reactPlugin.configs.recommended.rules,
46 ...prettierConfig.rules,
47 'prettier/prettier': `error`,
48 'react/react-in-jsx-scope': `off`,
49 'react/jsx-uses-react': `off`,
50 'no-undef': `off`,
51 '@typescript-eslint/no-undef': 'off',
52 '@typescript-eslint/no-unused-vars': [
53 `error`,
54 {
55 argsIgnorePattern: `^_`,
56 varsIgnorePattern: `^_`,
57 destructuredArrayIgnorePattern: `^_`,
58 caughtErrorsIgnorePattern: `^_`,
59 },
60 ],
61 },
62 },