-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (34 loc) · 1.26 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
const fs = require('fs');
const path = require('path');
const recommended = require('./configs/recommended');
const memoryLeak = require('./rules/memory-leak/memory-leak');
const sameCoreDependencyVersion = require('./rules/same-core-dependency-version/same-core-dependency-version');
const nolookbehind = require('./rules/nolookbehind/nolookbehind');
const noDoubleAwait = require('./rules/no-double-await/no-double-await');
const noNewEnzymeTest = require('./rules/no-new-enzyme-test/no-new-enzyme-test');
module.exports = {
configs: {
recommended
},
rules: {
'memory-leak': memoryLeak,
'same-core-dependency-version': sameCoreDependencyVersion,
'nolookbehind': nolookbehind,
'no-double-await': noDoubleAwait,
'no-new-enzyme-test': noNewEnzymeTest
},
processors: {
'.json': {
preprocess: (text, filename) => {
if (path.basename(filename) === 'package.json') {
sameCoreDependencyVersion.registerPackageJsonContents(fs.readFileSync(filename, 'utf-8'));
}
return [''];
},
postprocess(messages) {
const flattenedMessages = [].concat(...messages)
return flattenedMessages.filter(error => !error.ruleId || error.ruleId === 'siren/same-core-dependency-version')
},
}
}
};