-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
177 lines (175 loc) · 5 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/**
* Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
const path = require('path');
const customImportResolver = path.resolve('./eslint_import_resolver');
module.exports = {
extends: [
'./packages/eslint-config-fb-strict/index.js',
'plugin:import/errors',
'prettier',
'prettier/flowtype',
],
overrides: [
// to make it more suitable for running on code examples in docs/ folder
{
files: ['*.md'],
rules: {
'consistent-return': 0,
'import/no-extraneous-dependencies': 0,
'import/no-unresolved': 0,
'jest/no-focused-tests': 0,
'jest/no-identical-title': 0,
'jest/valid-expect': 0,
'no-undef': 0,
'no-unused-vars': 0,
'prettier/prettier': 0,
'react/jsx-no-undef': 0,
'react/react-in-jsx-scope': 0,
'sort-keys': 0,
'unicorn/filename-case': 0,
},
},
{
files: ['examples/**/*'],
rules: {
'babel/func-params-comma-dangle': 0,
'import/no-unresolved': [2, {ignore: ['^react-native$']}],
'import/order': 0,
'unicorn/filename-case': 0,
},
},
{
files: ['scripts/**/*', 'integration_tests/**/*'],
rules: {
'babel/func-params-comma-dangle': 0,
'unicorn/filename-case': 0,
},
},
{
files: [
'**/__mocks__/**/*',
'website/**/*',
'**/jest-runtime/**/*',
'**/src/Console*',
'packages/jest-cli/src/lib/Prompt.js',
'packages/jest-cli/src/reporters/Status.js',
'packages/jest-editor-support/src/Process.js',
'packages/jest-editor-support/src/Runner.js',
'packages/jest-editor-support/src/Settings.js',
'packages/jest-jasmine2/src/jasmine/Env.js',
'packages/jest-jasmine2/src/jasmine/Spec.js',
'packages/jest-jasmine2/src/jasmine/Suite.js',
'packages/jest-jasmine2/src/jasmine/Timer.js',
'packages/jest-snapshot/src/State.js',
],
rules: {
'unicorn/filename-case': 0,
},
},
{
excludedFiles: 'integration_tests/__tests__/**/*',
files: [
'examples/**/*',
'scripts/**/*',
'integration_tests/*/**/*',
'website/*/**/*',
'eslint_import_resolver.js',
],
rules: {
'prettier/prettier': [
2,
{
bracketSpacing: false,
printWidth: 80,
singleQuote: true,
trailingComma: 'es5',
},
],
},
},
{
files: [
'integration_tests/__tests__/**/*',
'packages/babel-jest/**/*.test.js',
'packages/babel-plugin-jest-hoist/**/*.test.js',
'packages/babel-preset-jest/**/*.test.js',
'packages/eslint-config-fb-strict/**/*.test.js',
'packages/eslint-plugin-jest/**/*.test.js',
'packages/jest-changed-files/**/*.test.js',
'packages/jest-circus/**/*.test.js',
'packages/jest-diff/**/*.test.js',
'packages/jest-docblock/**/*.test.js',
'packages/jest-editor-support/**/*.test.js',
'packages/jest/**/*.test.js',
'packages/pretty-format/**/*.test.js',
],
rules: {
'flowtype/require-valid-file-annotation': [2, 'always'],
},
},
{
files: [
'website/**',
'**/__tests__/**',
'integration_tests/**',
'**/pretty-format/perf/**',
],
rules: {
'import/no-extraneous-dependencies': 0,
},
},
],
parser: 'babel-eslint',
plugins: ['markdown', 'import', 'unicorn', 'prettier'],
rules: {
'flowtype/boolean-style': 2,
'flowtype/no-primitive-constructor-types': 2,
'flowtype/require-valid-file-annotation': 2,
// These has to be disabled until the whole code base is converted to ESM
'import/default': 0,
'import/named': 0,
'import/no-duplicates': 2,
'import/no-extraneous-dependencies': [
2,
{
devDependencies: [
'**/__tests__/**',
'**/__mocks__/**',
'**/?(*.)(spec|test).js?(x)',
'scripts/**',
'eslint_import_resolver.js',
'test_setup_file.js',
],
},
],
'import/no-unresolved': [2, {ignore: ['^types/']}],
// This has to be disabled until all type and module imports are combined
// https://github.com/benmosher/eslint-plugin-import/issues/645
'import/order': 0,
'no-console': 0,
'prettier/prettier': [
2,
{
bracketSpacing: false,
printWidth: 80,
singleQuote: true,
trailingComma: 'all',
},
],
'unicorn/filename-case': [2, {case: 'snakeCase'}],
},
settings: {
'import/resolver': {
[customImportResolver]: {
moduleNameMapper: {
'^types/(.*)': './types/$1',
},
},
},
},
};