Skip to content

πŸ› Bug: Replace deprecated String.substr usages with sliceΒ #2006

@Sam-61s

Description

@Sam-61s

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageThis is the initial status for an issue that requires triage.dependenciesPull requests that update a dependency fileπŸ› BugIndicates that the issue is a bug or defect.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions