json-schema-org / json-schema-org/website

🐛 Bug: Replace deprecated String.substr usages with slice

Open
#2,006 3 comments 0 reactions 1 assignee View on GitHub

@Sam-61s is already working on this.

Since Dec 31, 2025.

🐛 Bug dependencies Priority: Medium Status: Accepted
Dominant language
HTML
Stars
169
Forks
484
Avg merge
2d 2h
Merged PRs (30d)
6

Description

Describe the bug

Multiple parts of the website codebase still use the deprecated
String.prototype.substr API.

This causes linting/editor warnings

affected files (from lint output):

  • pages/index.page.tsx
  • pages/blog/index.page.tsx
  • components/StyledMarkdown.tsx
  • components/Sidebar.tsx
  • components/Headlines.tsx
  • components/JsonEditor.tsx
  • lib/getStaticMarkdownPaths.ts
  • lib/getPartsOfJson.ts
  • lib/getFindResultsByGlobalRegExp.ts

These usages should be replaced with slice or substring as appropriate.

Steps To Reproduce
  1. Clone json-schema-org/website and install dependencies.
  2. Check out the latest main branch.
  3. Run the linter (e.g., npm run lint or pnpm lint)
    or open the project in an editor with ESLint enabled.
  4. Open any of the files listed above and search for .substr.
  5. Observe lint/editor warnings about the deprecated substr method.
Expected Behavior
  • The codebase does not use String.prototype.substr.
  • All string slicing uses standard, well-supported methods
    (slice or substring).
  • The linter and editors show no warnings related to deprecated
    string APIs.
Screenshots

No response

Device Information [optional]
- OS:
- Browser:
- version:
Are you working on this issue?

Yes

Do you think this work might require an [Architectural Decision Record (ADR)]? (significant or noteworthy)

No

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.