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