Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdannael committed Sep 7, 2024
2 parents c1c7b99 + 7973b17 commit bc2760d
Show file tree
Hide file tree
Showing 482 changed files with 6,560 additions and 2,031 deletions.
16 changes: 16 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Convert all files to use "\n" line endings.
* text eol=lf

# Specify the file type for some binary files to prevent Git from changing the line endings upon
# cloning the repository.
*.gif binary
*.ico binary
*.jpeg binary
*.jpg binary
*.png binary
*.otf binary
*.mov binary
*.mp3 binary
*.mp4 binary
*.webm binary
*.webp binary
55 changes: 33 additions & 22 deletions .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ You should have Bun installed, the rest comes with `bun install`.

## Getting started

This guide assumes familiarity with concepts like [forking][1] and [cloning a repo][2] and working with npm.
This guide assumes familiarity with concepts like [forking][1] and [cloning a
repo][2] and working with npm.

- Fork the project (e.g. using the [GitHub website][3] or the [gh CLI][4])
- Clone the repository
Expand All @@ -25,7 +26,8 @@ bun install
cd packages/knip
```

Depending on the goals and the way you like to work, below are a few things that might help during development:
Depending on the goals and the way you like to work, below are a few things that
might help during development:

## Plugins

Expand All @@ -35,18 +37,19 @@ There's a separate guide for [writing a plugin][5].

```shell
cd packages/knip
bun link && bun run build --watch
bun watch
```

Changes in the source code are now automatically picked up, and `knip` is available globally to run from any directory.
You can then also run `npm link knip` from another repository to use the linked version of `knip`.
Changes in the source code are now automatically picked up, and `knip` is
available globally to run from any directory.

## Fixtures & Tests

Pull requests should include one or more tests. See the `tests` and `fixtures` directories to find relevant files that
you may want to borrow or copy from.
Pull requests should include one or more tests. See the `tests` and `fixtures`
directories to find relevant files that you may want to borrow or copy from.

Let's assume you created `fixtures/feature` and `test/feature.test.ts`. Here's 4 ways to run it:
Let's assume you created `fixtures/feature` and `test/feature.test.ts`. Here's 4
ways to run it:

### Run the test

Expand All @@ -63,16 +66,17 @@ knip

### Attach debugger to Node.js

Auto or smart-attach to every Node.js process launched in terminal in IDE, and then:
Attach to Node.js process launched in terminal in IDE, and then:

```shell
cd fixtures/feature
tsx ../../src/cli.ts
tsx --inspect ../../src/cli.ts
```

### Attach debugger to Bun

Set a breakpoint and start Knip with Bun while waiting for the debugger to be attached:
Set a breakpoint and start Knip with Bun while waiting for the debugger to be
attached:

```shell
cd fixtures/feature
Expand All @@ -87,28 +91,35 @@ Run the "Debug Bun test" launch configuration from any test file.

## QA

Knip has a few tools set up to verify code quality and to format code and documentation:
Knip has a few tools set up to verify code quality and to format code and
documentation:

```shell
bun run format
bun run lint
bun run knip
bun run knip:production
bun format
bun lint
bun knip
bun knip:production
bun run test
```

To run all commands in sequence: `bun run qa`

## GitHub Action

The [Cross-OS Tests][7] GitHub Action runs the tests in Ubuntu, macOS and Windows. Tests must pass before pull requests
can be merged. Another workflow acts as [integration test][8] against repositories using Knip.
The [ci.yml][7] workflow runs the tests in Ubuntu, macOS and Windows. Tests must
pass before pull requests can be merged. The [integration.yml][8] workflow runs
Knip in multiple repositories using Knip.

## Previews

Thanks to [pkg.pr.new](https://pkg.pr.new) pull requests can be previewed by
installing it as a regular package. Every push is published to their registry.
Look for the `pkg-pr-new` bot in your pull request.

[1]: https://docs.github.com/get-started/quickstart/fork-a-repo
[2]: https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository
[2]:
https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository
[3]: https://github.com/webpro-nl/knip
[4]: https://cli.github.com/
[5]: https://knip.dev/guides/writing-a-plugin/
[6]: ../.vscode/launch.json
[7]: https://github.com/webpro-nl/knip/actions/workflows/test.yml
[7]: https://github.com/webpro-nl/knip/actions/workflows/ci.yml
[8]: https://github.com/webpro-nl/knip/actions/workflows/integration.yml
21 changes: 0 additions & 21 deletions .github/ISSUE_TEMPLATE/01-bug_report.md

This file was deleted.

53 changes: 53 additions & 0 deletions .github/ISSUE_TEMPLATE/01-bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 🐛 Bug report
description: Create a report to help us improve
title: '🐛 '
labels: ['bug']
body:
- type: markdown
attributes:
value: |
Use common sense and provide the necessary information that helps us to help you.
A minimal reproduction is mandatory: only the code and configuration required to demonstrate the issue.
- type: checkboxes
attributes:
label: Prerequisites
description: Please check existing information about your issue
options:
- label: I'm using the latest version
required: true
- label: I've read the relevant [documentation](https://knip.dev)
required: true
- label:
I've searched for [existing
issues](https://github.com/webpro-nl/knip/issues?q=is%3Aissue)
required: true
- label:
I've checked the [list of known
issues](https://knip.dev/reference/known-issues)
required: true
- label:
I've read the [issue reproduction
guide](https://knip.dev/guides/issue-reproduction)
required: true
- type: input
id: reproduction
attributes:
label: Reproduction url
description: Please link to the location of the issue reproduction
validations:
required: true
- type: checkboxes
attributes:
label: Reproduction access
description: For instance, a CodeSandbox seems private by default
options:
- label: I've made sure the reproduction is publicly accessible
required: true
- type: textarea
id: description
attributes:
label: Description of the issue
description: What happened, and what would you expect to happen?
validations:
required: true
24 changes: 0 additions & 24 deletions .github/ISSUE_TEMPLATE/02-regression.md

This file was deleted.

61 changes: 61 additions & 0 deletions .github/ISSUE_TEMPLATE/02-regression.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: 🔄 Regression
description: Something that worked a certain way before, but no longer does
title: '🔄 '
labels: ['regression']
body:
- type: markdown
attributes:
value: |
Please make sure you have read the docs and are using the latest version of Knip. Use common sense and provide the necessary information that helps me or others to help you.
A minimal reproduction is mandatory: only the code and configuration required to demonstrate the issue.
- type: checkboxes
attributes:
label: Prerequisites
description: Please check existing information about your issue
options:
- label: I've read the relevant [documentation](https://knip.dev)
required: true
- label:
I've searched for [existing
issues](https://github.com/webpro-nl/knip/issues?q=is%3Aissue)
required: true
- label:
I've read the [issue reproduction
guide](https://knip.dev/guides/issue-reproduction)
required: true
- type: input
id: reproduction
attributes:
label: Reproduction url
description: Please link to the location of the issue reproduction
validations:
required: true
- type: checkboxes
attributes:
label: Reproduction access
description: For instance, a CodeSandbox seems private by default
options:
- label: I've made sure the reproduction is publicly accessible
required: true
- type: input
id: good-version
attributes:
label: Good version
description: What's the latest version it worked as expected?
validations:
required: true
- type: input
id: bad-version
attributes:
label: Bad version
description: What's the first version it no longer works as expected?
validations:
required: true
- type: textarea
id: description
attributes:
label: Description of the regression
description: What happened before, what happens now?
validations:
required: true
12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE/03-feature_request.md

This file was deleted.

16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/03-feature_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 💡 Feature Request (RFC)
description: Suggest an idea for this project
title: '💡 '
labels: ['feature request']
body:
- type: markdown
attributes:
value:
Use common sense and provide the necessary information to explain why
the feature is useful to you and to others. Thanks!
- type: textarea
id: description
attributes:
label: Suggest an idea for this project
validations:
required: true
12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE/04-everything-else.md

This file was deleted.

16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/04-everything-else.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 🧩 Everything Else
description: Discuss anything related to Knip
title: '🧩 '
labels: ['discussion']
body:
- type: markdown
attributes:
value:
Feel free to discuss anything related to Knip. By the way, there's also
a [Discord channel](https://discord.gg/r5uXTtbTpc).
- type: textarea
id: description
attributes:
label: Discuss anything related to Knip
validations:
required: true
4 changes: 2 additions & 2 deletions .github/workflows/ci-bun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
os:
- macos-latest
- ubuntu-latest
# - windows-latest # temp disabled because https://github.com/oven-sh/bun/issues/9932
- windows-latest
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --ignore-scripts --frozen-lockfile
- name: Run formatter, linter, import sorter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests (against typescript@beta in Node.js v22)
name: Tests (against typescript@beta/rc in Node.js v22)

on:
workflow_dispatch:
Expand Down
Loading

0 comments on commit bc2760d

Please sign in to comment.