MDL-54939 amd: Fix lint issues fixable with eslint --fix
[moodle.git] / .eslintrc
CommitLineData
3adb62b7
DP
1{
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. Commented out rules with 'DEFINE POLICY' are rules Dan P has flagged
13 // for discussion and possible enable soon.
14 // === Possible Errors ===
15 // DEFINE POLICY: 'comma-dangle': ['off', 'always'],
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',
be4b3cc6 24 // Disabled for YUI rollups, enabled by grunt for AMD: 'no-empty': 'error',
3adb62b7
DP
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-negated-in-lhs': 'error',
35 'no-obj-calls': 'error',
36 'no-prototype-builtins': 'off',
37 'no-regex-spaces': 'error',
38 'no-sparse-arrays': 'error',
39 'no-unexpected-multiline': 'error',
40 'no-unreachable': 'warn',
41 'no-unsafe-finally': 'error',
42 'use-isnan': 'error',
43 'valid-jsdoc': ['warn', { 'requireReturn': false }],
44 'valid-typeof': 'error',
45
46 // === Best Practices ===
47 // (these mostly match our jshint config)
48 'curly': 'error',
49 'dot-notation': 'warn',
50 'no-alert': 'warn',
51 'no-caller': 'error',
52 'no-case-declarations': 'error',
53 'no-empty-pattern': 'error',
54 'no-empty-function': 'warn',
55 //DEFINE POLICY: 'no-eq-null': 'warn',
56 'no-eval': 'error',
57 //DEFINE POLICY: 'no-extra-bind': 'warn',
58 'no-fallthrough': 'error',
59 //DEFINE POLICY: 'no-implicit-globals': 'warn',
60 'no-implied-eval': 'error',
61 'no-invalid-this': 'error',
62 'no-iterator': 'error',
63 'no-labels': 'error',
64 'no-loop-func': 'error',
65 'no-multi-spaces': 'warn',
66 'no-multi-str': 'error',
67 'no-native-reassign': 'warn',
68 'no-new-func': 'error',
69 'no-new-wrappers': 'error',
70 // DEFINE POLICY: no-octal: "error"
71 // DEFINE POLICY: no-octal-escape: "error"
72 'no-proto': 'error',
73 'no-redeclare': 'warn',
74 'no-return-assign': 'error',
75 'no-script-url': 'error',
76 'no-self-assign': 'error',
77 'no-self-compare': 'error',
78 'no-unmodified-loop-condition': 'error',
be4b3cc6 79 // Disabled for YUI rollups, enabled by grunt for AMD: 'no-unused-expressions': 'error',
3adb62b7
DP
80 'no-unused-labels': 'error',
81 //DEFINE POLICY: 'no-useless-call': 'error',
82 'no-useless-escape': 'warn',
83 //DEFINE POLICY: 'no-with': 'error',
84 'wrap-iife': ['error', 'any'],
85
86 // === Variables ===
87 'no-delete-var': 'error',
be4b3cc6 88 // Disabled for YUI rollups, enabled by grunt for AMD: 'no-undef': 'off',
3adb62b7 89 //DEFINE POLICY: 'no-undef-init': 'error',
be4b3cc6 90 // Disabled for YUI rollups, enabled by grunt for AMD: 'no-unused-vars': 'error',
3adb62b7
DP
91
92 // === Stylistic Issues ===
93 'array-bracket-spacing': 'warn',
94 'block-spacing': 'warn',
95 'brace-style': ['warn', '1tbs'],
96 'camelcase': 'warn',
97 'comma-spacing': ['warn', { 'before': false, 'after': true }],
98 'comma-style': ['warn', 'last'],
99 'computed-property-spacing': 'error',
100 'consistent-this': 'off',
101 'eol-last': 'off',
102 'func-names': 'off',
103 'func-style': 'off',
104 // indent currently not doing well with our wrapping style, so disabled.
105 'indent': ['off', 4, { 'SwitchCase': 1 }],
106 'key-spacing': ['warn', { 'beforeColon': false, 'afterColon': true, 'mode': minimum }],
107 'keyword-spacing': 'warn',
108 'linebreak-style': ['error', 'unix'],
109 'lines-around-comment': 'off',
110 'max-len': ['error', 132],
111 'max-lines': 'off',
112 // DEFINE POLICY: turn on some of these max values?
113 'max-depth': 'off',
114 'max-nested-callbacks': 'off',
115 'max-params': 'off',
116 'max-statements': 'off',
117 'max-statements-per-line': 'off',
118 'new-cap': 'warn',
119 'new-parens': 'warn',
120 'newline-after-var': 'off',
121 'newline-before-return': 'off',
122 // REVIST POLICY: 'newline-per-chained-call': 'warn',
123 'no-array-constructor': 'off',
124 'no-bitwise': 'error',
125 'no-continue': 'off',
126 'no-inline-comments': 'off',
127 'no-lonely-if': 'off',
128 'no-mixed-operators': 'off',
129 'no-mixed-spaces-and-tabs': 'error',
130 'no-multiple-empty-lines': 'warn',
131 'no-negated-condition': 'off',
132 'no-nested-ternary': 'warn',
133 'no-new-object': 'off',
134 'no-plusplus': 'off',
135 'no-spaced-func': 'warn',
136 'no-ternary': 'off',
137 'no-trailing-spaces': 'error',
138 'no-underscore-dangle': 'off',
139 // DEFINE POLICY: 'no-unneeded-ternary': 'off',
140 'no-whitespace-before-property': 'warn',
141 // DEFINE POLICY: 'object-curly-newline': 'off,
142 // DEFINE POLICY: 'object-curly-spacing': 'off',
143 // DEFINE POLICY: 'object-property-newline': 'off',
144 'one-var': 'off',
145 // DEFINE POLICY: 'one-var-declaration-per-line': 'off',
146 'operator-assignment': 'off',
147 'operator-linebreak': 'off',
148 'padded-blocks': 'off',
149 // DEFINE POLICY: 'quote-props': 'off',
150 'quotes': 'off',
151 'require-jsdoc': 'warn',
152 'semi': 'error',
153 'semi-spacing': ['warn', {'before': false, 'after': true}],
154 'sort-vars': 'off',
155 'space-before-blocks': 'warn',
156 'space-before-function-paren': ['warn', 'never'],
157 'space-in-parens': 'warn',
158 'space-infix-ops': 'warn',
159 'space-unary-ops': 'warn',
160 'spaced-comment': 'warn',
161 'unicode-bom': 'error',
162 'wrap-regex': 'off',
163 }
164}