backstage

Форк
0
/
.eslintrc.js 
266 строк · 6.7 Кб
1
/*
2
 * Copyright 2021 The Backstage Authors
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
var path = require('path');
18

19
module.exports = {
20
  root: true,
21
  plugins: ['@spotify', 'notice', 'react', 'testing-library'],
22
  rules: {
23
    'notice/notice': [
24
      'error',
25
      {
26
        templateFile: path.resolve(
27
          // eslint-disable-next-line no-restricted-syntax
28
          __dirname,
29
          './scripts/templates/copyright-header.txt'
30
        ),
31
        onNonMatchingHeader: 'replace',
32
      },
33
    ],
34
    'no-restricted-syntax': [
35
      'error',
36
      {
37
        message:
38
          "Avoid using .toLowerCase(), use .toLocaleLowerCase('en-US') instead. " +
39
          'This rule can sometimes be ignored when converting text to be displayed to the user.',
40
        selector:
41
          "CallExpression[arguments.length=0] > MemberExpression[property.name='toLowerCase']",
42
      },
43
      {
44
        message:
45
          "Avoid using .toUpperCase(), use .toLocaleUpperCase('en-US') instead. " +
46
          'This rule can sometimes be ignored when converting text to be displayed to the user.',
47
        selector:
48
          "CallExpression[arguments.length=0] > MemberExpression[property.name='toUpperCase']",
49
      },
50
    ],
51
    'testing-library/await-async-queries': 'error',
52
    'testing-library/await-async-utils': 'error',
53
    'testing-library/no-await-sync-queries': 'error',
54
    'testing-library/no-dom-import': 'error',
55
    'testing-library/no-wait-for-side-effects': 'error',
56
    'testing-library/await-async-events': 'error',
57
    'no-restricted-globals': [
58
      'error',
59
      [
60
        'blur',
61
        'captureEvents',
62
        'chrome',
63
        'clientInformation',
64
        'close',
65
        'closed',
66
        'createImageBitmap',
67
        'crypto',
68
        'customElements',
69
        'defaultstatus',
70
        'defaultStatus',
71
        'devicePixelRatio',
72
        'external',
73
        'find',
74
        'focus',
75
        'frameElement',
76
        'frames',
77
        'getComputedStyle',
78
        'getSelection',
79
        'indexedDB',
80
        'innerHeight',
81
        'innerWidth',
82
        'isSecureContext',
83
        'length',
84
        'location',
85
        'locationbar',
86
        'matchMedia',
87
        'menubar',
88
        'moveBy',
89
        'moveTo',
90
        'name',
91
        'navigator',
92
        'onabort',
93
        'onafterprint',
94
        'onanimationend',
95
        'onanimationiteration',
96
        'onanimationstart',
97
        'onappinstalled',
98
        'onauxclick',
99
        'onbeforeinstallprompt',
100
        'onbeforeprint',
101
        'onbeforeunload',
102
        'onblur',
103
        'oncancel',
104
        'oncanplay',
105
        'oncanplaythrough',
106
        'onchange',
107
        'onclick',
108
        'onclose',
109
        'oncontextmenu',
110
        'oncuechange',
111
        'ondblclick',
112
        'ondevicemotion',
113
        'ondeviceorientation',
114
        'ondeviceorientationabsolute',
115
        'ondrag',
116
        'ondragend',
117
        'ondragenter',
118
        'ondragleave',
119
        'ondragover',
120
        'ondragstart',
121
        'ondrop',
122
        'ondurationchange',
123
        'onemptied',
124
        'onended',
125
        'onerror',
126
        'onfocus',
127
        'ongotpointercapture',
128
        'onhashchange',
129
        'oninput',
130
        'oninvalid',
131
        'onkeydown',
132
        'onkeypress',
133
        'onkeyup',
134
        'onlanguagechange',
135
        'onload',
136
        'onloadeddata',
137
        'onloadedmetadata',
138
        'onloadstart',
139
        'onlostpointercapture',
140
        'onmessage',
141
        'onmessageerror',
142
        'onmousedown',
143
        'onmouseenter',
144
        'onmouseleave',
145
        'onmousemove',
146
        'onmouseout',
147
        'onmouseover',
148
        'onmouseup',
149
        'onmousewheel',
150
        'onoffline',
151
        'ononline',
152
        'onpagehide',
153
        'onpageshow',
154
        'onpause',
155
        'onplay',
156
        'onplaying',
157
        'onpointercancel',
158
        'onpointerdown',
159
        'onpointerenter',
160
        'onpointerleave',
161
        'onpointermove',
162
        'onpointerout',
163
        'onpointerover',
164
        'onpointerup',
165
        'onpopstate',
166
        'onprogress',
167
        'onratechange',
168
        'onrejectionhandled',
169
        'onreset',
170
        'onresize',
171
        'onscroll',
172
        'onsearch',
173
        'onseeked',
174
        'onseeking',
175
        'onselect',
176
        'onstalled',
177
        'onstorage',
178
        'onsubmit',
179
        'onsuspend',
180
        'ontimeupdate',
181
        'ontoggle',
182
        'ontransitionend',
183
        'onunhandledrejection',
184
        'onunload',
185
        'onvolumechange',
186
        'onwaiting',
187
        'onwebkitanimationend',
188
        'onwebkitanimationiteration',
189
        'onwebkitanimationstart',
190
        'onwebkittransitionend',
191
        'onwheel',
192
        'open',
193
        'openDatabase',
194
        'opener',
195
        'origin',
196
        'outerHeight',
197
        'outerWidth',
198
        'pageXOffset',
199
        'pageYOffset',
200
        'parent',
201
        'performance',
202
        'personalbar',
203
        'postMessage',
204
        'print',
205
        'releaseEvents',
206
        'resizeBy',
207
        'resizeTo',
208
        'screen',
209
        'screenLeft',
210
        'screenTop',
211
        'screenX',
212
        'screenY',
213
        'scroll',
214
        'scrollbars',
215
        'scrollBy',
216
        'scrollTo',
217
        'scrollX',
218
        'scrollY',
219
        'self',
220
        'speechSynthesis',
221
        'status',
222
        'statusbar',
223
        'stop',
224
        'styleMedia',
225
        'toolbar',
226
        'top',
227
        'visualViewport',
228
        'webkitRequestFileSystem',
229
        'webkitResolveLocalFileSystemURL',
230
        'webkitStorageInfo',
231
      ].map(function f(name) {
232
        return {
233
          name: name,
234
          message:
235
            'Avoid using implicitly global variables. Use e.g. window.' +
236
            name +
237
            ' instead if this was your intent.',
238
        };
239
      }),
240
    ].flat(),
241
  },
242
  overrides: [
243
    {
244
      files: ['**/*.[jt]s?(x)'],
245
      excludedFiles: '**/*.{test,spec}.[jt]s?(x)',
246
      rules: {
247
        'react/forbid-elements': [
248
          1,
249
          {
250
            forbid: [
251
              {
252
                element: 'button',
253
                message: 'use Material UI <Button> instead',
254
              },
255
              { element: 'p', message: 'use Material UI <Typography> instead' },
256
              {
257
                element: 'span',
258
                message: 'use a Material UI <Typography> variant instead',
259
              },
260
            ],
261
          },
262
        ],
263
      },
264
    },
265
  ],
266
};
267

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.