-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
125 lines (124 loc) · 3.25 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
const path = require('path');
/**
* @type {import("eslint").Linter.Config}
*/
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:import/recommended',
'plugin:prettier/recommended',
'prettier/react',
],
plugins: ['unicorn'],
rules: {
'no-use-before-define': ['error', { functions: false, classes: false }],
'no-unused-vars': 'off',
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
},
],
'import/newline-after-import': 'error',
'import/no-cycle': 'error',
'import/dynamic-import-chunkname': 'error',
'import/no-unresolved': 'off',
'unicorn/better-regex': 'error',
'unicorn/error-message': 'error',
'unicorn/explicit-length-check': 'error',
'unicorn/import-index': 'error',
'unicorn/no-abusive-eslint-disable': 'error',
'unicorn/no-array-instanceof': 'error',
'unicorn/no-console-spaces': 'warn',
'unicorn/no-for-loop': 'error',
'unicorn/no-unsafe-regex': 'error',
'unicorn/number-literal-case': 'error',
'unicorn/prefer-dataset': 'error',
'unicorn/prefer-includes': 'error',
'unicorn/prefer-negative-index': 'error',
'unicorn/prefer-number-properties': 'error',
'react/prop-types': 'off',
'react/display-name': 'off',
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
webpack: {
config: {
resolve: {
modules: [path.resolve(__dirname, './src'), 'node_modules'],
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
},
},
},
},
overrides: [
// Typescript
{
files: ['*.{ts,tsx}'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
'prettier/@typescript-eslint',
],
rules: {
'@typescript-eslint/no-use-before-define': [
'error',
{ functions: false, classes: false },
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'none',
ignoreRestSiblings: true,
},
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
},
],
},
},
// NodeJS files
{
files: ['./*.js', 'jest/*.js', 'gatsby/*.js'],
excludedFiles: ['./gatsby-browser.js'],
env: {
browser: false,
},
},
// Unit tests (Jest)
{
files: ['src/**/*.test.{ts,js,tsx,jsx}', 'jest/**/*'],
env: {
jest: true,
},
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
},
],
};