Bug 143212 - Web Inspector: Add more ESLint rules that reflect the current state of the code base
Summary: Web Inspector: Add more ESLint rules that reflect the current state of the co...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-03-29 23:59 PDT by Tobias Reiss
Modified: 2015-03-30 15:05 PDT (History)
8 users (show)

See Also:


Attachments
patch (36.59 KB, patch)
2015-03-30 00:23 PDT, Tobias Reiss
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Reiss 2015-03-29 23:59:35 PDT
We should get to a point where ESLint can actually be used as a pre-commit hook, similar to "Tools/Scripts/check-webkit-style". But right now we just have too many linting errors, which is because .eslintrc does not reflect the current state of the code. As soon as we have defined most of the rules, we can fix the errors.
Comment 1 Radar WebKit Bug Importer 2015-03-29 23:59:46 PDT
<rdar://problem/20342932>
Comment 2 Tobias Reiss 2015-03-30 00:23:51 PDT
Created attachment 249712 [details]
patch
Comment 3 Timothy Hatcher 2015-03-30 08:44:38 PDT
Comment on attachment 249712 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=249712&action=review

> Source/WebInspectorUI/.eslintrc:83
> +        "comma-dangle": 0,

I don't like using a comma dangle.

> Source/WebInspectorUI/UserInterface/Models/SourceCodeLocation.js:-214
> -        var currentDisplay = undefined;

This should be legal.

> Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js:-360
> -        var prototypeName = undefined;

Ditto.

> Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js:-113
> -        }.bind(this));

This looks like a bug. The function uses this.

> Source/WebInspectorUI/UserInterface/Views/TypeTokenView.js:113
> +        });

Never mind. I see it does not now.
Comment 4 WebKit Commit Bot 2015-03-30 09:30:05 PDT
Comment on attachment 249712 [details]
patch

Clearing flags on attachment: 249712

Committed r182142: <http://trac.webkit.org/changeset/182142>
Comment 5 WebKit Commit Bot 2015-03-30 09:30:09 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Tobias Reiss 2015-03-30 12:23:32 PDT
Comment on attachment 249712 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=249712&action=review

>> Source/WebInspectorUI/.eslintrc:83
>> +        "comma-dangle": 0,
> 
> I don't like using a comma dangle.

The rule is turned off. If you don't want contributors to use trailing commas than we could set "comma-dangle" to "never".

>> Source/WebInspectorUI/UserInterface/Models/SourceCodeLocation.js:-214
>> -        var currentDisplay = undefined;
> 
> This should be legal.

If you want both to be legal, we could set "no-undef-init" to 0. But keep in mind that `currentDisplay` is undefined by default. There's no need to set it explicitly.
Comment 7 Joseph Pecoraro 2015-03-30 14:55:51 PDT
(In reply to comment #3)
> Comment on attachment 249712 [details]
> patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=249712&action=review
> 
> > Source/WebInspectorUI/.eslintrc:83
> > +        "comma-dangle": 0,
> 
> I don't like using a comma dangle.

I do! It makes diffs easier to read. Also, any good minifier can get rid of the extra commas.
Comment 8 Tobias Reiss 2015-03-30 15:05:27 PDT
Comment on attachment 249712 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=249712&action=review

>>>> Source/WebInspectorUI/.eslintrc:83
>>>> +        "comma-dangle": 0,
>>> 
>>> I don't like using a comma dangle.
>> 
>> The rule is turned off. If you don't want contributors to use trailing commas than we could set "comma-dangle" to "never".
> 
> I do! It makes diffs easier to read. Also, any good minifier can get rid of the extra commas.

ESLint offers 3 variations. "never", "always" and "always-multiline". https://github.com/eslint/eslint/blob/master/docs/rules/comma-dangle.md.