This repository has been archived by the owner on Mar 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy path.eslintrc.js
115 lines (113 loc) · 3.1 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
/**
* Copyright 2020 The Magma Authors.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @format
*/
// enforces copyright header to be present in every file
// eslint-disable-next-line max-len
const openSourcePattern = /\*\n \* Copyright 20\d{2}-present Magma\. All Rights Reserved\.\n \*\n \* This source code is licensed under the BSD-style license found in the\n \* LICENSE file in the root directory of this source tree\.\n \*\n/;
// eslint-disable-next-line max-len
const newOpenSourcePattern = /Copyright \(c\) Magma, Inc\. and its affiliates\./;
const combinedOpenSourcePattern = new RegExp(
'(' + newOpenSourcePattern.source + ')|(' + openSourcePattern.source + ')',
);
module.exports.extends = ['eslint-config-fbcnms'];
module.exports.overrides = [
{
files: ['*'],
rules: {
'prettier/prettier': [
2,
{
singleQuote: true,
trailingComma: 'all',
bracketSpacing: false,
jsxBracketSameLine: true,
parser: 'flow',
},
],
},
},
{
files: ['*.mdx'],
extends: ['plugin:mdx/overrides'],
rules: {
'flowtype/require-valid-file-annotation': 'off',
'prettier/prettier': [
2,
{
parser: 'mdx',
},
],
},
},
{
files: ['.eslintrc.js'],
rules: {
quotes: ['warn', 'single'],
},
},
{
env: {
jest: true,
node: true,
},
files: [
'**/__mocks__/**/*.js',
'**/__tests__/**/*.js',
'**/tests/*.js',
'testHelpers.js',
'testData.js',
'jest-setup.js',
],
},
{
files: ['fbcnms-packages/**/*.js'],
rules: {
'header/header': [2, 'block', {pattern: combinedOpenSourcePattern}],
},
},
{
env: {
node: true,
},
files: [
'.eslintrc.js',
'babel.config.js',
'jest.config.js',
'jest.*.config.js',
'fbcnms-packages/eslint-config-fbcnms/**/*.js',
'fbcnms-packages/fbcnms-auth/**/*.js',
'fbcnms-packages/fbcnms-babel-register/**/*.js',
'fbcnms-packages/fbcnms-express-middleware/**/*.js',
'fbcnms-packages/fbcnms-logging/**/*.js',
'fbcnms-packages/fbcnms-platform-server/**/*.js',
'fbcnms-packages/fbcnms-relay/**/*.js',
'fbcnms-packages/fbcnms-sequelize-models/**/*.js',
'fbcnms-packages/fbcnms-ui/stories/**/*.js',
'fbcnms-packages/fbcnms-util/**/*.js',
'fbcnms-packages/fbcnms-webpack-config/**/*.js',
'fbcnms-projects/*/config/webpack.*.js',
'fbcnms-projects/*/scripts/**/*.js',
'fbcnms-projects/*/server/**/*.js',
'scripts/fb/fbt/*.js',
],
rules: {
'no-console': 'off',
},
},
];
module.exports.settings = {
react: {
version: 'detect',
},
};