google / eslint-config-google

ESLint shareable config for the Google JavaScript style guide
Apache License 2.0
1.74k stars 140 forks source link

Minor issues in index.js #29

Closed dongbohu closed 7 years ago

dongbohu commented 7 years ago

A few minor issues in index.js:

(1) Line 36: What is no-condition option/ I couldn't find it from eslint rules documentation.

(2) ESLint 3.8.0 has a new rule func-name-matching, you may wan to include it between lines 191 and 192 for completeness.

(3) Line 218: there is a typo in the inline comments: enfore should be enforce.

(4) I am surprised that Google's coding style guide doesn't recommend using === (instead of ==) and !== (instead of !=) operators. Any special reason?

Thanks.

philipwalton commented 7 years ago

(4) I am surprised that Google's coding style guide doesn't recommend using === (instead of ==) and !== (instead of !=) operators. Any special reason?

I don't know of the exact reason, but I suspect that since most Google JavaScript code uses Closure Compiler (and thus the types of variables are known), it's not necessary to use ===.

One example the style guide gives is specifically about allowing == when comparing two things where you're sure of their type. For example:

if (typeof foo == 'function') {
  // ...
}
dongbohu commented 7 years ago

Thank you for your reply. By the way, it seems you forgot to correct the typo of "enfore" (now on line 218 of index.js).

dongbohu commented 7 years ago

By the way, in my original post, the typo should be on line 218 instead of 216. My fault.

philipwalton commented 7 years ago

Thanks, fixed via 0037169ba795ea0db7c488c83c063bbf2e712d73.