-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
.eslintrc.js
105 lines (103 loc) · 2.86 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
const fs = require('fs');
const packages = fs
.readdirSync(`${__dirname}/packages`, { withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name);
module.exports = {
parser: 'babel-eslint',
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:cypress/recommended',
'prettier',
'plugin:import/recommended',
],
env: {
es6: true,
browser: true,
node: true,
jest: true,
'cypress/globals': true,
},
globals: {
DECAP_CMS_VERSION: false,
DECAP_CMS_APP_VERSION: false,
DECAP_CMS_CORE_VERSION: false,
CMS_ENV: false,
},
rules: {
'no-console': [0],
'react/prop-types': [0],
'import/no-named-as-default': 0,
'import/order': [
'error',
{
'newlines-between': 'always',
groups: [['builtin', 'external'], ['internal', 'parent', 'sibling', 'index'], ['type']],
},
],
'no-duplicate-imports': 'error',
'@emotion/no-vanilla': 'error',
'@emotion/pkg-renaming': 'error',
'@emotion/import-from-emotion': 'error',
'@emotion/styled-import': 'error',
'require-atomic-updates': [0],
'object-shorthand': ['error', 'always'],
'func-style': ['error', 'declaration'],
'prefer-const': [
'error',
{
destructuring: 'all',
},
],
'unicorn/prefer-string-slice': 'error',
'react/no-unknown-property': ['error', { ignore: ['css', 'bold', 'italic', 'delete'] }],
},
plugins: ['babel', '@emotion', 'cypress', 'unicorn'],
settings: {
react: {
version: 'detect',
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
'import/core-modules': [...packages, 'decap-cms-app/dist/esm'],
},
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:cypress/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:import/recommended',
'plugin:import/typescript',
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
rules: {
'no-duplicate-imports': [0], // handled by @typescript-eslint
'@typescript-eslint/ban-types': [0], // TODO enable in future
'@typescript-eslint/no-non-null-assertion': [0],
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/explicit-function-return-type': [0],
'@typescript-eslint/explicit-module-boundary-types': [0],
'@typescript-eslint/no-duplicate-imports': 'error',
'@typescript-eslint/no-use-before-define': [
'error',
{ functions: false, classes: true, variables: true },
],
},
},
],
};