Closed
Bug 1218425
Opened 10 years ago
Closed 10 years ago
ESLint rule that checks for aArgs in function parameters
Categories
(DevTools :: General, defect)
DevTools
General
Tracking
(firefox44 fixed)
RESOLVED
FIXED
Firefox 44
Tracking | Status | |
---|---|---|
firefox44 | --- | fixed |
People
(Reporter: pbro, Assigned: pbro)
References
Details
Attachments
(1 file, 1 obsolete file)
5.74 KB,
patch
|
pbro
:
review+
|
Details | Diff | Splinter Review |
Our coding standards [1] warns against using aArgs, but we have plenty in our code already. An EsLint rule would be really simple to write and would help prevent adding more in the future.
[1] https://wiki.mozilla.org/DevTools/CodingStandards#Code_style
Assignee | ||
Comment 1•10 years ago
|
||
This should work nicely. Still have to do some more tests, but a first review would help confirm this rule is wanted.
Comment 2•10 years ago
|
||
Comment on attachment 8678905 [details] [diff] [review]
Bug_1218425_-_ESLint_rule_that_warns_against_aArg_.diff
Review of attachment 8678905 [details] [diff] [review]:
-----------------------------------------------------------------
r+ with nits addressed
::: testing/eslint-plugin-mozilla/lib/rules/no-aArgs.js
@@ +19,5 @@
> +
> + function isPrefixed(name) {
> + return name.length >= 2 &&
> + name.substring(0, 1) === "a" &&
> + name.substring(1, 2).toUpperCase() === name.substring(1, 2);
It would be simpler to use:
return name.length >= 2 && /^a[A-Z]/.test(name);
@@ +24,5 @@
> + }
> +
> + function deHungarianize(name) {
> + return name.substring(1, 2).toLowerCase() +
> + name.substring(2, name.length);
It would be simpler to use:
return "aHello".substring(1).toLowerCase();
Attachment #8678905 -
Flags: review?(mratcliffe) → review+
Assignee | ||
Comment 3•10 years ago
|
||
(In reply to Michael Ratcliffe [:miker] [:mratcliffe] from comment #2)
> ::: testing/eslint-plugin-mozilla/lib/rules/no-aArgs.js
> @@ +19,5 @@
> > +
> > + function isPrefixed(name) {
> > + return name.length >= 2 &&
> > + name.substring(0, 1) === "a" &&
> > + name.substring(1, 2).toUpperCase() === name.substring(1, 2);
>
> It would be simpler to use:
> return name.length >= 2 && /^a[A-Z]/.test(name);
Good point, I will change this.
> @@ +24,5 @@
> > + }
> > +
> > + function deHungarianize(name) {
> > + return name.substring(1, 2).toLowerCase() +
> > + name.substring(2, name.length);
>
> It would be simpler to use:
> return "aHello".substring(1).toLowerCase();
This would change "aCamelCasedName" to "camelcasedname" which isn't what we want. So I think I need to keep the slightly more complex form.
Assignee | ||
Comment 4•10 years ago
|
||
Built on top of bug 269836, so let's depend on it.
Depends on: 269836
Assignee | ||
Comment 5•10 years ago
|
||
Attachment #8678905 -
Attachment is obsolete: true
Attachment #8679853 -
Flags: review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Keywords: checkin-needed
Assignee | ||
Updated•10 years ago
|
Comment 7•10 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox44:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 44
Updated•7 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•