Repository navigation
chore: modernize coding style, lint and type tooling (no behavior cha… - #439
Merged
Merged
Conversation
…nge)
Lint (eslint.config.js)
- Rewrite on defineConfig/globalIgnores with one shared rule set.
- ESM files see only Node built-in globals; .cjs files get CommonJS
globals. Tests and bin/ are now linted.
- Fix no-unused-vars so unused arguments are reported; parameters kept
for arity use a leading "_".
- TypeScript uses typescript-eslint strictTypeChecked and
stylisticTypeChecked with projectService.
- Enforce private-member conventions: no "#_x", no TS `private`
modifier, no leading-underscore members (Node stream hooks exempt).
Formatting
- Add Prettier 3.9.10 (.prettierrc.json, .prettierignore): tabs, double
quotes, semicolons, 120 columns, chosen as the lowest-churn options.
- Remove the unused .prettierrc.cjs and reformat all JS/TS sources.
Source idioms
- "#_x" -> "#x" in lib/; TS `private` -> "#" in src/cli/.
- var -> const/let, Object.hasOwn, Number.isNaN/Number.isFinite,
for...of Object.entries, arrow functions in place of .bind(this),
and object spread in place of Object.assign({}, ...).
- PDFParser._PARSER_SIG keeps its public name for back-compat and now
reads the shared PARSER_SIG from lib/pkinfo.js.
TypeScript
- Upgrade 5.9.3 -> 6.0.3; typescript-eslint supports TS <6.1.
- tsconfig: module/moduleResolution nodenext, target/lib es2024,
verbatimModuleSyntax, erasableSyntaxOnly, noImplicitOverride.
- Type the CLI's PDFParser members and settle-result types (type-only
changes).
Scripts and CI
- Add lint:fix, format, format:check and typecheck scripts. The build
now runs lint, format check and typecheck before bundling.
- CI: run on push to master, bump action majors, Deno 2.9.8,
Node 22.23.2, add typecheck and format-check steps, and add a
non-blocking TypeScript 7 typecheck.
Docs
- AGENTS.md: code-quality commands and lint-enforced conventions.
- readme: lint/format/typecheck section; build-before-test note
replaces the removed pretest step; the command-line test section now
uses the real p2j.*.sh scripts and npm run test:forms/test:misc; the
exception-test counts are now 22 files, 16 pass, 6 expected failures,
with the current file names.
On a clean checkout dist/ does not exist yet. The checks ran before build:bundle-pdfjs-base copies dist/pdfparser.d.ts, so type-aware lint could not resolve the CLI's ../../dist/pdfparser.js import and failed with 61 errors on both CI runners. - Restore build:bundle-pdfjs-base to the plain bundle script. - Add a check script (lint, format:check, typecheck); build now runs bundle-pdfjs-base, then check, then rollup. - Add .gitattributes (eol=lf) so Windows checkouts are LF and the Prettier check passes on every OS. - CI: fold the separate lint, typecheck and format-check steps into Build; keep the non-blocking TypeScript 7 trial. - readme: note that build runs the checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…nge)
Lint (eslint.config.js)
privatemodifier, no leading-underscore members (Node stream hooks exempt).Formatting
Source idioms
private-> "#" in src/cli/.TypeScript
Scripts and CI
Docs