-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
103 lines (101 loc) · 2.75 KB
/
.eslintrc.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
const { resolve } = require('node:path')
const project = resolve(__dirname, 'tsconfig.json')
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
extends: [
require.resolve('@vercel/style-guide/eslint/browser'),
require.resolve('@vercel/style-guide/eslint/node'),
require.resolve('@vercel/style-guide/eslint/react'),
require.resolve('@vercel/style-guide/eslint/next'),
require.resolve('@vercel/style-guide/eslint/typescript'),
],
parserOptions: { project },
settings: {
'import/resolver': { typescript: { project } },
},
rules: {
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-confusing-void-expression': [
'error',
{ ignoreArrowShorthand: true },
],
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/no-misused-promises': [
'error',
{ checksVoidReturn: { attributes: false } },
],
'@typescript-eslint/restrict-template-expressions': [
'error',
{
allowAny: false,
allowBoolean: false,
allowNullish: false,
allowRegExp: false,
allowNever: false,
},
],
'react/function-component-definition': [
'warn',
{
namedComponents: 'arrow-function',
unnamedComponents: 'arrow-function',
},
],
'react/jsx-sort-props': [
'warn',
{
callbacksLast: true,
shorthandFirst: true,
multiline: 'last',
reservedFirst: true,
},
],
// sort import statements
'import/order': [
'warn',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
'newlines-between': 'always',
alphabetize: { order: 'asc' },
},
],
'import/no-default-export': 'off',
// sort named imports within an import statement
'sort-imports': ['warn', { ignoreDeclarationSort: true }],
// allow console.log, etc.
'no-console': 'off',
},
overrides: [
{
files: ['*.js', '*.jsx', '*.cjs', '*.mjs'],
extends: ['plugin:@typescript-eslint/disable-type-checked'],
},
// Varies file convention from libraries, e.g. Next.js App Router and Prettier
// Must use default export
{
files: [
'*.config.{mjs,ts}',
'src/app/**/{page,layout,not-found,*error,opengraph-image,apple-icon}.tsx',
'src/app/**/{sitemap,robots}.ts',
'src/components/emails/*.tsx',
],
rules: {
'import/no-default-export': 'off',
'import/prefer-default-export': ['error', { target: 'any' }],
},
},
// module declarations
{
files: ['**/*.d.ts'],
rules: { 'import/no-default-export': 'off' },
},
],
}