-
Notifications
You must be signed in to change notification settings - Fork 10
/
.eslintrc.cjs
101 lines (101 loc) · 4.16 KB
/
.eslintrc.cjs
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
module.exports = {
extends: ['@deriv-com/eslint-config-deriv', 'eslint:recommended', 'plugin:react/recommended'],
plugins: ['simple-import-sort', 'sort-destructure-keys', 'typescript-sort-keys'],
rules: {
'global-require': 'off',
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/sort-type-constituents': 'error',
camelcase: 'error',
'import/newline-after-import': 'error',
'react/jsx-sort-props': 'error',
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': [
'error',
{
groups: [
[
'public-path',
// `react` first, then packages starting with a character
'^react$',
'^[a-z]',
// Packages starting with `@`
'^@',
// Imports starting with `../`
'^\\.\\.(?!/?$)',
'^\\.\\./?$',
// Imports starting with `./`
'^\\./(?=.*/)(?!/?$)',
'^\\.(?!/?$)',
'^\\./?$',
// Style imports
'^.+\\.s?css$',
// Side effect imports
'^\\u0000',
// Delete the empty line copied as the next line of the last import
'\\s*',
],
],
},
],
'sort-destructure-keys/sort-destructure-keys': 'error',
'sort-keys': 'error',
'typescript-sort-keys/interface': 'error',
'typescript-sort-keys/string-enum': 'error',
},
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/jsx-uses-react': 'off',
},
},
{
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
excludedFiles: '**/integration-tests/**/*.[jt]s?(x)',
extends: ['plugin:testing-library/react'],
},
{
files: ['*.{ts,tsx}'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'plugin:react/jsx-runtime',
],
parserOptions: {
ecmaversion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
babelOptions: {
presets: ['@babel/preset-react', '@babel/preset-typescript'],
plugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],
['@babel/plugin-proposal-class-properties', { loose: true }],
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-export-namespace-from',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-nullish-coalescing-operator',
],
},
},
},
{
files: ['**/hooks/api/**/*.{js,jsx,ts,tsx}'],
rules: {
camelcase: 'off', // Disable camelcase rule for files under 'hooks/api' folder
},
},
],
};