Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Commit

Permalink
fix: relax no-console (#36)
Browse files Browse the repository at this point in the history
allows:

```ts
console.info()
console.warn()
console.error()
```

These 3 have their semantic meaning and can be used in production code.
  • Loading branch information
unional authored Apr 14, 2018
1 parent ff26ddd commit f7b591f
Show file tree
Hide file tree
Showing 19 changed files with 278 additions and 2,538 deletions.
14 changes: 7 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ function negativeTest(config, severity = 'error') {
return through(function (file) {
const filename = path.basename(file.history[0])
const matches = new RegExp(`(.*)\\.(\\d*)\\.${severity}\\.ts`).exec(filename)
if (!matches)
throw new Error(`Unable to process '${filename}'. Missing number of ${severity}s expected?`)
const ruleName = matches[1]
const count = matches[2]
const rules = file.tslint.failures.filter(f => f.ruleName === ruleName && f.ruleSeverity === severity)
if (rules.length === 0) {
errMsg = `[${gutil.colors.cyan(config)}] ${gutil.colors.red(`${filename} did not trigger '${ruleName}'`)}`
}
else if (rules.length != count) {
errMsg = `[${gutil.colors.cyan(config)}] ${gutil.colors.red(`${filename} expected ${failCount} violation of '${ruleId}' but received ${rules.length}`)}`
errMsg = `[${gutil.colors.cyan(config)}] ${gutil.colors.red(`${filename} expected ${count} violation of '${ruleName}' but received ${rules.length}`)}`
}
else {
const unexpectedRules = uniq(file.tslint.failures.filter(f => f.ruleName !== ruleName).map(f => `'${f.ruleName}'`))
Expand All @@ -57,21 +59,19 @@ function negativeTest(config, severity = 'error') {
function buildTasks(styles) {
const entries = [];
styles.forEach(s => {
const p = `tslint-${s}-positive`;
const p = `${s}-pass`;
entries.push(p);
gulp.task(p, () => positiveTest(s));

const e = `tslint-${s}-error`;
const e = `${s}-error`;
entries.push(e);
gulp.task(e, () => negativeTest(s));

const w = `tslint-${s}-warning`;
const w = `${s}-warning`;
entries.push(w);
gulp.task(w, () => negativeTest(s, 'warning'));
});
return entries;
}

gulp.task('tslint', buildTasks(['index', 'standard', 'semi-standard', 'strict']));

gulp.task('default', ['tslint']);
gulp.task('default', buildTasks(['index', 'standard', 'semi-standard', 'strict']));
2 changes: 0 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ module.exports = {
"assert",
"count",
"log",
"warn",
"trace",
"error",
"debug"
]
},
Expand Down
14 changes: 0 additions & 14 deletions index.json

This file was deleted.

Loading

0 comments on commit f7b591f

Please sign in to comment.