forked from circleci/circleci-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
74 lines (72 loc) · 1.7 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
const DOCS_GLOBALS = {
AnalyticsClient: 'readonly',
algoliasearch: 'readonly',
amplitude: 'readonly',
analytics: 'readonly',
analyticsTrackProps: 'readonly',
getSessionId: 'writable', // TODO: remove when legacy analytics is removed
forceAll: 'writable',
instantsearch: 'readonly',
tooltip: 'readonly',
trackEvent: 'readonly',
userData: 'readonly',
};
const API_DOCS_GLOBALS = {
activateLanguage: 'writable',
click: 'writable',
closest: 'writable',
define: 'writable',
getLanguageFromQueryString: 'writable',
isThresholdReached: 'writable',
loadToc: 'writable',
lunr: 'writable',
setupLanguages: 'writable',
touchend: 'writable',
touchmove: 'writable',
touchstart: 'writable',
};
module.exports = {
plugins: ['jest', 'prettier'],
extends: [
'eslint:recommended',
'plugin:jest/recommended',
'plugin:prettier/recommended',
'prettier',
],
globals: {
...DOCS_GLOBALS,
...API_DOCS_GLOBALS,
},
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
curly: [2, 'multi-line'],
'eol-last': ['error', 'always'],
'no-restricted-globals': [
'warn',
...['name', 'event'].map((global) => ({
name: global,
message: `Did you mean to declare a local \`${global}\`? If not, use \`window.${global}\` instead.`,
})),
],
'arrow-body-style': ['warn', 'as-needed'],
'no-console': 'error',
'prefer-object-spread': 'warn',
'prettier/prettier': 'error',
},
env: {
'jest/globals': true,
browser: true,
node: true,
es6: true,
es2021: true,
jquery: true,
},
ignorePatterns: [
'*.min.js',
'*vendor*',
'src-api/source/javascripts/lib/*.js',
],
};