forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
67 lines (63 loc) · 1.58 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
const allowedModules = require('./allowedModules.js');
module.exports = {
env: {
browser: true,
commonjs: true
},
settings: {
'import/resolver': {
node: {
moduleDirectory: ['node_modules', './']
}
}
},
extends: 'standard',
plugins: [
'prebid',
'import'
],
globals: {
'BROWSERSTACK_USERNAME': false,
'BROWSERSTACK_KEY': false,
'FEATURES': 'readonly',
},
// use babel as parser for fancy syntax
parser: '@babel/eslint-parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2018,
},
rules: {
'comma-dangle': 'off',
semi: 'off',
'space-before-function-paren': 'off',
'import/extensions': ['error', 'ignorePackages'],
// Exceptions below this line are temporary, so that eslint can be added into the CI process.
// Violations of these styles should be fixed, and the exceptions removed over time.
//
// See Issue #1111.
eqeqeq: 'off',
'no-return-assign': 'off',
'no-throw-literal': 'off',
'no-undef': 2,
'no-useless-escape': 'off',
'no-console': 'error',
},
overrides: Object.keys(allowedModules).map((key) => ({
files: key + '/**/*.js',
rules: {
'prebid/validate-imports': ['error', allowedModules[key]],
'no-restricted-globals': [
'error',
{
name: 'require',
message: 'use import instead'
}
]
}
})).concat([{
// code in other packages (such as plugins/eslint) is not "seen" by babel and its parser will complain.
files: 'plugins/*/**/*.js',
parser: 'esprima'
}])
};