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

Clarification for Inline Comments

未关闭
#1,506 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@prateekbisht23 已经在做这个了。

开始于 2025年9月15日。

  • #3174 来自 @prateekbisht23 —— 已关闭,未合并

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript
领域
documentation

调研方向

首先阅读 style guide 中现有的 "Comments" 部分和包含七条评论的讨论串。确定该讨论串是否确立了关于行内注释和长行的指导原则;完成意味着记录一条附带示例且经 maintainer 批准的规则,或确定仍需要作出决定。

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

描述

editorial pull request wanted

Thanks for the excellent style guide!

One thing that is not explicitly defined by the guide is inline comments. Can a section on this topic be added to the "Comments" section block, please?

For example,

let foo = 145; // This is modified below in the "baz()" function

Is this a legal line in the airbnb style?

And the follow-up question: if it is not legal, then I assume that the correct fix to have it be moved above, like this?

// This is modified below in the "baz()" function
let foo = 145;

Yet another follow-up question: if inline comments are legal, then what is the correct fix for in-line comments that make the line extend past 100 character? Like the following:

// This is a comment describing the following block of variable initializations
let foo = 123; // used in various contexts, but mostly for soccer games, basketball, and football games
let bar = 456; // used only for horse races; it is explicitly reset at the beginning of the "endRace()" function
let baz = 789; // used only for car races; it will be overwritten once we reach the "oilChange()" function

If it were moved above, it would overlap with the block comment header. So then does it make the most sense to move them down to the next line, like this?

// This is a comment describing the following block of variable initializations
let foo = 123;
// used in various contexts, but mostly for soccer games, basketball, and football games
let bar = 456;
// used only for horse races; it is explicitly reset at the beginning of the "endRace()" function
let baz = 789;
// used only for car races; it will be overwritten once we reach the "oilChange()" function
主要语言
JavaScript
星标
148k
派生
26.6k
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

airbnb/javascript 的其他 Issue

查看 airbnb/javascript 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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