Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
320 changes: 70 additions & 250 deletions .all-contributorsrc

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ Relevant code or config

What you did:



What happened:

<!-- Please provide the full error message/screenshots/anything -->
Expand All @@ -38,6 +36,4 @@ minimal amount of code possible.

Problem description:



Suggested solution:
12 changes: 10 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,29 @@ merge of your pull request!
-->

<!-- What changes are being made? (What feature/bug is being fixed here?) -->

**What**:

<!-- Why are these changes necessary? -->

**Why**:

<!-- How were these changes implemented? -->

**How**:

<!-- Have you done all of these things? -->

**Checklist**:

<!-- add "N/A" to the end of each line that's irrelevant to your changes -->
<!-- to check an item, place an "x" in the box like so: "- [x] Documentation" -->

- [ ] Documentation
- [ ] Tests
- [ ] Ready to be merged <!-- In your opinion, is this ready to be merged as soon as it's reviewed? -->
- [ ] Added myself to contributors table <!-- this is optional, see the contributing guidelines for instructions -->
- [ ] Ready to be merged
<!-- In your opinion, is this ready to be merged as soon as it's reviewed? -->
- [ ] Added myself to contributors table
<!-- this is optional, see the contributing guidelines for instructions -->

<!-- feel free to add additional comments -->
36 changes: 18 additions & 18 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,37 @@
version: 2
updates:
# npm dependencies
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "monthly"
interval: 'monthly'
commit-message:
prefix: "chore"
prefix-development: "chore"
include: "scope"
prefix: 'chore'
prefix-development: 'chore'
include: 'scope'
groups:
production-dependencies:
dependency-type: "production"
dependency-type: 'production'
update-types:
- "minor"
- "patch"
- 'minor'
- 'patch'
development-dependencies:
dependency-type: "development"
dependency-type: 'development'
labels:
- "dependencies"
- 'dependencies'
open-pull-requests-limit: 10

- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: "monthly"
interval: 'monthly'
commit-message:
prefix: "chore"
include: "scope"
prefix: 'chore'
include: 'scope'
groups:
github-actions:
patterns:
- "*"
- '*'
labels:
- "github-actions"
- 'github-actions'
open-pull-requests-limit: 5
25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: '22'

- name: Install dependencies
run: npm install

- name: Run ESLint
run: npm run lint
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
1 change: 1 addition & 0 deletions .husky/pre-commit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I was in the area, I fixed up the Husky + lint-staged config. This should work to run lint-staged on precommits now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
123 changes: 123 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Development Documentation

## Linting

2026 update: The project is now using ESLint 9 and the flat config format. As we
Comment thread
lwasser marked this conversation as resolved.
Resolved
update things from the old config we will update this document to reflect the
changes. Once the code base is stable and things work, we can delete some of the
historical documentation. But for now this document can help us track design
decisions and changes made.

### Overview

The project uses a native ESLint configuration that was migrated from
kcd-scripts. The setup supports both CommonJS source files and ES module test
files, using ESLint 9's flat config format.

### What changed

Previously, the project used `kcd-scripts` for linting configuration. Because
that project is no longer actively maintained, we migrated to a native ESLint
setup that replicates the same behavior.

**Migration details:**

- Replaced `kcd-scripts lint` with native ESLint
- Created `eslint.config.mjs` using ESLint 9 flat config format
- Extracted rules from `eslint-config-kentcdodds` to create a simplified,
maintainable config. This included removing a lot of the custom rules and
leaning more on the recommended rules.
- Preserved some custom rule overrides from the original setup
- Supports both CommonJS (source files) and ES modules (test files)

Note: We should consider refacting the project to use ES modules instead of
CommonJS (if everyone supports that) in the future for consistency.

### How to run the linter

To check for linting errors you can run:

```bash
npm run lint
```

ESlint can automatically fix some errors. to fix errors automatically run:

```bash
npm run lint -- --fix
```

The `--fix` flag will automatically fix many common issues like:

- Jest method aliases (e.g., `toThrowError()` → `toThrow()`)
- Unused eslint-disable directives
- Some formatting issues

**Note:** Some errors require manual fixes (e.g., unused variables, tests
without assertions).

### Pre-commit hooks

The project uses Husky to run pre-commit hooks that automatically lint and fix
staged files before each commit.

**How it works:**

1. When you run `git commit`, Husky intercepts the commit
2. The pre-commit hook runs `lint-staged`
3. `lint-staged` runs `eslint --fix` on all staged JavaScript/TypeScript files
Comment thread
lwasser marked this conversation as resolved.
Resolved
4. If linting passes, the commit proceeds; if it fails, the commit is blocked

What this means... this workflow ensures that code is automatically linted and
fixed before it's committed to version control.

If you are encountering issues with the pre-commit hook, you can run the
following command to manually lint and fix the files:

```bash
npm run lint -- --fix
```

Or if it's really problematic, you can skip verification and commit anyway with
the `--no-verify` flag.

```bash
git commit --no-verify
```

If you do this please ping one of the maintainers in the PR that you open so
they can help you fix the issues!

**Configuration:**

- Husky configuration is in `package.json` under the `husky.hooks.pre-commit`
field
- `lint-staged` configuration is in `package.json` under the `lint-staged` field
- The setup uses the native ESLint configuration (`eslint.config.mjs`)

**Note:** Previously, the project used `kcd-scripts pre-commit` which handled
both hook management and linting. We migrated to using `lint-staged` directly
with our native ESLint config to avoid version conflicts.

### Dependencies

The following packages are typical starters for linting a JavaScript project:

- **eslint** — ESLint core
- **@eslint/js** — ESLint recommended rules configuration
- **eslint-plugin-import** — Import/export rules for module resolution and best
practices
- **eslint-plugin-jest** — Jest-specific rules for test files
- **globals** — Provides properly formatted global variables for Node.js and
Jest environments

### Configuration file

The ESLint configuration is in `eslint.config.mjs` at the project root. It uses
ESLint 9's flat config format and includes:

- Base rules from `eslint:recommended`
- Import plugin rules
- Jest plugin rules (for test files only)
- Custom overrides for project-specific needs
- Support for both CommonJS and ES module syntax
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->


- [
all-contributors-cli
](#all-contributors-cli)
- [ all-contributors-cli ](#all-contributors-cli)
- [The problem](#the-problem)
- [This solution](#this-solution)
- [Using the all-contributors-cli](#using-the-all-contributors-cli)
Expand Down
35 changes: 35 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import js from '@eslint/js'
import {defineConfig, globalIgnores} from 'eslint/config'
import importPlugin from 'eslint-plugin-import'
import jestPlugin from 'eslint-plugin-jest'
import globals from 'globals'

export default defineConfig([
globalIgnores(['coverage/**', 'dist/**']),
{linterOptions: {reportUnusedDisableDirectives: 'error'}},
{
extends: [js.configs.recommended, importPlugin.flatConfigs.recommended],
files: ['**/*.{mjs,js}'],
languageOptions: {
ecmaVersion: 'latest',
globals: globals.node,
},
rules: {
'import/no-unresolved': ['error', {ignore: ['^eslint/', '^prettier$']}],
'import/no-extraneous-dependencies': 'error',
'import/default': 'off',
'import/namespace': 'off',
},
},
{
extends: [jestPlugin.configs['flat/recommended']],
files: ['**/__tests__/**/*.js'],
languageOptions: {
globals: globals.jest,
},
rules: {
'jest/no-disabled-tests': 'error',
'jest/prefer-to-have-length': 'error',
},
},
])
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ module.exports = Object.assign(jestConfig, {
statements: 50,
},
},
forceExit: true
forceExit: true,
})
Loading