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
12 changes: 4 additions & 8 deletions .github/ISSUE_TEMPLATE/01-bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ labels:
body:
- type: checkboxes
attributes:
description:
If any of these required steps are not taken, we may not be able to
description: If any of these required steps are not taken, we may not be able to
review your issue. Help us to help you!
label: Bug Report Checklist
options:
- label:
I have [searched for related
- label: I have [searched for related
issues](https://github.com/all-contributors/cli/issues?q=is%3Aissue)
and found none that matched my issue.
required: true
Expand All @@ -29,8 +27,7 @@ body:
required: true
- type: textarea
attributes:
description:
Steps to Reproduce the bug. Please provide a minimal reproducible
description: Steps to Reproduce the bug. Please provide a minimal reproducible
example if possible.
label: Steps to Reproduce
validations:
Expand All @@ -51,8 +48,7 @@ body:
required: false
- type: input
attributes:
description:
If possible, please create a repository that reproduces the issue with
description: If possible, please create a repository that reproduces the issue with
the minimal amount of code possible.
label: Minimal Reproduction
placeholder: https://github.com/user/repo
Expand Down
6 changes: 2 additions & 4 deletions .github/ISSUE_TEMPLATE/02-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ labels:
body:
- type: checkboxes
attributes:
description:
If any of these required steps are not taken, we may not be able to
description: If any of these required steps are not taken, we may not be able to
review your issue. Help us to help you!
label: Documentation Report Checklist
options:
- label: I have checked the latest `main` branch of the repository.
required: true
- label:
I have [searched for related
- label: I have [searched for related
issues](https://github.com/all-contributors/cli/issues?q=is%3Aissue)
and found none that matched my issue.
required: true
Expand Down
6 changes: 2 additions & 4 deletions .github/ISSUE_TEMPLATE/03-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ labels:
body:
- type: checkboxes
attributes:
description:
If any of these required steps are not taken, we may not be able to
description: If any of these required steps are not taken, we may not be able to
review your issue. Help us to help you!
label: Feature Request Checklist
options:
- label:
I have [searched for related
- label: I have [searched for related
issues](https://github.com/all-contributors/cli/issues?q=is%3Aissue)
and found none that matched my issue.
required: true
Expand Down
6 changes: 2 additions & 4 deletions .github/ISSUE_TEMPLATE/04-tooling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ labels:
body:
- type: checkboxes
attributes:
description:
If any of these required steps are not taken, we may not be able to
description: If any of these required steps are not taken, we may not be able to
review your issue. Help us to help you!
label: Tooling Report Checklist
options:
- label: I have pulled the latest `main` branch of the repository.
required: true
- label:
I have [searched for related
- label: I have [searched for related
issues](https://github.com/all-contributors/cli/issues?q=is%3Aissue)
and found none that matched my issue.
required: true
Expand Down
6 changes: 2 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ merge of your pull request!

- [ ] 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 -->
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ on:
workflow_dispatch: ~

jobs:
format-check:
format_check:
name: Format Check
runs-on: ubuntu-latest
steps:
- uses: $/.github/actions/setup
- run: npm run format:check
- run: npm run format -- --list-different

lint:
name: Lint
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ jobs:
publish:
name: >-
Publish cli 📦 to NPM
if:
github.repository_owner == 'all-contributors' && github.event_name ==
if: github.repository_owner == 'all-contributors' && github.event_name ==
'release'
needs:
- end-to-end
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ dist
# when working with contributors
.husky
.idea
.vscode
cache
pnpm-lock.yaml
yarn.lock
4 changes: 0 additions & 4 deletions .prettierignore

This file was deleted.

20 changes: 0 additions & 20 deletions .prettierrc

This file was deleted.

8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"oxc.oxc-vscode",
"vitest.explorer",
"webpro.vscode-knip"
]
}
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.formatOnSave": true,
"editor.rulers": [100],
"eslint.probe": [
"javascript",
"javascriptreact",
"json",
"jsonc",
"markdown",
"typescript",
"typescriptreact",
"yaml"
]
}
75 changes: 27 additions & 48 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ These are the npm scripts available when working on the CLI:
| `npm run build` | Build the CLI (output in `dist/`) |
| `npm run dev` | Run the CLI from source without building |
| `npm run start` | Run the built CLI (`dist/cli.js`) |
| `npm run lint` | Fix format issues |
| `npm run format:check` | Check for format issues |
| `npm run format` | Fix format issues |
| `npm run lint` | Check for lint issues |
| `npm run lint -- --fix` | Fix lint issues |
| `npm test` | Run the test suite (no coverage) |
Expand Down Expand Up @@ -111,73 +110,53 @@ You don't need a Codecov account to view coverage locally. Run
`npm run test:coverage` and open the HTML report. Codecov is mainly for tracking
trends and CI.

## Linting
## Static Checks

The project uses ESLint. Linting was migrated from `kcd-scripts` to a native
ESLint setup that supports both CommonJS source files and ES module test files.
The project has several forms of static analysis.

### Overview
### Format

- Config: `eslint.config.mjs`
- Includes `eslint:recommended`, import rules, Vitest rules for test files, and
project overrides
We use Oxfmt for formatting.
Use `format` to reformat.

### How to run the linter
```sh
npm run format
```

To check for issues you can run:
> [!NOTE]
> Be sure to install the `Oxc` extension to get the most out of Oxfmt.

```bash
### Lint

We use ESLint as our primary linter.
You can check for violations with:

```sh
npm run lint
```

To auto-fix what ESLint and Prettier can fix you can run:
To automatically address what ESLint can fix for you, run:

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

This will fix many issues (e.g. Vitest aliases, unused eslint-disable
directives, formatting). Some problems still need manual fixes (e.g. unused
variables, tests without assertions).
directives, formatting).
Some problems still need manual fixes (e.g. unused variables, tests without assertions).

### Pre-commit hooks

Husky runs a pre-commit hook that lints and fixes staged files before each
commit.

1. On `git commit`, Husky runs the pre-commit hook.
2. The hook runs `lint-staged`, which runs ESLint and Prettier on staged
JavaScript files.
3. If that passes, the commit continues; if it fails, the commit is blocked.
`simple-git-hooks` runs a pre-commit hook that reformats staged files before each commit.

If the hook gives you trouble, run `npm run lint-fix` manually, then try
committing again. As a last resort you can skip the hook with
`git commit --no-verify`; if you do, mention it in your PR so maintainers can
help.
On `git commit`, `simple-git-hooks` runs the pre-commit hook.
The hook runs `lint-staged`, which runs Oxfmt on all staged files.

**Configuration:**

- The hook lives in `.husky/pre-commit` (it runs `npx lint-staged`).
- The hook is configured on `simple-git-hooks` in the `package.json`.
- `lint-staged` is configured in `package.json` under the `lint-staged` field.
- Linting uses `eslint.config.mjs`.

### Lint-related dependencies

- **eslint** — Core
- **@eslint/js** — Recommended rules
- **eslint-plugin-import** — Import/export rules
- **@vitest/eslint-plugin** — Vitest rules for test files
- **globals** — Node and Vitest globals for the lint environment

## Build system

The build uses native Babel (migrated from `kcd-scripts build`). Key
dependencies:

- **@babel/core** — Compiler (parse, transform, generate)
- **@babel/cli** — Runs `babel src --out-dir dist`
- **@babel/preset-env** — Compiles modern JS for the target (e.g. Node 22)
- **@babel/runtime** — Runtime helpers used by the transpiled code
- Linting uses `eslint.config.js`.

### How to build

Expand Down
48 changes: 18 additions & 30 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,36 @@
import js from '@eslint/js'
import markdown from '@eslint/markdown'
import vitestPlugin from '@vitest/eslint-plugin'
import {importX} from 'eslint-plugin-import-x'
import jsonc from 'eslint-plugin-jsonc'
import packageJson from 'eslint-plugin-package-json'
import perfectionist from 'eslint-plugin-perfectionist'
import yml from 'eslint-plugin-yml'
import {defineConfig, globalIgnores} from 'eslint/config'
import globals from 'globals'
import js from '@eslint/js';
import markdown from '@eslint/markdown';
import vitestPlugin from '@vitest/eslint-plugin';
import { importX } from 'eslint-plugin-import-x';
import jsonc from 'eslint-plugin-jsonc';
import packageJson from 'eslint-plugin-package-json';
import perfectionist from 'eslint-plugin-perfectionist';
import yml from 'eslint-plugin-yml';
import { defineConfig, globalIgnores } from 'eslint/config';
import globals from 'globals';

export default defineConfig([
globalIgnores([
'coverage/**',
'dist/**',
'.all-contributorsrc',
'CHANGELOG*',
]),
{linterOptions: {reportUnusedDisableDirectives: 'error'}},
globalIgnores(['coverage/**', 'dist/**', '.all-contributorsrc', 'CHANGELOG*']),
{ linterOptions: { reportUnusedDisableDirectives: 'error' } },
{
extends: [js.configs.recommended, importX.flatConfigs.recommended],
files: ['**/*.{mjs,js}'],
languageOptions: {
ecmaVersion: 'latest',
globals: globals.node,
},
plugins: {perfectionist},
plugins: { perfectionist },
rules: {
'import-x/no-unresolved': [
'error',
{ignore: ['^eslint/', '^prettier$', '^yargs']},
],
'import-x/no-unresolved': ['error', { ignore: ['^eslint/', '^prettier$', '^yargs'] }],
'import-x/no-extraneous-dependencies': 'error',
'import-x/default': 'off',
'import-x/namespace': 'off',
'import-x/no-named-as-default-member': 'off',
'perfectionist/sort-exports': 'error',
'perfectionist/sort-imports': 'error',
'perfectionist/sort-named-exports': 'error',
'perfectionist/sort-named-imports': 'error',
},
settings: {perfectionist: {partitionByComment: true, type: 'natural'}},
settings: { perfectionist: { partitionByComment: true, type: 'natural' } },
},
{
extends: [vitestPlugin.configs.recommended],
Expand Down Expand Up @@ -76,11 +67,8 @@ export default defineConfig([
extends: [yml.configs['flat/standard'], yml.configs['flat/prettier']],
files: ['**/*.{yml,yaml}'],
rules: {
'yml/file-extension': ['error', {extension: 'yml'}],
'yml/sort-sequence-values': [
'error',
{order: {type: 'asc'}, pathPattern: '^.*$'},
],
'yml/file-extension': ['error', { extension: 'yml' }],
'yml/sort-sequence-values': ['error', { order: { type: 'asc' }, pathPattern: '^.*$' }],
},
},
])
]);
7 changes: 1 addition & 6 deletions knip.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{
"$schema": "https://unpkg.com/knip@5.71.0/schema.json",
"entry": [
"src/**/__tests__/*",
"src/api.js",
"src/repo/*.js",
"src/util/*.js"
],
"entry": ["src/**/__tests__/*", "src/api.js", "src/repo/*.js", "src/util/*.js"],
"treatConfigHintsAsErrors": true
}
Loading
Loading