-
Notifications
You must be signed in to change notification settings - Fork 13
/
.eslintrc.js
45 lines (41 loc) · 1.27 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
/* eslint-env node */
module.exports = {
extends: ['eslint:recommended'],
plugins: ['unicorn'],
parserOptions: {
ecmaVersion: 2020,
},
env: {
browser: true,
es6: true,
},
globals: {
StravaEnhancementSuiteOptions: 'writable',
StravaEnhancementSuiteOptionsContexts: 'writable',
jQuery: 'readonly',
$: 'readonly',
},
ignorePatterns: [
'extension/js/libs/*.js',
],
rules: {
// Overwrite few recommended options to avoid too many changes when introducing ESLint to the codebase
quotes: ['error', 'single'],
'quote-props': ['error', 'as-needed'],
semi: ['error', 'always'],
'comma-style': ['error', 'last'],
'semi-style': ['error', 'last'],
'comma-dangle': ['error', 'always-multiline'],
indent: ['error', 2, { SwitchCase: 1 }],
'object-curly-spacing': ['error', 'always'],
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
'no-redeclare': 'warn',
'no-unused-vars': 'off',
// Prefer event key over keyCode
'unicorn/prefer-event-key': 'error', // only works on addEventListener, not with jQuery's .on
'no-restricted-properties': ['error', { // quick'n'dirty solution for jQuery
property: 'keyCode',
message: 'Use .key instead of .keyCode',
}],
},
};