forked from rtfpessoa/codacy-remark-lint
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.ts
32 lines (27 loc) · 805 Bytes
/
index.ts
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
#!/usr/bin/env node
import run, { isCodacyIssue } from './lib/remark-runner';
import { isPatternDisabled } from './patterns/disabledPatterns';
/* tslint:disable:no-expression-statement*/
run().then(
(results) => {
results
.filter((result) => {
if (isCodacyIssue(result)) {
// filter out patterns that are in the list of disabled patterns
return !isPatternDisabled(result.patternId);
} else {
// does not filter out any file error
return true;
}
})
.forEach((result) => {
process.stdout.write(`${JSON.stringify(result)}\n`);
});
process.exit(0);
},
(reason) => {
process.stderr.write(`${JSON.stringify(reason)}\n`);
process.exit(1);
}
);
/* tslint:enable:no-expression-statement*/