-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
115 lines (105 loc) · 2.88 KB
/
Copy patheslint.config.mjs
File metadata and controls
115 lines (105 loc) · 2.88 KB
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
// @ts-check
import eslint from '@eslint/js';
import { defineConfig } from 'eslint/config';
import nextPlugin from '@next/eslint-plugin-next';
import prettier from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import reactPlugin from 'eslint-plugin-react';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import unusedImports from 'eslint-plugin-unused-imports';
import tseslint from 'typescript-eslint';
export default defineConfig(
{
ignores: [
'**/.next/**',
'**/out/**',
'**/dist/**',
'**/build/**',
'**/coverage/**',
'*.config.{js,mjs,cjs,ts}',
'*.mjs',
'*.cjs',
'**/svgr.d.ts',
'**/.storybook/**',
'**/.husky/**',
'**/.github/**',
'**/.vscode/**',
'**/.git/**',
],
},
eslint.configs.recommended,
tseslint.configs.recommended,
{
plugins: {
'unused-imports': unusedImports,
'simple-import-sort': simpleImportSort,
'jsx-a11y': jsxA11y,
import: importPlugin,
react: reactPlugin,
'@next/next': nextPlugin,
},
settings: { react: { version: 'detect' } },
rules: {
'prefer-arrow-callback': 'error',
'import/no-default-export': 'error',
'react/function-component-definition': [
'error',
{ namedComponents: 'arrow-function', unnamedComponents: 'arrow-function' },
],
'unused-imports/no-unused-imports': 'error',
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-vars': [
'warn',
{ vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' },
],
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', fixStyle: 'separate-type-imports' },
],
'simple-import-sort/imports': [
'warn',
{
groups: [
['^react', '^next'],
['^@?\\w'],
['^@/'],
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
['^.+\\.(css|scss|sass)$'],
],
},
],
'simple-import-sort/exports': 'warn',
...nextPlugin.configs['core-web-vitals'].rules,
},
},
{
files: [
'**/app/**/page.{ts,tsx}',
'**/app/**/layout.{ts,tsx}',
'**/app/**/loading.{ts,tsx}',
'**/app/**/error.{ts,tsx}',
'**/app/**/not-found.{ts,tsx}',
'**/app/**/template.{ts,tsx}',
'**/app/**/route.{ts,tsx}',
],
rules: {
'import/no-default-export': 'off',
'react/function-component-definition': 'off',
},
},
{
files: ['**/*.stories.{js,jsx,ts,tsx}'],
rules: {
'import/no-default-export': 'off',
},
},
{
files: ['**/*.{jsx,tsx}'],
rules: {
...jsxA11y.configs.recommended.rules,
},
},
prettier,
);