summaryrefslogtreecommitdiff
path: root/eslint.config.js
blob: 3821c14d6dec6ad51860473c4ff70154790f44c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// eslint.config.js
import tseslint from 'typescript-eslint';
import prettierPlugin from 'eslint-plugin-prettier';

export default tseslint.config({
  ignores: ['dist/', 'node_modules/', '*.js', '*.d.ts'],

  extends: [
    tseslint.configs.recommended,
    tseslint.configs.recommendedTypeChecked,
    {
      files: ['**/*.ts', '**/*.tsx'],
      languageOptions: {
        parser: tseslint.parser,
        parserOptions: {
          ecmaVersion: 2022,
          sourceType: 'module',
          project: './tsconfig.json',
        },
      },
      plugins: {
        prettier: prettierPlugin,
      },
      rules: {
        '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
        '@typescript-eslint/no-explicit-any': 'warn',
        '@typescript-eslint/explicit-function-return-type': 'off',
        '@typescript-eslint/explicit-module-boundary-types': 'off',
        '@typescript-eslint/no-non-null-assertion': 'warn',
        '@typescript-eslint/prefer-nullish-coalescing': 'error',
        '@typescript-eslint/prefer-optional-chain': 'error',
        '@typescript-eslint/no-floating-promises': 'error',
        'no-console': 'warn',
        'prefer-const': 'error',
        'prettier/prettier': 'error',
      },
    },
  ],

  languageOptions: {
    ecmaVersion: 2022,
    sourceType: 'module',
  },

  linterOptions: {
    reportUnusedDisableDirectives: true,
  },
});