Skip to content

Commit

Permalink
refactor: use path.sep simplify htmlhint#443
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Jun 26, 2020
1 parent b147172 commit a406184
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/cli/htmlhint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as program from 'commander'
import { existsSync, readFileSync, statSync } from 'fs'
import * as glob from 'glob'
import { IGlob } from 'glob'
import { type as osType } from 'os'
import * as parseGlob from 'parse-glob'
import { dirname, resolve, sep } from 'path'
import * as request from 'request'
Expand All @@ -20,8 +19,6 @@ const formatter: Formatter = require('./formatter')

const pkg = require('../../package.json')

const OS_TYPE = osType()

function map(val: string) {
const objMap: { [name: string]: string | true } = {}
val.split(',').forEach((item) => {
Expand Down Expand Up @@ -450,8 +447,8 @@ function walkPath(
walk.on('match', (file: string) => {
base = base.replace(/^.\//, '')

if (OS_TYPE === 'Windows_NT') {
base = base.replace(/\//g, '\\')
if (sep !== '/') {
base = base.replace(/\//g, sep)
}

callback(base + file)
Expand Down

0 comments on commit a406184

Please sign in to comment.