Skip to content

Commit

Permalink
Merge pull request #1195 from paulmillr/v4
Browse files Browse the repository at this point in the history
Version 4: Typescript, ESM, glob removal, drop node <18
  • Loading branch information
paulmillr authored Jul 1, 2024
2 parents 7c50e25 + 6f715a9 commit 064e47d
Show file tree
Hide file tree
Showing 23 changed files with 3,555 additions and 7,074 deletions.
50 changes: 0 additions & 50 deletions .eslintrc

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,3 @@ jobs:

- name: Run lint
run: npm run lint

- name: Run dtslint
run: npm run dtslint
21 changes: 6 additions & 15 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,21 @@ env:

jobs:
test:
name: Node.js ${{ matrix.node }} @ ${{ matrix.os }}
name: Node.js ${{ matrix.version }} @ ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node: [8, 10, 12, 14, 16]
os: [ubuntu-latest]
include:
- os: windows-latest
node: 8
- os: windows-latest
node: 14
- os: macOS-latest
node: 8
- os: macOS-latest
node: 14
version: [18, 20, 22]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: npm install
- name: Run mocha tests
run: npm run mocha
run: npm run test
22 changes: 22 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v9
with:
days-before-issue-stale: 30
days-before-issue-close: 14
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/node_modules/
/test-fixtures/
/package-lock.json
/lib
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ chokidar.watch('.').on('all', (event, path) => {
// Example of a more typical implementation structure

// Initialize watcher.
const watcher = chokidar.watch('file, dir, glob, or array', {
const watcher = chokidar.watch('file, dir, or array', {
ignored: /(^|[\/\\])\../, // ignore dotfiles
persistent: true
});
Expand Down Expand Up @@ -130,7 +130,6 @@ chokidar.watch('file', {
ignoreInitial: false,
followSymlinks: true,
cwd: '.',
disableGlobbing: false,

usePolling: false,
interval: 100,
Expand All @@ -151,12 +150,7 @@ chokidar.watch('file', {
`chokidar.watch(paths, [options])`

* `paths` (string or array of strings). Paths to files, dirs to be watched
recursively, or glob patterns.
- Note: globs must not contain windows separators (`\`),
because that's how they work by the standard —
you'll need to replace them with forward slashes (`/`).
- Note 2: for additional glob documentation, check out low-level
library: [picomatch](https://github.com/micromatch/picomatch).
recursively.
* `options` (object) Options object as defined below:

#### Persistence
Expand All @@ -182,8 +176,6 @@ symlinks themselves will be watched for changes instead of following
the link references and bubbling events through the link's path.
* `cwd` (no default). The base directory from which watch `paths` are to be
derived. Paths emitted with events will be relative to this.
* `disableGlobbing` (default: `false`). If set to `true` then the strings passed to `.watch()` and `.add()` are treated as
literal path names, even if they look like globs.

#### Performance

Expand Down Expand Up @@ -247,14 +239,14 @@ milliseconds.

`chokidar.watch()` produces an instance of `FSWatcher`. Methods of `FSWatcher`:

* `.add(path / paths)`: Add files, directories, or glob patterns for tracking.
* `.add(path / paths)`: Add files, directories for tracking.
Takes an array of strings or just one string.
* `.on(event, callback)`: Listen for an FS event.
Available events: `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `ready`,
`raw`, `error`.
Additionally `all` is available which gets emitted with the underlying event
name and path for every event other than `ready`, `raw`, and `error`. `raw` is internal, use it carefully.
* `.unwatch(path / paths)`: Stop watching files, directories, or glob patterns.
* `.unwatch(path / paths)`: Stop watching files or directories.
Takes an array of strings or just one string.
* `.close()`: **async** Removes all listeners from watched files. Asynchronous, returns Promise. Use with `await` to ensure bugs don't happen.
* `.getWatched()`: Returns an object representing all the paths on the file
Expand Down
34 changes: 34 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import eslintjs from '@eslint/js';
import globals from 'globals';
import {configs as tseslintConfigs} from 'typescript-eslint';

const {configs: eslintConfigs} = eslintjs;
const files = ['test.mjs', 'src/**/*.ts'];

export default [
{
files,
linterOptions: {
reportUnusedDisableDirectives: 'error'
},
languageOptions: {
globals: {
...globals.node
}
}
},
{
...eslintConfigs.recommended,
files
},
...tseslintConfigs.strict.map((config) => ({
...config,
files
})),
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-dynamic-delete': 'off'
}
}
];
Loading

0 comments on commit 064e47d

Please sign in to comment.