Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use pnpm as package manager #966

Merged
merged 9 commits into from
Nov 24, 2024
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
13 changes: 8 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,31 @@ permissions:

jobs:
publish:
name: Publish NPM package
name: Publish package
runs-on: ubuntu-latest
# Avoid publishing in forks
if: github.repository == 'testing-library/eslint-plugin-testing-library'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
cache: npm
cache: 'pnpm'
node-version-file: '.nvmrc'

- name: Install dependencies
run: npm install
run: pnpm install

- name: Build package
run: npm run build
run: pnpm run build

- name: Release new version
run: npx semantic-release
run: pnpm exec semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Use Node
uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version-file: '.nvmrc'

- run: |
npm install
npm run build
pnpm install
pnpm run build

- run: npm link
- run: pnpm link
working-directory: ./dist

- run: npm link eslint-plugin-testing-library
- run: pnpm link eslint-plugin-testing-library

- uses: AriPerkkio/eslint-remote-tester-run-action@v4
with:
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/verifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
cache: npm
cache: 'pnpm'
node-version-file: '.nvmrc'

- name: Install dependencies
run: npm install
run: pnpm install

- name: Run script
run: npm run ${{ matrix.validation-script }}
run: pnpm run ${{ matrix.validation-script }}

tests:
name: Tests (Node v${{ matrix.node }} - ESLint v${{ matrix.eslint }})
Expand All @@ -41,24 +44,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
cache: npm
cache: 'pnpm'
node-version: ${{ matrix.node }}

- name: Install dependencies
run: npm install

# see https://github.com/npm/cli/issues/7349
- if: ${{ matrix.eslint == 9 }}
run: npm un @typescript-eslint/eslint-plugin eslint-plugin-jest eslint-doc-generator
run: pnpm install

- name: Install ESLint v${{ matrix.eslint }}
run: npm install --no-save --force eslint@${{ matrix.eslint }}
run: pnpm add eslint@${{ matrix.eslint }}

- name: Run tests
run: npm run test:ci
run: pnpm run test:ci

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ yarn-error.log
# Yarn Integrity file
.yarn-integrity

# Ignore locks other than npm
pnpm-lock.yaml
# Ignore locks other than pnpm
package-lock.json
yarn.lock
2 changes: 0 additions & 2 deletions .gitpod.yml

This file was deleted.

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ dist
node_modules
coverage
.all-contributorsrc
pnpm-lock.yaml
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Tweaking ESLint rules is mostly about traversing through the AST. [AST Explorer]

1. Fork this repository
2. Clone your forked repository
3. Run `npm install` to install corresponding dependencies
3. Run `pnpm install` to install corresponding dependencies
4. Create a branch for your PR named like `pr/your-branch-name` (you can do this through git CLI with `git checkout -b pr/your-branch-name`)

> Tip: Keep your `main` branch pointing at the original repository and make
Expand Down Expand Up @@ -63,7 +63,7 @@ each rule has three files named with its identifier (e.g. `no-debugging-utils`):

Additionally, you need to do a couple of extra things:

- Run `npm run generate:rules-doc` to include your rule in the "Supported Rules" table within the [README.md](./README.md)
- Run `pnpm run generate:rules-doc` to include your rule in the "Supported Rules" table within the [README.md](./README.md)

### Custom rule creator

Expand Down Expand Up @@ -99,7 +99,7 @@ If you need some check related to Testing Library which is not available in any
- pass it through `helpers`
- write some generic test within `fake-rule.ts`, which is a dumb rule to be able to test all enhanced behavior from our custom Rule Creator.

Take also into account that we're using our own `recommendedConfig` meta instead of the default `recommended` one. This is done so that our tools can automatically generate (`npm run generate:configs`) our configs.
Take also into account that we're using our own `recommendedConfig` meta instead of the default `recommended` one. This is done so that our tools can automatically generate (`pnpm run generate:configs`) our configs.

## Updating existing rules

Expand Down
2 changes: 1 addition & 1 deletion lib/configs/angular.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// YOU CAN REGENERATE IT USING npm run generate:configs
// YOU CAN REGENERATE IT USING pnpm run generate:configs

export = {
plugins: ['testing-library'],
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/dom.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// YOU CAN REGENERATE IT USING npm run generate:configs
// YOU CAN REGENERATE IT USING pnpm run generate:configs

export = {
plugins: ['testing-library'],
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/marko.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// YOU CAN REGENERATE IT USING npm run generate:configs
// YOU CAN REGENERATE IT USING pnpm run generate:configs

export = {
plugins: ['testing-library'],
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/react.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// YOU CAN REGENERATE IT USING npm run generate:configs
// YOU CAN REGENERATE IT USING pnpm run generate:configs

export = {
plugins: ['testing-library'],
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/vue.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// YOU CAN REGENERATE IT USING npm run generate:configs
// YOU CAN REGENERATE IT USING pnpm run generate:configs

export = {
plugins: ['testing-library'],
Expand Down
Loading