-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
/
index.js
87 lines (83 loc) · 2.24 KB
/
index.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
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// Can't be ESModules as this is not compiled
const fbjsConfig = require('eslint-config-fbjs');
const variableNamePattern = String.raw`\s*[a-zA-Z_$][a-zA-Z_$\d]*\s*`;
const importPattern =
String.raw`^(?:var|let|const|import type)\s+` +
'{?' +
variableNamePattern +
'(?:,' +
variableNamePattern +
')*}?' +
String.raw`\s*(?:=\s*require\(|from)[a-zA-Z_+./''\s\d\-]+\)?[^;\n]*[;\n]`;
const maxLenIgnorePattern = String.raw`(^\s*(it|test)\(|${importPattern})`;
delete fbjsConfig.rules['babel/flow-object-type'];
module.exports = Object.assign({}, fbjsConfig, {
env: {
es6: true,
'jest/globals': true,
node: true,
},
plugins: fbjsConfig.plugins.concat(['jest']),
rules: Object.assign({}, fbjsConfig.rules, {
'array-bracket-spacing': [2, 'never'],
'arrow-parens': [2, 'as-needed'],
'arrow-spacing': [2],
'brace-style': [
2,
'1tbs',
{
allowSingleLine: true,
},
],
'comma-dangle': [2, 'always-multiline'],
'comma-spacing': [2],
'comma-style': [2, 'last'],
'computed-property-spacing': [2, 'never'],
'eol-last': [2],
'flowtype/object-type-delimiter': [2, 'comma'],
indent: [0],
'jest/no-focused-tests': [2],
'jest/no-identical-title': [2],
'jest/valid-expect': [2],
'max-len': [
2,
{
code: 80,
ignorePattern: maxLenIgnorePattern,
ignoreUrls: true,
},
],
'no-const-assign': [2],
'no-extra-parens': [2, 'functions'],
'no-irregular-whitespace': [2],
'no-this-before-super': [2],
'no-var': [2],
'object-curly-spacing': [2, 'never'],
'object-shorthand': [2],
'prefer-arrow-callback': [2],
'prefer-const': [2],
quotes: [
2,
'single',
{
allowTemplateLiterals: true,
avoidEscape: true,
},
],
semi: [2, 'always'],
'sort-keys': [2],
'space-before-blocks': [2],
'space-before-function-paren': [
2,
{anonymous: 'never', asyncArrow: 'always', named: 'never'},
],
'space-in-parens': [2, 'never'],
}),
});