-
Notifications
You must be signed in to change notification settings - Fork 0
/
lint
executable file
·35 lines (29 loc) · 992 Bytes
/
lint
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
#!/usr/bin/env node
'use strict'
require('colors')
const lintCoffeeScriptPaths = require('./lib/lint-coffee-script-paths')
const lintJavaScriptPaths = require('./lib/lint-java-script-paths')
const lintLessPaths = require('./lib/lint-less-paths')
const path = require('path')
const CONFIG = require('./config')
process.on('unhandledRejection', function (e) {
console.error(e.stack || e)
process.exit(1)
})
Promise.all([lintCoffeeScriptPaths(), lintJavaScriptPaths(), lintLessPaths()])
.then((lintResults) => {
let hasLintErrors = false
for (let errors of lintResults) {
for (let error of errors) {
hasLintErrors = true
const relativePath = path.relative(CONFIG.repositoryRootPath, error.path)
console.log(`${relativePath}:${error.lineNumber}`.yellow + ` ${error.message} (${error.rule})`.red)
}
}
if (hasLintErrors) {
process.exit(1)
} else {
console.log('No lint errors!'.green)
process.exit(0)
}
})