Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Add a Number Base Converter tool

未关闭
#128 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

这个 Issue 还没有评估数据。

描述

enhancement good first issue hacktoberfest new tool

Add a tool that converts integers between binary, octal, decimal and hex (and any base from 2 to 36), and shows two's complement for a chosen bit width. Developers do this all the time, and none of our tools cover it. The Base64 "Encodings" tab only shows the hex of text bytes.

Scope

  • Route /number-base-converter. Registry: title "Number Base Converter", tagline "Numbers", heroDim: "", features like ["Binary", "Octal", "Decimal", "Hex", "Two's complement"]
  • lib/number-base.ts using BigInt only:
    • parseInteger(input, base?): handles a sign, detects 0b, 0o and 0x, and accepts _ or spaces as separators. Errors say which character is wrong and where.
    • formatInteger(value, base, { uppercase, groupSize }) for bases 2 to 36
    • toTwosComplement(value, bits) and fromTwosComplement(...) for 8, 16, 32 and 64 bits
  • UI: one input with a base select, outputs for 2, 8, 10 and 16 with Copy buttons, a custom base, and a bit-width select. app/(tools)/base64/ is a good structure to copy.

Acceptance criteria

  • Tests in lib/__tests__/number-base.test.ts: "0xff" gives 255n, "1111_1111" in base 2 gives 255n, "-0b1010" gives -10n, "18446744073709551616" gives hex 10000000000000000 exactly, "0b102" gives an error that names 2, "zz" in base 36 gives 1295n, toTwosComplement(-1n, 8) gives 11111111, and toTwosComplement(128n, 8) gives an error
  • Nothing goes through Number or parseInt, so there's no precision loss above 2^53
  • The standard new-tool checklist below is complete

Standard new-tool checklist

Everything (home grid, metadata, JSON-LD, OG image, sitemap, manifest, command palette) is driven by the registry in lib/tools.ts, so a new tool is mostly one registry entry plus a route.

  • Add an entry to TOOLS in lib/tools.ts filling every field of the Tool interface (lib/tools.ts:19-50). Use applicationCategory: "DeveloperApplication", reuse the CTA_PROJECTS / CTA_CONTACT constants for the CTA links, and set sitemapPriority: 0.9 like the other tools.
  • Pick accentVar from the six theme variables in app/globals.css (--cyan, --amber, --rose, --violet, --sky, --lime; --cyan and --rose aren't used by any tool yet) and set accentHex to that variable's dark-theme value. heroDim must be "" or a substring of heroHeading.
  • Write 3 or 4 FAQs (3 renders as a 3-column grid, see components/shared/ToolPageLayout.tsx:25). Keep metaTitle under 60 characters and metaDescription around 150 to 160.
  • Keep features and ogDescription to plain Latin text and punctuation. The social card font is a subset with no arrow or symbol glyphs (lib/og.tsx:33-36).
  • Create app/(tools)/<slug>/page.tsx, <Name>Client.tsx (with "use client"), and opengraph-image.tsx. Copy page.tsx and opengraph-image.tsx from app/(tools)/base64/ and change the slug.
  • Put all pure logic in lib/<name>.ts (no React, no DOM) with tests in lib/__tests__/<name>.test.ts. Tests can import with @/ like the app does (vitest.config.ts has the alias).
  • Nothing leaves the browser: no network calls with user input, no analytics, no third-party scripts (the CSP in middleware.ts blocks external scripts anyway).
  • Reuse shared pieces: CopyButton, useToast, and optionally useRegisterCommands for command palette actions (example in app/(tools)/base64/Base64Client.tsx:43-53).
  • Every input has a visible label or an aria-label, the tool works with the keyboard alone, and it looks right in both light and dark themes.
  • Add the tool to the "Which tool?" dropdown in .github/ISSUE_TEMPLATE/bug_report.yml.
  • npm run lint && npm run test && npm run build passes.

One new tool per contributor, so more people get a chance. Add your registry entry at the end of TOOLS and rebase on develop before asking for review, since other new tools will touch the same file.


Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #128 in the description.

主要语言
TypeScript
星标
1
派生
9
平均合并
10 小时 24 分钟
30 天内合并 PR
93

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codercops/toolbelt 的其他 Issue

查看 codercops/toolbelt 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。