Skip to content

Commit

Permalink
chore: switch tooling to npm, with [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Jul 17, 2024
1 parent 5da206f commit 87de835
Show file tree
Hide file tree
Showing 19 changed files with 30 additions and 5,262 deletions.
16 changes: 8 additions & 8 deletions .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Development

After [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo) and [installing Yarn](https://yarnpkg.com/getting-started):
After [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo) and [installing Node.js](https://nodejs.org):

```shell
git clone https://github.com/ < your-name-here > /performance
cd performance
yarn install
npm install
```

> This repository includes a list of suggested VS Code extensions.
Expand All @@ -19,23 +19,23 @@ It should be applied automatically when you save files in VS Code or make a Git
To manually reformat all files, you can run:

```shell
yarn format --write
npm run format -- --write
```

## Linting

This package includes several forms of linting to enforce consistent code quality and styling.
Each should be shown in VS Code, and can be run manually on the command-line:

- `yarn lint` ([ESLint](https://eslint.org) with [typescript-eslint](https://typescript-eslint.io)): Lints JavaScript and TypeScript source files
- `yarn lint:knip` ([knip](https://github.com/webpro/knip)): Detects unused files, dependencies, and code exports
- `yarn lint:md` ([Markdownlint](https://github.com/DavidAnson/markdownlint): Checks Markdown source files
- `yarn lint:spelling` ([cspell](https://cspell.org)): Spell checks across all source files
- `npm lint` ([ESLint](https://eslint.org) with [typescript-eslint](https://typescript-eslint.io)): Lints JavaScript and TypeScript source files
- `npm lint:knip` ([knip](https://github.com/webpro/knip)): Detects unused files, dependencies, and code exports
- `npm lint:md` ([Markdownlint](https://github.com/DavidAnson/markdownlint): Checks Markdown source files
- `npm lint:spelling` ([cspell](https://cspell.org)): Spell checks across all source files

Read the individual documentation for each linter to understand how it can be configured and used best.

For example, ESLint can be run with `--fix` to auto-fix some lint rule complaints:

```shell
yarn run lint --fix
npm run lint -- --fix
```
3 changes: 1 addition & 2 deletions .github/actions/prepare/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ runs:
steps:
- uses: actions/setup-node@v4
with:
cache: yarn
node-version: "20"
- run: yarn install
- run: npm install
shell: bash
using: composite
2 changes: 1 addition & 1 deletion .github/workflows/lint-knip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: yarn lint:knip
- run: npm run lint:knip

name: Lint Knip

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: yarn lint:md
- run: npm run lint:md

name: Lint Markdown

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: yarn lint:spelling
- run: npm run lint:spelling

name: Lint spelling

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: yarn lint
- run: npm run lint

name: Lint

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: yarn format --list-different
- run: npm run format -- --list-different

name: Prettier

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tsc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: yarn tsc
- run: npm run tsc

name: Type Check

Expand Down
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.yarn/*
cases/
node_modules/
package-lock.json
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.all-contributorsrc
.husky/
cases/
yarn.yaml
Binary file removed .yarn/install-state.gz
Binary file not shown.
7 changes: 0 additions & 7 deletions .yarnrc.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
## Usage

```shell
yarn
yarn generate
yarn measure
npm install
npm generate
npm measure
```

## Contributors
Expand Down
2 changes: 1 addition & 1 deletion cspell.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dictionaries": ["typescript"],
"ignorePaths": [".github", "node_modules", "yarn.yaml"],
"ignorePaths": [".github", "cases", "node_modules"],
"words": ["execa", "knip", "packagejson", "tseslint"]
}
4 changes: 2 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import tseslint from "typescript-eslint";

export default tseslint.config(
{
ignores: ["cases", "node_modules", "projects", "yarn.yaml", ".yarn"],
ignores: ["cases", "node_modules", "projects"],
},
{
linterOptions: {
Expand All @@ -38,7 +38,7 @@ export default tseslint.config(
files: ["**/*.js", "**/*.ts"],
languageOptions: {
parserOptions: {
EXPERIMENTAL_useProjectService: {
projectService: {
allowDefaultProjectForFiles: ["./*.*s", "eslint.config.js"],
defaultProject: "./tsconfig.json",
},
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@
"sentences-per-line": "^0.2.1",
"tsx": "^4.16.2",
"typescript": "^5.5.3",
"typescript-eslint": "^7.16.0"
"typescript-eslint": "8.0.0-alpha.44"
},
"packageManager": "[email protected]",
"engines": {
"node": ">=22"
},
"publishConfig": {
"provenance": true
},
"overrides": {
"@typescript-eslint/utils": "8.0.0-alpha.44"
}
}
2 changes: 1 addition & 1 deletion src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ for (const files of caseEntries[0].values) {
}
}

await execa({ stdio: "inherit" })`yarn`;
await execa({ stdio: "inherit" })`npm install`;

console.log("Seeded cases.");
5 changes: 3 additions & 2 deletions src/measure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function runProjectLint(data: CaseData) {
cwd: path.join(casesPath, projectName),
reject: false,
})(`hyperfine`, [
"yarn lint",
"npm run lint",
"--ignore-failure",
"--show-output",
"--warmup",
Expand All @@ -23,10 +23,11 @@ async function runProjectLint(data: CaseData) {

if (result.exitCode) {
console.log(result.stderr);
console.log({ result });
}

return (
result.stdout.match(/[0-9.]+\s+\S+\s+±\s+[0-9.]+\s+\S+/)?.[0] ??
/[0-9.]+\s+\S+\s+±\s+[0-9.]+\s+\S+/.exec(result.stdout)?.[0] ??
result.stdout
);
}
Expand Down
Loading

0 comments on commit 87de835

Please sign in to comment.