-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
85 lines (84 loc) · 2.63 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
/* eslint-env node */
const sortImports = {
groups: [
// Side effect imports first i.e. import "some-polyfill";
['^\\u0000'],
// React, react-native, react prefixed imports, all other 3rd party imports
['^react$', '^react-native$', '^react', '^@?\\w'],
// Shared code imports
['^:.*'],
// Parent imports. Put `..` last.
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
// Other relative imports. Put same-folder imports and `.` last.
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
],
}
module.exports = {
root: true,
ignorePatterns: ['**/**/*.generated.ts', '**/**/generated.ts', '*.js'],
extends: [
'next',
'next/core-web-vitals',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:storybook/recommended',
],
plugins: ['no-relative-import-paths', 'formatjs', 'simple-import-sort'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
rules: {
eqeqeq: ['error', 'always'],
'formatjs/enforce-description': ['error', 'literal'],
'formatjs/no-offset': 'error',
'formatjs/enforce-default-message': ['error', 'literal'],
'@typescript-eslint/no-shadow': ['error', { ignoreOnInitialization: true }],
'@typescript-eslint/restrict-template-expressions': [
'error',
{ allowAny: true, allowNumber: true, allowBoolean: false, allowNullish: false },
],
'no-empty': ['error', { allowEmptyCatch: true }],
'react/jsx-sort-props': 'warn',
'react/no-unescaped-entities': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-namespace': 'off',
'no-relative-import-paths/no-relative-import-paths': ['error', { allowSameFolder: true }],
'react-hooks/exhaustive-deps': [
'warn',
{
additionalHooks: 'useLoadingCallback',
},
],
'simple-import-sort/imports': ['warn', sortImports],
'simple-import-sort/exports': 'warn',
'import/first': 'warn',
'import/newline-after-import': 'warn',
'import/no-duplicates': 'error',
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'lodash',
message: 'Please use lodash-es instead.',
},
{
name: 'react-use',
importNames: ['useEffectOnce'],
message: 'Please use the version of this hook defined in `@/hooks`',
},
],
},
],
'@typescript-eslint/no-floating-promises': 'error',
},
}