1/* globals process */
2
3// production rules
4const prod = {
5    'no-magic-numbers': ['warn', { 'ignore': [0, 1, -1]}],
6    'no-console': ['error', {'allow': ['warn', 'error']}],
7    'strict': ['error', 'function'],
8
9    // // stylistic issues
10    'indent': ['error', 4],
11
12    // es6 these are required in airbnb-base, but don't work in IE 11
13    'no-var': 0,
14    'object-shorthand': ['error', 'never'],
15    'prefer-rest-params': 0,
16    'prefer-arrow-callback': 0,
17    'prefer-template': 0,
18    'no-await-in-loop': 0,
19    'no-return-await': 0,
20    // trailing comma in functions not supported in ES5
21    'comma-dangle': ['error', {'arrays': 'always-multiline', 'objects': 'always-multiline', 'functions': 'never'}],
22};
23
24// dev rules extend production rules
25const dev = Object.assign(
26    {},
27    prod,
28    {
29        'no-console': 0,
30    }
31);
32
33// decide which rules to use -- default to dev
34let rules = dev;
35if(process.env.NODE_ENV === 'production') {
36    rules = prod;
37}
38
39module.exports = {
40    'extends': 'airbnb-base',
41    'parserOptions': {
42        'sourceType': 'script', // airbnb-base sets this to module
43    },
44    'env': {
45        'browser': true,
46        'es6': true,
47    },
48    'globals': {
49        'JSINFO': false,
50        'LANG': false,
51        'jQuery': false,
52        'createPicker': false,
53        'DOKU_BASE': false,
54        'pickercounter': true,
55        'pickerToggle': false,
56        'pickerInsert': false,
57        'QUnit': false
58    },
59    rules
60};
61