Merge branch 'MDL-59801-master-fix1' of http://github.com/damyon/moodle
[moodle.git] / .eslintrc
blobc50d2bb273d68fdef0524b4419c34636ea986a6e
2   'plugins': [
3     'promise',
4   ],
5   'env': {
6     'browser': true,
7     'amd': true
8   },
9   'globals': {
10     'M': true,
11     'Y': true
12   },
13   'rules': {
14     // See http://eslint.org/docs/rules/ for all rules and explanations of all
15     // rules.
17     // === Possible Errors ===
18     'comma-dangle': 'off',
19     'no-cond-assign': 'error',
20     'no-console': 'error',
21     'no-constant-condition': 'error',
22     'no-control-regex': 'error',
23     'no-debugger': 'error',
24     'no-dupe-args': 'error',
25     'no-dupe-keys': 'error',
26     'no-duplicate-case': 'error',
27     'no-empty': 'warn',
28     'no-empty-character-class': 'error',
29     'no-ex-assign': 'error',
30     'no-extra-boolean-cast': 'error',
31     'no-extra-parens': 'off',
32     'no-extra-semi': 'error',
33     'no-func-assign': 'error',
34     'no-inner-declarations': 'error',
35     'no-invalid-regexp': 'error',
36     'no-irregular-whitespace': 'error',
37     'no-obj-calls': 'error',
38     'no-prototype-builtins': 'off',
39     'no-regex-spaces': 'error',
40     'no-sparse-arrays': 'error',
41     'no-unexpected-multiline': 'error',
42     'no-unreachable': 'warn',
43     'no-unsafe-finally': 'error',
44     'no-unsafe-negation': 'error',
45     'use-isnan': 'error',
46     'valid-jsdoc': ['warn', { 'requireReturn': false, 'requireParamDescription': false, 'requireReturnDescription': false }],
47     'valid-typeof': 'error',
49     // === Best Practices ===
50     // (these mostly match our jshint config)
51     'array-callback-return': 'warn',
52     'block-scoped-var': 'warn',
53     'complexity': 'warn',
54     'consistent-return': 'warn',
55     'curly': 'error',
56     'dot-notation': 'warn',
57     'no-alert': 'warn',
58     'no-caller': 'error',
59     'no-case-declarations': 'error',
60     'no-div-regex': 'error',
61     'no-empty-pattern': 'error',
62     'no-empty-function': 'warn',
63     'no-eq-null': 'error',
64     'no-eval': 'error',
65     'no-extend-native': 'error',
66     'no-extra-bind': 'warn',
67     'no-fallthrough': 'error',
68     'no-floating-decimal': 'warn',
69     'no-global-assign': 'warn',
70     // Enabled by grunt for AMD modules: 'no-implicit-globals': 'error',
71     'no-implied-eval': 'error',
72     'no-invalid-this': 'error',
73     'no-iterator': 'error',
74     'no-labels': 'error',
75     'no-loop-func': 'error',
76     'no-multi-spaces': 'warn',
77     'no-multi-str': 'error',
78     'no-new-func': 'error',
79     'no-new-wrappers': 'error',
80     'no-octal': 'error',
81     'no-octal-escape': 'error',
82     'no-proto': 'error',
83     'no-redeclare': 'warn',
84     'no-return-assign': 'error',
85     'no-script-url': 'error',
86     'no-self-assign': 'error',
87     'no-self-compare': 'error',
88     'no-sequences': 'warn',
89     'no-throw-literal': 'warn',
90     'no-unmodified-loop-condition': 'error',
91     'no-unused-expressions': 'error',
92     'no-unused-labels': 'error',
93     'no-useless-call': 'warn',
94     'no-useless-escape': 'warn',
95     'no-with': 'error',
96     'wrap-iife': ['error', 'any'],
98     // === Variables ===
99     'no-delete-var': 'error',
100     'no-undef': 'error',
101     'no-undef-init': 'error',
102     'no-unused-vars': ['error', { 'caughtErrors': 'none' }],
104     // === Stylistic Issues ===
105     'array-bracket-spacing': 'warn',
106     'block-spacing': 'warn',
107     'brace-style': ['warn', '1tbs'],
108     'camelcase': 'warn',
109     'comma-spacing': ['warn', { 'before': false, 'after': true }],
110     'comma-style': ['warn', 'last'],
111     'computed-property-spacing': 'error',
112     'consistent-this': 'off',
113     'eol-last': 'off',
114     'func-call-spacing': ['warn', 'never'],
115     'func-names': 'off',
116     'func-style': 'off',
117     // indent currently not doing well with our wrapping style, so disabled.
118     'indent': ['off', 4, { 'SwitchCase': 1 }],
119     'key-spacing': ['warn', { 'beforeColon': false, 'afterColon': true, 'mode': minimum }],
120     'keyword-spacing': 'warn',
121     'linebreak-style': ['error', 'unix'],
122     'lines-around-comment': 'off',
123     'max-len': ['error', 132],
124     'max-lines': 'off',
125     'max-depth': 'warn',
126     'max-nested-callbacks': ['warn', 5],
127     'max-params': 'off',
128     'max-statements': 'off',
129     'max-statements-per-line': ['warn', { max: 2 }],
130     'new-cap': ['warn', { 'properties': false }],
131     'new-parens': 'warn',
132     'newline-after-var': 'off',
133     'newline-before-return': 'off',
134     'newline-per-chained-call': 'off',
135     'no-array-constructor': 'off',
136     'no-bitwise': 'error',
137     'no-continue': 'off',
138     'no-inline-comments': 'off',
139     'no-lonely-if': 'off',
140     'no-mixed-operators': 'off',
141     'no-mixed-spaces-and-tabs': 'error',
142     'no-multiple-empty-lines': 'warn',
143     'no-negated-condition': 'off',
144     'no-nested-ternary': 'warn',
145     'no-new-object': 'off',
146     'no-plusplus': 'off',
147     'no-tabs': 'error',
148     'no-ternary': 'off',
149     'no-trailing-spaces': 'error',
150     'no-underscore-dangle': 'off',
151     'no-unneeded-ternary': 'off',
152     'no-whitespace-before-property': 'warn',
153     'object-curly-newline': 'off',
154     'object-curly-spacing': 'warn',
155     'object-property-newline': 'off',
156     'one-var': 'off',
157     'one-var-declaration-per-line': ['warn', 'initializations'],
158     'operator-assignment': 'off',
159     'operator-linebreak': 'off',
160     'padded-blocks': 'off',
161     'quote-props': ['warn', 'as-needed', {'unnecessary': false, 'keywords': true, 'numbers': true}],
162     'quotes': 'off',
163     'require-jsdoc': 'warn',
164     'semi': 'error',
165     'semi-spacing': ['warn', {'before': false, 'after': true}],
166     'sort-vars': 'off',
167     'space-before-blocks': 'warn',
168     'space-before-function-paren': ['warn', 'never'],
169     'space-in-parens': 'warn',
170     'space-infix-ops': 'warn',
171     'space-unary-ops': 'warn',
172     'spaced-comment': 'warn',
173     'unicode-bom': 'error',
174     'wrap-regex': 'off',
176     // === Promises ===
177     'promise/always-return': 'warn',
178     'promise/no-return-wrap': 'warn',
179     'promise/param-names': 'warn',
180     'promise/catch-or-return': ['warn', {terminationMethod: ['catch', 'fail']}],
181     'promise/no-native': 'warn',
182     'promise/no-promise-in-callback': 'warn',
183     'promise/no-callback-in-promise': 'warn',
184     'promise/avoid-new': 'warn',
186     // === Deprecations ===
187     "no-restricted-properties": ['warn', {
188         'object': 'M',
189         'property': 'str',
190         'message': 'Use AMD module "core/str" or M.util.get_string()'
191     }],
193   }