forked from uber/cadence-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
165 lines (164 loc) · 5.95 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
const currentYear = (new Date()).getFullYear();
module.exports = {
extends: [
'plugin:prettier/recommended',
'plugin:vue/essential',
],
env: {
'jest/globals': true,
'node': true,
},
globals: {
module: true, // hot reloading
scenario: true, // mocha
should: true, // mocha
},
parserOptions: {
ecmaVersion: 2020,
},
plugins: ['jest', 'import', 'eslint-plugin-header'],
rules: {
curly: ['error', 'all'],
'dot-notation': 'error',
'header/header': [
'error',
'line',
[
{
/**
* Examples which match pattern:
*
* 1. single year span (by default for new files)
* // Copyright (c) 2020 Uber Technologies Inc.
*
* 2. multi-year span
* // Copyright (c) 2017-2022 Uber Technologies Inc.
*
* 3. new file from another company referenced
* // Modifications Copyright (c) 2020 Uber Technologies Inc.
*
* See `client/test/lint/license` for passing examples.
*
* NOTE: This will update each year so when new year's day comes,
* the build will fail and will need the headers to be updated.
* Just be aware of running auto-fix as it will use what is in
* the template and not update the offending part of the header.
*
* In this case it will change header:
* from:
* Copyright (c) 2017-2022 Uber Technologies Inc.
* Copyright (c) 2020 Uber Technologies Inc.
* to:
* Copyright (c) 2022 Uber Technologies Inc.
* but should be (respectively):
* Copyright (c) 2017-2022 Uber Technologies Inc.
* Copyright (c) 2020-2022 Uber Technologies Inc.
*
* I have requested for a new feature which allows templates to
* use named capture groups in the template. See open issue:
* https://github.com/Stuk/eslint-plugin-header/issues/33
*/
pattern: ` (Modifications )?Copyright \\(c\\) (?<firstYear>20\\d{2}\\-)?${currentYear} Uber Technologies Inc\.`,
template: ` Copyright (c) ${currentYear} Uber Technologies Inc.`,
},
{
/**
* This pattern can match anything as we don't know who we are referencing.
* By default if no comment is specified this line will be ignored (inserts blank line).
*
* 1. Empty space
* //
*
* 2. new file from another company referenced
* // Copyright (c) 2020 Temporal Technologies, Inc.
*
* 3. existing file but updated from another company and merged back
* // Portions of the Software are attributed to Copyright (c) 2020 Temporal Technologies Inc.
*
* See `client/test/lint/license` for passing examples.
*/
pattern: '',
template: ' ',
},
'',
' Permission is hereby granted, free of charge, to any person obtaining a copy',
' of this software and associated documentation files (the "Software"), to deal',
' in the Software without restriction, including without limitation the rights',
' to use, copy, modify, merge, publish, distribute, sublicense, and/or sell',
' copies of the Software, and to permit persons to whom the Software is',
' furnished to do so, subject to the following conditions:',
'',
' The above copyright notice and this permission notice shall be included in',
' all copies or substantial portions of the Software.',
'',
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR',
' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,',
' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE',
' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER',
' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,',
' OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN',
' THE SOFTWARE.'
],
2
],
'import/order': [
'error',
{ 'groups': ['builtin', 'external', 'parent', 'sibling', 'index'] }
],
'jest/consistent-test-it': [
'error',
{ 'fn': 'test', 'withinDescribe': 'it' }
],
'jest/lowercase-name': [
'error',
{
'ignore': ['describe', 'test']
}
],
'no-var': 'error',
'no-use-before-define': 'error',
'no-useless-constructor': 'error',
'object-curly-spacing': ['error', 'always'],
'padding-line-between-statements': [
'error',
{ 'blankLine': 'always', 'prev': '*', 'next': 'return' },
{ 'blankLine': 'always', 'prev': ['const', 'let', 'var'], 'next': '*' },
{
'blankLine': 'any',
'prev': ['const', 'let', 'var'],
'next': ['const', 'let', 'var']
},
{ 'blankLine': 'always', 'prev': 'directive', 'next': '*' },
{ 'blankLine': 'any', 'prev': 'directive', 'next': 'directive' },
{ 'blankLine': 'always', 'prev': '*', 'next': 'if' },
{ 'blankLine': 'always', 'prev': 'if', 'next': '*' },
{ 'blankLine': 'always', 'prev': '*', 'next': 'function' }
],
'prefer-const': 'error',
'prettier/prettier': [
'error',
{
bracketSpacing: true,
singleQuote: true,
trailingComma: 'es5',
jsxBracketSameLine: false
},
],
'space-before-blocks': 'error',
'vue/component-tags-order': [
'error',
{
'order': ['script', 'template', 'style'],
}
],
'vue/multi-word-component-names': 'off',
},
settings: {
'import/resolver': {
'babel-module': {},
webpack: {
config: 'webpack.config.js',
},
},
},
};