Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: htmlhint/HTMLHint
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.13.1
Choose a base ref
...
head repository: htmlhint/HTMLHint
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.14.0
Choose a head ref
  • 2 commits
  • 8 files changed
  • 2 contributors

Commits on May 31, 2020

  1. feat: use chalk instead of colors (#433)

    * chore: remove colors dependency
    
    * feat: add chalk dependency
    
    * feat: replace colors with chalk
    
    * fix: fix missing chalk usage
    
    * fix: re-enable color force
    Shinigami authored May 31, 2020

    Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    372dd60 View commit details
  2. chore(release): 0.14.0 [skip ci]

    # [0.14.0](v0.13.1...v0.14.0) (2020-05-31)
    
    ### Features
    
    * use chalk instead of colors ([#433](#433)) ([372dd60](372dd60))
    semantic-release-bot committed May 31, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8b88628 View commit details
Showing with 118 additions and 35 deletions.
  1. +7 −0 CHANGELOG.md
  2. +83 −15 package-lock.json
  3. +2 −2 package.json
  4. +2 −1 src/cli/formatter.ts
  5. +7 −5 src/cli/formatters/compact.ts
  6. +8 −4 src/cli/formatters/default.ts
  7. +7 −5 src/cli/formatters/unix.ts
  8. +2 −3 src/cli/htmlhint.ts
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [0.14.0](https://github.com/htmlhint/HTMLHint/compare/v0.13.1...v0.14.0) (2020-05-31)


### Features

* use chalk instead of colors ([#433](https://github.com/htmlhint/HTMLHint/issues/433)) ([372dd60](https://github.com/htmlhint/HTMLHint/commit/372dd605e1e4655a5ff4821fcfad9fef9edfb523))

## [0.13.1](https://github.com/htmlhint/HTMLHint/compare/v0.13.0...v0.13.1) (2020-05-31)


98 changes: 83 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "htmlhint",
"version": "0.13.1",
"version": "0.14.0",
"description": "The Static Code Analysis Tool for your HTML",
"repository": {
"type": "git",
@@ -59,7 +59,7 @@
},
"dependencies": {
"async": "3.2.0",
"colors": "1.4.0",
"chalk": "4.0.0",
"commander": "5.1.0",
"glob": "7.1.6",
"parse-glob": "3.0.4",
3 changes: 2 additions & 1 deletion src/cli/formatter.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as chalk from 'chalk'
import { EventEmitter } from 'events'
import { sync as globSync } from 'glob'
import { parse, resolve } from 'path'
@@ -94,7 +95,7 @@ formatter.setFormat = function (format) {

if (formatHandel === undefined) {
console.log(
'No supported formatter, supported formatters: %s'.red,
chalk.red('No supported formatter, supported formatters: %s'),
arrSupportedFormatters.join(', ')
)
process.exit(1)
12 changes: 7 additions & 5 deletions src/cli/formatters/compact.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as colors from 'colors'
import * as chalk from 'chalk'
import { FormatterCallback } from '../formatter'

const compactFormatter: FormatterCallback = function (
@@ -8,9 +8,8 @@ const compactFormatter: FormatterCallback = function (
) {
const nocolor = options.nocolor

if (nocolor !== false) {
colors.enable()
}
const chalkInstance =
nocolor !== false ? new chalk.Instance({ level: 1 }) : chalk

formatter.on('file', (event) => {
event.messages.forEach((message) => {
@@ -31,7 +30,10 @@ const compactFormatter: FormatterCallback = function (
if (allHintCount > 0) {
console.log('')
const message = '%d problems'
console.log(nocolor ? message : message.red, event.allHintCount)
console.log(
nocolor ? message : chalkInstance.red(message),
event.allHintCount
)
}
})
}
12 changes: 8 additions & 4 deletions src/cli/formatters/default.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as chalk from 'chalk'
import { FormatterCallback } from '../formatter'

const defaultFormatter: FormatterCallback = function (
@@ -14,12 +15,15 @@ const defaultFormatter: FormatterCallback = function (
formatter.on('config', (event) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const configPath = event.configPath!
console.log(' Config loaded: %s', nocolor ? configPath : configPath.cyan)
console.log(
' Config loaded: %s',
nocolor ? configPath : chalk.cyan(configPath)
)
console.log('')
})

formatter.on('file', (event) => {
console.log(` ${event.file.white}`)
console.log(` ${chalk.white(event.file)}`)

const arrLogs = HTMLHint.format(event.messages, {
colors: !nocolor,
@@ -43,15 +47,15 @@ const defaultFormatter: FormatterCallback = function (
if (allHintCount > 0) {
message = 'Scanned %d files, found %d errors in %d files (%d ms)'
console.log(
nocolor ? message : message.red,
nocolor ? message : chalk.red(message),
allFileCount,
allHintCount,
allHintFileCount,
time
)
} else {
message = 'Scanned %d files, no errors found (%d ms).'
console.log(nocolor ? message : message.green, allFileCount, time)
console.log(nocolor ? message : chalk.green(message), allFileCount, time)
}
})
}
12 changes: 7 additions & 5 deletions src/cli/formatters/unix.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as colors from 'colors'
import * as chalk from 'chalk'
import { FormatterCallback } from '../formatter'

const unixFormatter: FormatterCallback = function (
@@ -8,9 +8,8 @@ const unixFormatter: FormatterCallback = function (
) {
const nocolor = options.nocolor

if (nocolor !== false) {
colors.enable()
}
const chalkInstance =
nocolor !== false ? new chalk.Instance({ level: 1 }) : chalk

formatter.on('file', (event) => {
event.messages.forEach((message) => {
@@ -30,7 +29,10 @@ const unixFormatter: FormatterCallback = function (
if (allHintCount > 0) {
console.log('')
const message = '%d problems'
console.log(nocolor ? message : message.red, event.allHintCount)
console.log(
nocolor ? message : chalkInstance.red(message),
event.allHintCount
)
}
})
}
5 changes: 2 additions & 3 deletions src/cli/htmlhint.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

import { queue as asyncQueue, series as asyncSeries } from 'async'
import 'colors'
import * as chalk from 'chalk'
import * as program from 'commander'
import { existsSync, readFileSync, statSync } from 'fs'
import * as glob from 'glob'
@@ -112,8 +112,7 @@ function listRules() {

for (const id in rules) {
rule = rules[id]
// eslint-disable-next-line @typescript-eslint/unbound-method
console.log(' %s : %s', rule.id.bold, rule.description)
console.log(' %s : %s', chalk.bold(rule.id), rule.description)
}
}