Skip to content

Commit ef3f0fb

Browse files
committed
code formatting
1 parent 2d503cc commit ef3f0fb

File tree

5 files changed

+32
-22
lines changed

5 files changed

+32
-22
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ be escaped or unescaped.
155155
Un-escape a glob string that may contain some escaped characters.
156156

157157
If the `windowsPathsNoEscape` option is used, then square-brace
158-
escapes are removed, but not backslash escapes. For example, it
158+
escapes are removed, but not backslash escapes. For example, it
159159
will turn the string `'[*]'` into `*`, but it will not turn
160160
`'\\*'` into `'*'`, because `\` is a path separator in
161161
`windowsPathsNoEscape` mode.

src/walker.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,10 @@ export abstract class GlobUtil<O extends GlobWalkerOpts = GlobWalkerOpts> {
201201
this.matchEmit(e.fullpath() + mark)
202202
} else {
203203
const rel = e.relative()
204-
const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep)
205-
? '.' + this.#sep : ''
204+
const pre =
205+
this.opts.dotRelative && !rel.startsWith('..' + this.#sep)
206+
? '.' + this.#sep
207+
: ''
206208
this.matchEmit(!rel && mark ? '.' + mark : pre + rel + mark)
207209
}
208210
}

test/dot-relative.ts

+15-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import t from 'tap'
22
import { Glob } from '../'
33
import { bashResults } from './bash-results'
4-
import {resolve, sep} from 'path'
4+
import { resolve, sep } from 'path'
55

66
const pattern = 'a/b/**'
77
process.chdir(__dirname + '/fixtures')
@@ -39,19 +39,22 @@ for (const mark of marks) {
3939
}
4040
})
4141

42-
t.test('does not prefix with ./ unless dotRelative is true', async t => {
43-
const g = new Glob(pattern, {})
44-
const results = await g.walk()
42+
t.test(
43+
'does not prefix with ./ unless dotRelative is true',
44+
async t => {
45+
const g = new Glob(pattern, {})
46+
const results = await g.walk()
4547

46-
t.equal(
47-
results.length,
48-
bashResults[pattern].length,
49-
'must match all files'
50-
)
51-
for (const m of results) {
52-
t.ok(mark && m === '.' + sep || !m.startsWith('.' + sep))
48+
t.equal(
49+
results.length,
50+
bashResults[pattern].length,
51+
'must match all files'
52+
)
53+
for (const m of results) {
54+
t.ok((mark && m === '.' + sep) || !m.startsWith('.' + sep))
55+
}
5356
}
54-
})
57+
)
5558
})
5659
}
5760

test/escape.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ for (const pattern of Object.keys(bashResults)) {
66
t.notOk(hasMagic(escape(pattern)), `escape(${pattern})`)
77
const pp = escape(pattern)
88
const pw = escape(pattern, {
9-
windowsPathsNoEscape: true
9+
windowsPathsNoEscape: true,
1010
})
11-
t.notOk(hasMagic(pp, { platform: 'linux' }), 'no magic after posix escape')
12-
t.notOk(hasMagic(pw, { platform: 'win32', windowsPathsNoEscape: true }),
13-
'no magic after windows escape')
11+
t.notOk(
12+
hasMagic(pp, { platform: 'linux' }),
13+
'no magic after posix escape'
14+
)
15+
t.notOk(
16+
hasMagic(pw, { platform: 'win32', windowsPathsNoEscape: true }),
17+
'no magic after windows escape'
18+
)
1419
const up = unescape(pp)
1520
const uw = unescape(pw, { windowsPathsNoEscape: true })
1621
t.equal(up, pattern, 'unescaped posix pattern returned')

test/url-cwd.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import t from 'tap'
2-
import {pathToFileURL} from 'url'
3-
import {Glob} from '../'
2+
import { pathToFileURL } from 'url'
3+
import { Glob } from '../'
44

55
t.test('can use file url as cwd option', t => {
66
const fileURL = pathToFileURL(process.cwd())
77
const fileURLString = String(fileURL)
8-
const ps = new Glob('.', { cwd: process.cwd()})
8+
const ps = new Glob('.', { cwd: process.cwd() })
99
const pu = new Glob('.', { cwd: fileURL })
1010
const pus = new Glob('.', { cwd: fileURLString })
1111
t.equal(ps.cwd, process.cwd())

0 commit comments

Comments
 (0)