-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathindex.js
56 lines (49 loc) · 1.22 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"use strict";
var checkExceptions = require('./check_exceptions');
module.exports = {
rules: {
"no-let": function(context) {
return {
"VariableDeclaration": function(node) {
if (node.kind === "let") {
context.report(node, "Unexpected let, use const.");
}
}
};
},
"no-this": function(context) {
return {
"ThisExpression": function(node) {
context.report(node, "Unexpected this, use functions not classes.");
}
}
},
"no-mutation": function(context) {
return {
"AssignmentExpression": function(node) {
var options = context.options[0] || {};
var exceptions = options.exceptions || [];
if (checkExceptions(node, exceptions)) {
return;
}
if (node.left.type === "MemberExpression") {
var memberExpression = node.left
if (memberExpression.object.name !== 'module' && memberExpression.property.name !== 'exports') {
context.report(node, "No object mutation allowed.");
}
}
}
}
}
},
configs: {
recommended: {
rules: {
'redux/no-let': 2,
'redux/no-this': 2,
'redux/no-mutation': 2
}
}
}
};
//no-undef