Skip to content

chore: migrate to package.json-based linting package management#2576

Open
MikeMcC399 wants to merge 5 commits into
nodejs:mainfrom
MikeMcC399:migrate/linting-npm-package
Open

chore: migrate to package.json-based linting package management#2576
MikeMcC399 wants to merge 5 commits into
nodejs:mainfrom
MikeMcC399:migrate/linting-npm-package

Conversation

@MikeMcC399

Copy link
Copy Markdown
Contributor

Description

Move version definition of npm packages to package.json & package-lock.json:

  • doctoc
  • markdown-link-check
  • prettier

Use Node.js 24 (Active LTS).

Update linting workflows to run based on above package definitions:

Workflow
doctoc.yml
markdown-link-check.yml
prettier.yml

workflow_dispatch: event triggers are added to make it easier to check linting issue before submitting a PR.

Enable weekly npm updating through Dependabot.

Update CONTRIBUTING with prerequisites and linting instructions. Add Table of Contents.

Motivation and Context

The following workflows currently install npm dependencies on the fly. Code scanning alerts notes this as an issue.

Workflow npm Package
doctoc.yml doctoc (latest)
markdown-link-check.yml markdown-link-check@3.14.2
prettier.yml prettier@3.9.5

By moving the package version selection from GitHub Actions to npm package.json & package-lock.json files, versions can be pinned exactly and maintained regularly by Dependabot.

Setting Dependabot and npm minimum age to 5 days for updates, reduces the risk of fast supply-chain attacks:

Testing Details

Types of changes

  • Documentation
  • Version change (Update, remove or add more Node.js versions)
  • Variant change (Update, remove or add more variants, or versions of variants)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Other (none of the above)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING.md document.
  • All new and existing tests passed.

Move version definition of npm packages to
package.json & package-lock.json:
- doctoc
- markdown-link-check
- prettier

Update linting workflows.

Enable npm updating through Dependabot.
Add scripts and documentation to aid local linting.
@MikeMcC399

Copy link
Copy Markdown
Contributor Author

@MikeMcC399
MikeMcC399 marked this pull request as ready for review July 22, 2026 15:35
@MikeMcC399
MikeMcC399 requested a review from nschonni July 22, 2026 15:35
Comment thread .github/workflows/doctoc.yml
Comment thread .github/workflows/markdown-link-check.yml
Comment thread .github/workflows/markdown-link-check.yml Outdated
Comment thread .github/workflows/markdown-link-check.yml
Comment thread package.json
Comment thread package.json
Comment thread package.json
"private": true,
"type": "commonjs",
"scripts": {
"format:toc": "doctoc --update-only .",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playing with this locally I needed additional parameters, but maybe it was a version issue. I had "doctoc:README": "doctoc README.md --github --title \"## Table of Contents\"", separate targets, otherwise I thing the title stuff was causing a diff

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which operating system are you running under?

but maybe it was a version issue

What version are you referring to? To test you should be using "doctoc": "2.5.0" defined in package.json

It should not be necessary to have a --title option in the command line unless you are creating a new ToC.

Comment thread .github/workflows/prettier.yml Outdated
Comment thread .github/workflows/doctoc.yml Outdated
Comment thread package.json Outdated
@MikeMcC399
MikeMcC399 marked this pull request as draft July 23, 2026 09:14
@MikeMcC399

MikeMcC399 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@nschonni

Many thanks for your review! I think I've addressed the points you raised.

In parallel I submitted #2577 to remove https://sourceware.org/ from link testing. It has been flakily failing during my tests, so I'd just want to ignore it for future markdown-link-check tests.

@MikeMcC399
MikeMcC399 marked this pull request as ready for review July 23, 2026 11:28
@MikeMcC399 MikeMcC399 self-assigned this Jul 23, 2026
@MikeMcC399 MikeMcC399 added the ci CI (Continuous Integration) workflows label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI (Continuous Integration) workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manage npm packages used in workflows

2 participants