Development
After forking the repo from GitHub and installing pnpm, run the following:
git clone https://github.com/(your-name-here)/eslint-plugin-package-jsoncd eslint-plugin-package-jsonpnpm installBuilding
Section titled “Building”Run tsdown locally to build source files from src/ into output files in lib/:
pnpm buildAdd --watch to run the builder in watch mode that continuously cleans and recreates lib/ as you save files:
pnpm build --watchGenerating Docs
Section titled “Generating Docs”Run eslint-doc-generator to generate new skeleton doc pages for new rules or to update existing doc pages for updated rules:
pnpm docs:generateFormatting
Section titled “Formatting”Prettier is used to format code. It should be applied automatically when you save files in VS Code or make a Git commit.
To manually reformat all files, you can run:
pnpm format --writeLinting
Section titled “Linting”This package includes a couple forms of linting to enforce consistent code quality and styling. Each will run at CI time, and can be run manually on the command-line:
pnpm lint(ESLint): Lints all source filespnpm lint:knip(knip): Detects unused files, dependencies, and code exports
Read the individual documentation for each tool to understand how it can be configured and used best.
For example, ESLint can be run with --fix to auto-fix some lint rule violations:
pnpm lint --fixTesting
Section titled “Testing”Vitest is used for tests. You can run it locally on the command-line:
pnpm testAdd the --coverage flag to compute test coverage and place reports in the coverage/ directory:
pnpm test --coverageNote that console-fail-test is enabled for all test runs.
Calls to console.log, console.warn, and other console methods will cause a test to fail.
Debugging Tests
Section titled “Debugging Tests”We recommend using the official Vitest VSCode extension to run and / or debug individual tests (or entire test suites).
Type Checking
Section titled “Type Checking”You should be able to see suggestions from TypeScript in your editor for all open files.
However, it can be useful to run the TypeScript command-line (tsc) to type check all files in src/:
pnpm typecheckAdd --watch to keep the type checker running in a watch mode that updates the display as you save files:
pnpm typecheck --watchWorking on the Site
Section titled “Working on the Site”If you’d like to work on aspects of the website, these commands might come in helpful. The site is built using ✨Starlight for Astro.
Run Dev Server
Section titled “Run Dev Server”You can spin up a local instance of the server by running astro dev.
This will serve the site in “watch” mode, so that updates you make will reflect in the site as you make them.
This will serve the site on http://localhost:3000/.
pnpm site:devBuild the Site for Production
Section titled “Build the Site for Production”To create a production build for testing, you can run a combination of the “build” and “preview” commands. This will create a production build of the site, and serve the statically generated assets locally on the dev server. This, importantly, is not running in “watch” mode, and won’t react to changes to the source files.
pnpm site:buildpnpm site:preview