-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
.eslintrc.js
113 lines (113 loc) · 2.77 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
module.exports = {
extends: [ 'plugin:@wordpress/eslint-plugin/recommended' ],
globals: {
fetchMock: true,
IntersectionObserver: 'readonly',
// @todo Move E2E related ESLint configuration into custom config.
//
// We should have linting properties only included for files that they
// are specific to as opposed to globally.
page: 'readonly',
browser: 'readonly',
context: 'readonly',
},
settings: {
jsdoc: { mode: 'typescript' },
// List of modules that are externals in our webpack config.
// This helps the `import/no-extraneous-dependencies` and
//`import/no-unresolved` rules account for them.
'import/core-modules': [
'@wordpress/block-editor',
'@wordpress/a11y',
'@wordpress/api-fetch',
'@wordpress/compose',
'@wordpress/data',
'@wordpress/escape-html',
'@wordpress/hooks',
'@wordpress/keycodes',
'@wordpress/url',
'babel-jest',
'dotenv',
'jest-environment-puppeteer',
'lodash/kebabCase',
'lodash',
'prop-types',
'react',
'requireindex',
],
'import/resolver': {
node: {},
webpack: {
config: 'webpack.config.js',
},
},
'import/ignore': [ 'node_modules' ],
},
rules: {
'react-hooks/exhaustive-deps': 'error',
'react/jsx-fragments': [ 'error', 'syntax' ],
'@wordpress/no-global-active-element': 'warn',
'@wordpress/i18n-text-domain': [
'error',
{
allowedTextDomain: [ 'wp-graphql-headless-login' ],
},
],
camelcase: [
'error',
{
properties: 'never',
ignoreGlobals: true,
},
],
},
overrides: [
{
files: [ '*.ts', '*.tsx' ],
parser: '@typescript-eslint/parser',
extends: [ 'plugin:@typescript-eslint/recommended' ],
rules: {
'prefer-rest-params': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': [ 'error' ],
'jsdoc/require-param': 'off',
'no-shadow': 'off',
'@typescript-eslint/no-shadow': [ 'error' ],
'@typescript-eslint/no-unused-vars': [
'error',
{ ignoreRestSiblings: true },
],
camelcase: 'off',
'@typescript-eslint/naming-convention': [
'error',
{
selector: [ 'method', 'variableLike' ],
format: [ 'camelCase', 'PascalCase', 'UPPER_CASE' ],
leadingUnderscore: 'allowSingleOrDouble',
filter: {
regex: 'webpack_public_path__',
match: false,
},
},
{
selector: 'typeProperty',
format: [ 'camelCase', 'snake_case' ],
filter: {
regex: 'API_FETCH_WITH_HEADERS|Block',
match: false,
},
},
],
},
},
// {
// files: ['./packages/admin/mapped-types.ts'],
// rules: {
// '@typescript-eslint/no-explicit-any': 'off',
// '@typescript-eslint/no-shadow': 'off',
// 'no-shadow': 'off',
// },
// },
],
};