generated from poad/next-ts-minimal-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
74 lines (70 loc) · 2.04 KB
/
eslint.config.mjs
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
// @ts-check
import eslint from '@eslint/js';
import nextPlugin from '@next/eslint-plugin-next';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
import stylistic from '@stylistic/eslint-plugin';
import stylisticTs from '@stylistic/eslint-plugin-ts';
import stylisticJsx from '@stylistic/eslint-plugin-jsx';
import tseslint from 'typescript-eslint';
import { FlatCompat } from '@eslint/eslintrc';
const compat = new FlatCompat();
export default tseslint.config(
{
ignores: [
'**/*.d.ts',
'*.{js,jsx}',
'src/tsconfig.json',
'src/stories',
'**/*.css',
'node_modules/**/*',
'./.next/*',
'out',
],
},
eslint.configs.recommended,
...tseslint.configs.strict,
...tseslint.configs.stylistic,
{
files: ['src/**/*.{jsx,tsx}'],
plugins: {
'jsx-a11y': jsxA11yPlugin,
'@next/next': nextPlugin,
'@stylistic': stylistic,
'@stylistic/ts': stylisticTs,
'@stylistic/jsx': stylisticJsx,
},
extends: [
...compat.config(reactHooksPlugin.configs.recommended),
...compat.config(jsxA11yPlugin.configs.recommended),
],
settings: {
react: {
version: 'detect',
},
formComponents: ['Form'],
linkComponents: [
{ name: 'Link', linkAttribute: 'to' },
{ name: 'NavLink', linkAttribute: 'to' },
],
'import/resolver': {
typescript: {},
},
},
// @ts-expect-error ignore type errors
rules: {
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs['core-web-vitals'].rules,
'@next/next/no-duplicate-head': 'off',
'@next/next/no-img-element': 'error',
'@next/next/no-page-custom-font': 'off',
'@stylistic/semi': 'error',
'@stylistic/ts/indent': ['error', 2],
'@stylistic/jsx/jsx-indent': ['error', 2],
'comma-dangle': ['error', 'always-multiline'],
'arrow-parens': ['error', 'always'],
'semi': ['error', 'always'],
'quotes': ['error', 'single'],
},
},
);