Skip to content

feat: add _tools/repl-txt/rules/no-premature-wrap - #15587

Open
headlessNode wants to merge 2 commits into
stdlib-js:developfrom
headlessNode:repl-lint/no-premature-wrap2
Open

headlessNode wants to merge 2 commits into
stdlib-js:developfrom
headlessNode:repl-lint/no-premature-wrap2

Conversation

@headlessNode

Copy link
Copy Markdown
Member

Resolves stdlib-js/metr-issue-tracker#1375.

Description

What is the purpose of this pull request?

This pull request:

  • add _tools/repl-txt/rules/no-premature-wrap

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

Primarily written by Claude Code.


@stdlib-js/reviewers

@headlessNode
headlessNode requested a review from a team September 27, 2026 07:52
@stdlib-bot stdlib-bot added Tools Issue or pull request related to project tooling. Needs Review A pull request which needs code review. labels Sep 27, 2026
@headlessNode headlessNode added Feature Issue or pull request for adding a new feature. METR Pull request associated with the METR project. labels Sep 27, 2026
@headlessNode

headlessNode commented Sep 27, 2026 •

Copy link
Copy Markdown
Member Author

Found a bug in wrap-text where it wraps the content of backticks like below:

Beep boop `-1`

to

Beep boop `-
1`

PR for the fix: #15588

@headlessNode

Copy link
Copy Markdown
Member Author

@kgryte One thing I noticed while working on this: there's no convention for tables in repl.txt files, AFAIK. That's a problem for this rule, since wrap-text treats table rows by checking whether a line starts with | — anything else is wrapped normally.

For example, math/base/special/signum writes its table without leading/trailing pipes:

Value | Sign
----- | -----
x > 0 |    +1
x < 0 |    -1

while plot/sparklines/unicode/up-down:

| Value | Glyph |
|:-----:|:-----:|
|   1   |   ↑   |
|   -1  |   ↓   |

wrap-text would correctly skip the second table but not the first.

@kgryte

kgryte commented Sep 27, 2026

Copy link
Copy Markdown
Member

Hmm...neither is incorrect. The one issue with the latter table markup is that it includes unnecessary/non-applicable Markdown markup to REPL text files where it is not useful.

Regardless, it is not clear why you need to explicitly distinguish handle "table" text any different from normal text.

@headlessNode

headlessNode commented Sep 27, 2026 •

Copy link
Copy Markdown
Member Author

@kgryte We need to know what a table looks like with variation in format we have to take account of a lot of cases. From first example in above, the wrap-text treats it like normal text since the table doesn't start with a Pipe. And it wraps the table like below, because it passes the line length:

Value | Sign ----- | ----- x > 0 |    +1 x < 0 |    -1

@kgryte

kgryte commented Sep 27, 2026

Copy link
Copy Markdown
Member

@headlessNode Then it would seem that we need to adopt Markdown-like markup and normalize that across the codebase.

@headlessNode

Copy link
Copy Markdown
Member Author

@kgryte Should that be done before this PR gets merged?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Issue or pull request for adding a new feature. METR Pull request associated with the METR project. Needs Review A pull request which needs code review. Tools Issue or pull request related to project tooling.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: add _tools/repl-txt/rules/no-premature-wrap

3 participants