Clarification for Inline Comments
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 30/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript
调研方向
首先阅读 style guide 中现有的 "Comments" 部分和包含七条评论的讨论串。确定该讨论串是否确立了关于行内注释和长行的指导原则;完成意味着记录一条附带示例且经 maintainer 批准的规则,或确定仍需要作出决定。
由索引模型根据 Issue 内容生成。
描述
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,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
airbnb/javascript 的其他 Issue
-
Severity: Unhandled promise rejection in `whitespace-async.js` when ESLint async path is used可能已有人在做 @bodapatisaikrishna 于 24 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
airbnb/javascript#3237 · 6 条评论 ·
-
Inconsistent semicolon usage in examples (Arrays vs Functions)可能已有人在做 @Developer-shivamMishra 于 15 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
airbnb/javascript#3152 · 4 条评论 ·
-
No error handling around execSync + JSON.parse in whitespace.js (ESLint 9 path)可能已有人在做 @dataCenter430 于 220 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 48/100
airbnb/javascript#3238 · 8 条评论 ·
-
Upgrading eslint-plugin-react-hooks可能已有人在做 @weihongyu12 于 365 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 38/100
airbnb/javascript#3186 · 3 条评论 · 2 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 45/100
airbnb/javascript#3173 · 9 条评论 · 1 个 reaction ·
查看 airbnb/javascript 的全部 Issue
相似的 Issue
-
Harden bayesian-waves-bg.js: add prefers-reduced-motion, pointer-events guard, and hidden-tab pause未关闭
难度 2/5 1-3 小时 新手友好度 85/100
-
难度 1/5 1 小时以内 新手友好度 90/100
njitacm/njit-acm-website#109 ·
-
type: bug
难度 2/5 1-3 小时 新手友好度 76/100
blamechris/chroxy#8579 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
modusensus/dsh-mneme#411 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复