open-index/open-npm huggingface dataset:
npm package: @humanwhocodes/eslint-simple-rule
Description: A utility to create dead-simple ESLint rules.
Author: Nicholas C. Zakas
Latest version: 0.1.1

# ESLint Simple Rule

by [Nicholas C. Zakas](https://humanwhocodes.com)

If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate).

## Description

ESLint rules require some boilerplate that ranges from trivial to complicated depending on what type of rule you're trying to create. This utility helps create ESLint rules with as little boilerplate as possible and is designed for creating the simplest of rules: those that simply flag some syntax as a problem and doesn't try to fix it. The goal is to allow anyone to create custom rules faster and with less code than with using the built-in ESLint rule syntax.

## Usage

### Node.js

Install using [npm][npm] or [yarn][yarn]:

```
npm install @humanwhocodes/eslint-simple-rule --save

# or

yarn add @humanwhocodes/eslint-simple-rule
```

Import into your Node.js project:

```js
// CommonJS
const { rule } = require("@humanwhocodes/eslint-simple-rule");

// ESM
import { rule } from "@humanwhocodes/eslint-simple-rule";
```

### Deno

Import into your Deno project:

```js
import { rule } from "https://unpkg.com/@humanwhocodes/eslint-simple-rule/dist/rule.js";
```

### Browser

It's recommended to import the minified version to save bandwidth:

```js
import { rule } from "https://unpkg.com/@humanwhocodes/eslint-simple-rule/dist/rule.min.js";
```

However, you can also import the unminified version for debugging purposes:

```js
import { rule } from "https://unpkg.com/@humanwhocodes/eslint-simple-rule/dist/rule.js";
```

## API

After importing, you can create a new rule by using the `rule()` function and passing in an object literal where the keys are [esquery selectors](https://eslint.org/docs/developer-guide/selectors) indicating the node to warn on and the values are the messages to display in ESLint when a node matches the selector:

```js
export default rule({

    // warn whenever "null" is used
    "Literal[raw=\"null\"]": "Do not use null.",

    // warn whenever a "var" declaration is used
    "VariableDeclaration[kind=var]": "Use either 'let' or 'const' instead of 'var'."
});
```

Or if you are using CommonJS:

```js
module.exports = rule({

    // warn whenever "null" is used
    "Literal[raw=\"null\"]": "Do not use null.",

    // warn whenever a "var" declaration is used
    "VariableDeclaration[kind=var]": "Use either 'let' or 'const' instead of 'var'."
});
```
npm package: @humanwhocodes/github-comment
Description: A CLI for commenting on GitHub issues and pull requests
Author: Nicholas C. Zaks
Latest version: 0.1.0

# GitHub Comment CLI

by [Nicholas C. Zakas](https://humanwhocodes.com)

![Node CI](https://github.com/humanwhocodes/github-comment/workflows/Node%20CI/badge.svg)

If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate).

## Description

A simple CLI for posting comments to GitHub. This is intended for use in CI systems such as GitHub actions in order to enable to Twitter notifications of important events.

## Usage

You must have Node.js to use this package.

Next, define your environment variable:

* `GITHUB_TOKEN` - your GitHub access token. Make sure you have at least the `public_repo` scope to allow commenting on both issues and pull requests.

The CLI will not work without this environment variable.

Then, you can run the CLI and pass a message on the command line using `npx`:

```
$ npx @humanwhocodes/github-comment owner/repo#1234 "Hello from the command line!"
```

Where `owner/repo#1234` is the issue or pull request that you'd like to comment on.

### Testing with dotenv

If you'd like to test with [`dotenv`](https://npmjs.com/package/dotenv), define an additional environment variable `GHC_DOTENV=1` before executing the CLI. This will cause a local `.env` file to be read before executing.

### Using in a GitHub Workflow

Be sure to set up [GitHub secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) for each environment variable. Then, you can configure a job like this:

```yaml
jobs:
  tweet:
    name: Comment Something
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-node@v1
        with:
          node-version: 12
      - run: 'npx @humanwhocodes/github-comment owner/repo#1234 "Your comment text"'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

### Developer Setup

1. Ensure you have [Node.js](https://nodejs.org) 12+ installed
2. Fork and clone this repository
3. Run `npm install`
4. Run `npm test` to run tests

## License and Copyright

This code is licensed under the Apache 2.0 License (see LICENSE for details).

Copyright Human Who Codes LLC. All rights reserved.
npm package: @humanwhocodes/gitignore-to-minimatch
Description: Utility to convert gitignore patterns to minimatch patterns
Author: Nicholas C. Zaks
Latest version: 1.0.2

# Gitignore to Minimatch Utility

by [Nicholas C. Zakas](https://humanwhocodes.com)

If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate).

## Description

A function that converts a [gitignore](https://git-scm.com/docs/gitignore#_pattern_format) pattern into a [minimatch](https://github.com/isaacs/minimatch) pattern. There are subtle differences between these two formats, and depending on the utilities you're using, you may need one or the other.

## Usage

### Node.js

Install using [npm][npm] or [yarn][yarn]:

```
npm install @humanwhocodes/gitignore-to-minimatch --save

# or

yarn add @humanwhocodes/gitignore-to-minimatch
```

Import into your Node.js project:

```js
// CommonJS
const { gitignoreToMinimatch } = require("@humanwhocodes/gitignore-to-minimatch");

// ESM
import { gitignoreToMinimatch } from "@humanwhocodes/gitignore-to-minimatch";
```

### Deno

Import into your Deno project:

```js
import { gitignoreToMinimatch } from "https://cdn.skypack.dev/@humanwhocodes/gitignore-to-minimatch?dts";
```

### Browser

It's recommended to import the minified version to save bandwidth:

```js
import { gitignoreToMinimatch } from "https://cdn.skypack.dev/@humanwhocodes/gitignore-to-minimatch?min";
```

However, you can also import the unminified version for debugging purposes:

```js
import { gitignoreToMinimatch } from "https://cdn.skypack.dev/@humanwhocodes/gitignore-to-minimatch";
```

## API

After importing, call `gitignoreToMinimatch` with a string argument, like this:

```js
const minimatchPattern = gitignoreToMinimatch("foo");
console.log(minimatchPattern);      // "**/foo"
```

## Developer Setup

1. Fork the repository
2. Clone your fork
3. Run `npm install` to setup dependencies
4. Run `npm test` to run tests

## License

Apache 2.0

[npm]: https://npmjs.com/
[yarn]: https://yarnpkg.com/
npm package: @humanwhocodes/guarded-fetch
Description: A wrapper around fetch() that catches errors and returns them in a consistent format
Author: Nicholas C. Zaks
Latest version: 1.0.0

# Guarded Fetch

by [Nicholas C. Zakas](https://humanwhocodes.com)

If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate).

## Description

A wrapper around `fetch()` that catches errors and returns them in a consistent format. Instead of using `try-catch` blocks, you can use `guardedFetch()` which always returns an object with `response` and `error` properties.

## Installation

```shell
npm install @humanwhocodes/guarded-fetch
```

## Usage

### Using guardedFetch (with global fetch)

The `guardedFetch` function is a wrapped version of the global `fetch()` function:

```js
import { guardedFetch } from "@humanwhocodes/guarded-fetch";

// Successful request
const { response, error } = await guardedFetch("https://api.example.com/data");
if (error) {
	console.error("Fetch failed:", error);
} else {
	console.log("Response:", response);
}

// Failed request (network error)
const { response: response2, error: error2 } = await guardedFetch("https://invalid-domain.example");
if (error2) {
	console.error("Fetch failed:", error2); // Error will be defined
}

// HTTP error (like 404)
const { response: response3, error: error3 } = await guardedFetch("https://api.example.com/not-found");
if (error3) {
	console.error("Fetch failed:", error3);
} else if (!response3.ok) {
	console.log("HTTP error:", response3.status);
}
```

### Using createGuardedFetch (with custom fetch)

You can wrap any `fetch()` implementation using `createGuardedFetch()`:

```js
import { createGuardedFetch } from "@humanwhocodes/guarded-fetch";
import nodeFetch from "node-fetch";

const guardedNodeFetch = createGuardedFetch(nodeFetch);

const { response, error } = await guardedNodeFetch("https://api.example.com/data");
if (error) {
	console.error("Fetch failed:", error);
} else {
	console.log("Response:", response);
}
```

### Return Value

Both `guardedFetch()` and the function returned by `createGuardedFetch()` return a promise that resolves to an object with the following properties:

- `response` - The `Response` object if the fetch was successful, or `undefined` if an error occurred
- `error` - Any error thrown by `fetch()` (type: `any`), or `undefined` if the fetch was successful

Note: HTTP errors (like 404 or 500) are NOT treated as errors by `fetch()`. You need to check `response.ok` or `response.status` to handle HTTP errors.

## License

Copyright 2025 Nicholas C. Zakas

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.