Skip to content

Commit

Permalink
README.md: upgrade guide for 5.x -> 6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
kaelzhang committed Oct 30, 2024
1 parent 325d8d5 commit eeec3cc
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,16 @@ interface TestResult {
- `{ignored: false, unignored: true}`: the `pathname` is unignored
- `{ignored: false, unignored: false}`: the `pathname` is never matched by any ignore rules.

## static `ignore.isPathValid(pathname): boolean` since 5.0.0
## static `isPathValid(pathname): boolean` since 5.0.0

Check whether the `pathname` is an valid `path.relative()`d path according to the [convention](#1-pathname-should-be-a-pathrelatived-pathname).

This method is **NOT** used to check if an ignore pattern is valid.

```js
ignore.isPathValid('./foo') // false
import {isPathValid} from 'ignore'

isPathValid('./foo') // false
```

## ignore(options)
Expand Down Expand Up @@ -344,6 +346,20 @@ ignore({

# Upgrade Guide

## Upgrade 5.x -> 6.x

To bring better compatibility for TypeScript with `moduleResolution:Node16`, `ignore.isPathValid` has been removed in TypeScript definitions since `6.x`

```js
// < 6, or works with commonjs
ignore.isPathValid('./foo') // false

// >= 6.x
import {isPathValid} from 'ignore'

isPathValid('./foo') // false
```

## Upgrade 4.x -> 5.x

Since `5.0.0`, if an invalid `Pathname` passed into `ig.ignores()`, an error will be thrown, unless `options.allowRelative = true` is passed to the `Ignore` factory.
Expand Down Expand Up @@ -379,7 +395,7 @@ const paths = [
// valid
'foo'
]
.filter(isValidPath)
.filter(isPathValid)

ig.filter(paths)
```
Expand Down

0 comments on commit eeec3cc

Please sign in to comment.