-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
115 lines (97 loc) · 3.02 KB
/
eslint.config.js
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import path from 'path';
import { fileURLToPath } from 'url';
import comments from '@eslint-community/eslint-plugin-eslint-comments/configs';
import { fixupConfigRules } from '@eslint/compat';
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import jsdoc from 'eslint-plugin-jsdoc';
import * as regexpPlugin from 'eslint-plugin-regexp';
import pluginSecurity from 'eslint-plugin-security';
import tseslint from 'typescript-eslint';
import globals from 'globals';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
resolvePluginsRelativeTo: __dirname,
});
export default tseslint.config(
{
ignores: ['.next'],
},
// Base configurations
js.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
// Next.js / React
...fixupConfigRules(compat.extends('plugin:@next/next/recommended')),
...fixupConfigRules(compat.extends('plugin:react/recommended')),
...fixupConfigRules(compat.extends('plugin:react-hooks/recommended')),
...fixupConfigRules(compat.extends('plugin:jsx-a11y/strict')),
// Tailwind CSS
...fixupConfigRules(compat.extends('plugin:tailwindcss/recommended')),
// Other plugins
comments.recommended,
regexpPlugin.configs['flat/recommended'],
pluginSecurity.configs.recommended,
eslintConfigPrettier,
// JSDoc plugin only for TypeScript files
{
files: ['**/*.{ts,tsx}'],
extends: [jsdoc.configs['flat/recommended-typescript-error']],
},
// Settings and rule overrides
{
linterOptions: {
reportUnusedDisableDirectives: true,
},
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname,
},
globals: {
...globals.node,
...globals.browser,
...globals.es2024,
},
},
settings: {
react: {
version: 'detect',
},
tailwindcss: {
callees: ['classnames', 'clsx', 'ctl', 'cn', 'cva'],
},
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/consistent-type-imports': [
'warn',
{ prefer: 'type-imports', fixStyle: 'separate-type-imports' },
],
'@typescript-eslint/no-misused-promises': [
'error',
{ checksVoidReturn: { attributes: false } },
],
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
'@typescript-eslint/no-unnecessary-condition': [
'error',
{
allowConstantLoopConditions: true,
},
],
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
// security
'security/detect-non-literal-fs-filename': 'off',
// we're not building a library here
'jsdoc/require-jsdoc': 'off',
},
},
);