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

Handling non-js files with prettier

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

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
28/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
领域
frontend, tooling

调研方向

先从当前的 prettier 功能和 index.html 开始,然后查看 issue #176,了解相关增强功能的讨论。完成的标准是根据文件扩展名选择 parser、对不支持的文件隐藏按钮,并公开 formatting-failed 状态,而不是静默失败。

由索引模型根据 Issue 内容生成。

描述

bug improvement

Relates to issue #176 (prettier enhancements)

Currently our prettier functionality only handles JS files as it always uses babylon (which should now be babel, I believe). Formatting for json, typescript and more just fails silently. I'm working on prettier enhancements which will address this issue. See below for an outline of how I'm tackling the issue. Open for discussion now and/or when my PR comes in.

Current plan:

  1. Check current file extension and use that to set a valid non-custom parser option by updating the parser name and loading the necessary script on click (loaded from this list of prettier parsers)
  2. Less sure of this one: Keep prettier and the babel/babylon parser loaded (but via 'async') in the head of index.html as they'll be used a lot.
  3. Hide the prettier button if we're in a file with an extension that we cannot prettify
  4. In addition to formatting and done state, add a formatting failed state to the prettier button (current state changes in a local branch on my machine. Relates to discussion in #176 )
主要语言
JavaScript
星标
307
派生
9
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

FormidableLabs/runpkg 的其他 Issue

查看 FormidableLabs/runpkg 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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