Skip to content

Commit 50b9fef

Browse files
committed
Refactor: use path.sep simplify htmlhint#443
1 parent b147172 commit 50b9fef

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/cli/htmlhint.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import * as program from 'commander'
66
import { existsSync, readFileSync, statSync } from 'fs'
77
import * as glob from 'glob'
88
import { IGlob } from 'glob'
9-
import { type as osType } from 'os'
109
import * as parseGlob from 'parse-glob'
1110
import { dirname, resolve, sep } from 'path'
1211
import * as request from 'request'
@@ -20,8 +19,6 @@ const formatter: Formatter = require('./formatter')
2019

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

23-
const OS_TYPE = osType()
24-
2522
function map(val: string) {
2623
const objMap: { [name: string]: string | true } = {}
2724
val.split(',').forEach((item) => {
@@ -450,8 +447,8 @@ function walkPath(
450447
walk.on('match', (file: string) => {
451448
base = base.replace(/^.\//, '')
452449

453-
if (OS_TYPE === 'Windows_NT') {
454-
base = base.replace(/\//g, '\\')
450+
if (sep !== '/') {
451+
base = base.replace(/\//g, sep)
455452
}
456453

457454
callback(base + file)

0 commit comments

Comments
 (0)