From 672552304283652f53f0b22f244655f6651cccd5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 7 Mar 2016 09:43:04 -0800 Subject: [PATCH 1/4] Remove CoffeeScript from styleguide --- docs/development/coding-style.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/development/coding-style.md b/docs/development/coding-style.md index a86ee32417db..f28b737921a6 100644 --- a/docs/development/coding-style.md +++ b/docs/development/coding-style.md @@ -17,17 +17,23 @@ document. The document mentions some special types, scoped types (that automatically release their memory when going out of scope), logging mechanisms etc. -## CoffeeScript - -For CoffeeScript, we follow GitHub's [Style -Guide](https://github.com/styleguide/javascript) and the following rules: +## JavaScript * Files should **NOT** end with new line, because we want to match Google's styles. * File names should be concatenated with `-` instead of `_`, e.g. - `file-name.coffee` rather than `file_name.coffee`, because in + `file-name.js` rather than `file_name.js`, because in [github/atom](https://github.com/github/atom) module names are usually in - the `module-name` form. This rule only applies to `.coffee` files. + the `module-name` form. This rule only applies to `.js` files. +* Use newer ES6/ES2015 syntax where appropriate + * [`const`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const) + for requires and other constants + * [`let`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let) + for defining variables + * [Arrow functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) + instead of `function () { }` + * [Template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) + instead of string concatenation using `+` ## API Names From 686af28f547b656b703b8ec443dcea92751d64a1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 7 Mar 2016 09:45:13 -0800 Subject: [PATCH 2/4] Mention indent and semicolons --- docs/development/coding-style.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/development/coding-style.md b/docs/development/coding-style.md index f28b737921a6..5523c072b119 100644 --- a/docs/development/coding-style.md +++ b/docs/development/coding-style.md @@ -19,6 +19,8 @@ etc. ## JavaScript +* Use a two space indent, no hard tabs. +* End lines with a `;` * Files should **NOT** end with new line, because we want to match Google's styles. * File names should be concatenated with `-` instead of `_`, e.g. From 1c68aae43ecbc02d3b04b1b054f32202de093acc Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 7 Mar 2016 09:46:05 -0800 Subject: [PATCH 3/4] Mention npm run lint --- docs/development/coding-style.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/development/coding-style.md b/docs/development/coding-style.md index 5523c072b119..edc18549a722 100644 --- a/docs/development/coding-style.md +++ b/docs/development/coding-style.md @@ -2,6 +2,9 @@ These are the style guidelines for coding in Electron. +You can run `npm run lint` to show all coding style issues detected by `cpplint` +and `eslint`. + ## C++ and Python For C++ and Python, we follow Chromium's [Coding From 04c8bc38b2152b253920223e5e228f4bb20f52b0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 7 Mar 2016 13:58:49 -0800 Subject: [PATCH 4/4] Tweak lint sentence --- docs/development/coding-style.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/development/coding-style.md b/docs/development/coding-style.md index edc18549a722..5d70c24c9b0a 100644 --- a/docs/development/coding-style.md +++ b/docs/development/coding-style.md @@ -2,8 +2,8 @@ These are the style guidelines for coding in Electron. -You can run `npm run lint` to show all coding style issues detected by `cpplint` -and `eslint`. +You can run `npm run lint` to show any style issues detected by `cpplint` and +`eslint`. ## C++ and Python