1/* globals process */
2'use strict';
3
4// production rules
5const prod = {
6    'compat/compat': 'error',
7    'valid-jsdoc': 'warn',
8    'default-case': 'error',
9    'eqeqeq': [
10        'error',
11        'smart'
12    ],
13    'no-magic-numbers': [
14        'error',
15        {
16            'ignoreArrayIndexes': true,
17            'ignore': [
18                -1,
19                0,
20                1
21            ]
22        }
23    ],
24    'comma-dangle': [
25        'error',
26        'never',
27    ],
28    "indent": [
29        "error",
30        4,
31    ],
32    "quotes": [
33        "error",
34        "single",
35    ],
36    "dot-notation": ["warn"],
37    "object-shorthand": ["error", "never"],
38    "linebreak-style": [
39        "error",
40        "unix",
41    ],
42    "no-implicit-globals": "error",
43    "no-return-assign": "error",
44    "no-throw-literal": "error",
45    "strict": ["error", "function"],
46    "require-jsdoc": ["error", {
47        "require": {
48            "FunctionDeclaration": true,
49            "MethodDefinition": true,
50            "ClassDeclaration": false,
51            "ArrowFunctionExpression": false
52        }
53    }]
54};
55
56// dev rules extend production rules
57const dev = Object.assign(
58    {
59        "no-console": 0,
60    },
61    prod
62);
63
64// decide which rules to use -- default to dev
65let rules = dev;
66if(process.env.NODE_ENV === 'production') {
67    rules = prod;
68}
69
70module.exports = {
71    'parserOptions': {
72        'ecmaVersion': 5
73    },
74    'env': {
75        'browser': true,
76        'jquery': true
77    },
78    'plugins': [
79        'compat',
80    ],
81    'extends': [
82        'eslint:recommended',
83    ],
84    rules
85};
86