std icon indicating copy to clipboard operation
std copied to clipboard

Remove prettier-plugin-toml dependency to fix minimal template

Open Copilot opened this issue 5 months ago • 7 comments

The minimal template was failing during git commit with a module not found error for prettier-plugin-toml. The error occurred because the hardcoded path to the plugin was incorrect:

[error] Cannot find module '/nix/store/lfjxr7afcn146kfb4lkm79z0c1jndamp-prettier-plugin-toml-1.0.0/lib/node_modules/prettier-plugin-toml/lib/index.js' imported from /home/samtitle/PersonalRepos/test-std-project/noop.js

This was caused by the hardcoded path ${nixpkgs.nodePackages.prettier-plugin-toml}/lib/node_modules/prettier-plugin-toml/lib/index.js in the treefmt configuration, which no longer exists due to changes in the package structure.

Following the maintainer's suggestion to drop TOML support from prettier, this PR removes the prettier-plugin-toml dependency entirely:

  • Removed nixpkgs.nodePackages.prettier-plugin-toml from packages in both treefmt.nix and mdbook.nix
  • Removed the --plugin option and hardcoded path from prettier configuration
  • Removed *.toml from prettier's file includes list

The change preserves all other formatting functionality (nix, shell, CSS, HTML, JS, JSON, JSX, MD, MDX, SCSS, TS, YAML) while eliminating the problematic TOML formatting via prettier. TOML files will simply not be formatted automatically, but the minimal template will work without errors.

Fixes #407.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Aug 17 '25 20:08 Copilot

@blaggacao 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot avatar Aug 17 '25 20:08 Copilot

@sstitle this looks like a correct quick fix, removing toml support. Pleas lt me know what you think of it or if you have any opinion towards alternative paths of actions (like looking for an alternative tonl formatter - suggestions?).

blaggacao avatar Aug 17 '25 20:08 blaggacao

@copilot can you also remove the support for toml in treefmt, should it still exist?

blaggacao avatar Aug 17 '25 20:08 blaggacao

@copilot can you also remove the support for toml in treefmt, should it still exist?

I've already removed all TOML support from treefmt in commit 6714ba8. The changes include:

  • Removed nixpkgs.nodePackages.prettier-plugin-toml from packages
  • Removed the --plugin option with hardcoded path from prettier configuration
  • Removed *.toml from prettier's includes list

There's no additional TOML formatting support remaining in treefmt that needs to be removed.

Copilot avatar Aug 17 '25 20:08 Copilot

@sstitle this looks like a correct quick fix, removing toml support. Pleas lt me know what you think of it or if you have any opinion towards alternative paths of actions (like looking for an alternative tonl formatter - suggestions?).

I'm not sure I know enough about the context of what TOML is used for in mdbook. I certainly don't think I need it. Anything that makes the minimal template functional is a suitable fix in my opinion. Thanks for your help!

sstitle avatar Aug 17 '25 21:08 sstitle

We got a small rabbit hole between this PR and the merge button: CI is red. :-)

Let'see if Copilot can drive this.

blaggacao avatar Aug 17 '25 21:08 blaggacao

perhaps failing b/c of nix version?

DrTeagle avatar Aug 25 '25 11:08 DrTeagle