From 3c504e9622588aadbb2c9f4163ea6699e75d6459 Mon Sep 17 00:00:00 2001 From: James Bunt Date: Wed, 23 Apr 2014 11:00:09 +1200 Subject: [PATCH 0001/1364] Remove unnecessary extra newline that confused some markdown previewers (in my case Atom.io). --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 3409c68ccd..ab248d07a1 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,6 @@ ```javascript var someStack = []; - // bad someStack[someStack.length] = 'abracadabra'; From 5fd7c6f08c0650ed67297fc83c8a0590c9a92cc8 Mon Sep 17 00:00:00 2001 From: Estelle Date: Mon, 23 Mar 2015 18:48:19 -0700 Subject: [PATCH 0002/1364] added naming convention of UPPERCASE names --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 2c6c5c6c7d..1116dcb4ba 100644 --- a/README.md +++ b/README.md @@ -3139,6 +3139,33 @@ Other Style Guides ]; ``` + + - [23.10](#naming--uppercase) Use UPPERCASE for nested object namespacing, global variables, and constants. + + + ```javascript + // bad + const namespace = namespace || {}; + + namespace.util.Widget = { + // ...stuff... + } + + // bad + const apiKey = '44b345234534t455245njkl523452-vbb9'; + + // good + const NAMESPACE = NAMESPACE || {}; + + NAMESPACE.util.Widget = { + // ...stuff... + } + + // good + const API_KEY = '44b345234534t455245njkl523452-vbb9'; + ``` + + **[⬆ back to top](#table-of-contents)** ## Accessors From 53ac64adf5d52e89b34e01a2befe8fa9e990662f Mon Sep 17 00:00:00 2001 From: Christophe Hurpeau Date: Tue, 23 Jun 2015 18:00:55 +0200 Subject: [PATCH 0003/1364] 18.6: blocks and blank line: add example with array --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 0c94d2dd7a..0485737255 100644 --- a/README.md +++ b/README.md @@ -1415,6 +1415,26 @@ }; return obj; + + // bad + const arr = [ + function foo() { + }, + function bar() { + }, + ]; + return arr; + + // good + const arr = [ + function foo() { + }, + + function bar() { + }, + ]; + + return arr; ``` From 26dd0434141938a3e03ef4b37c38765f4c030137 Mon Sep 17 00:00:00 2001 From: Manoj Kumar Date: Tue, 23 Jun 2015 22:13:05 +0530 Subject: [PATCH 0004/1364] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0c94d2dd7a..43244dc2d7 100644 --- a/README.md +++ b/README.md @@ -2000,6 +2000,7 @@ - [JSBooks](http://jsbooks.revolunet.com/) - Julien Bouquillon - [Third Party JavaScript](http://manning.com/vinegar/) - Ben Vinegar and Anton Kovalyov - [Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript](http://amzn.com/0321812182) - David Herman + - [Eloquent JavaScript](http://eloquentjavascript.net/) - Marijn Haverbeke **Blogs** From e9b59b76a5287a4aed3df94ed8b06ff0ad5fbd35 Mon Sep 17 00:00:00 2001 From: Chris Portela Date: Wed, 24 Jun 2015 15:51:25 -0400 Subject: [PATCH 0005/1364] Update .eslintrc with other react class properties In `eslint-plugin-react`'s page on their sorting rules they show the order I showed here. https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md#rule-options I noticed because according to the current rules `contextTypes` goes below `render` and I also noticed other methods were missing from the list. Since we're being specific we should also include the other methods and properties that `eslint-plugin-react` handles by default. --- linters/.eslintrc | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/linters/.eslintrc b/linters/.eslintrc index 93b84a54fe..c99a626e71 100644 --- a/linters/.eslintrc +++ b/linters/.eslintrc @@ -190,18 +190,23 @@ "react/wrap-multilines": 2, "react/sort-comp": [2, { "order": [ - "displayName", - "mixins", - "statics", - "propTypes", - "getDefaultProps", - "getInitialState", - "componentWillMount", - "componentDidMount", - "componentWillReceiveProps", - "shouldComponentUpdate", - "componentWillUpdate", - "componentWillUnmount", + 'displayName', + 'propTypes', + 'contextTypes', + 'childContextTypes', + 'mixins', + 'statics', + 'defaultProps', + 'getDefaultProps', + 'getInitialState', + 'getChildContext', + 'componentWillMount', + 'componentDidMount', + 'componentWillReceiveProps', + 'shouldComponentUpdate', + 'componentWillUpdate', + 'componentDidUpdate', + 'componentWillUnmount', "/^on.+$/", "/^get.+$/", "/^render.+$/", From fe42d0bfa3290efbeb3360e0f0b1e8c69c3ca3fd Mon Sep 17 00:00:00 2001 From: Chris Portela Date: Wed, 24 Jun 2015 16:02:21 -0400 Subject: [PATCH 0006/1364] Made single quotes to double quotes --- linters/.eslintrc | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/linters/.eslintrc b/linters/.eslintrc index c99a626e71..b904f3ec6e 100644 --- a/linters/.eslintrc +++ b/linters/.eslintrc @@ -190,23 +190,23 @@ "react/wrap-multilines": 2, "react/sort-comp": [2, { "order": [ - 'displayName', - 'propTypes', - 'contextTypes', - 'childContextTypes', - 'mixins', - 'statics', - 'defaultProps', - 'getDefaultProps', - 'getInitialState', - 'getChildContext', - 'componentWillMount', - 'componentDidMount', - 'componentWillReceiveProps', - 'shouldComponentUpdate', - 'componentWillUpdate', - 'componentDidUpdate', - 'componentWillUnmount', + "displayName", + "propTypes", + "contextTypes", + "childContextTypes", + "mixins", + "statics", + "defaultProps", + "getDefaultProps", + "getInitialState", + "getChildContext", + "componentWillMount", + "componentDidMount", + "componentWillReceiveProps", + "shouldComponentUpdate", + "componentWillUpdate", + "componentDidUpdate", + "componentWillUnmount", "/^on.+$/", "/^get.+$/", "/^render.+$/", From b020a431b0ffff92b37e3016cbd8fb7e9575fe77 Mon Sep 17 00:00:00 2001 From: Nikita Gusakov Date: Thu, 25 Jun 2015 16:31:27 +0300 Subject: [PATCH 0007/1364] Added "prefer-const" rule Added new ES6 rule, introduced in eslint 0.23.0 > This rule is aimed to flag variables that are declared using let keyword, but never modified after initial assignment. --- linters/.eslintrc | 1 + 1 file changed, 1 insertion(+) diff --git a/linters/.eslintrc b/linters/.eslintrc index b904f3ec6e..6ff0fa3b07 100644 --- a/linters/.eslintrc +++ b/linters/.eslintrc @@ -37,6 +37,7 @@ * ES6 */ "no-var": 2, // http://eslint.org/docs/rules/no-var + "prefer-const": 2, // http://eslint.org/docs/rules/prefer-const /** * Variables From d2792f27cbb91905a55b943edef68667c840ee66 Mon Sep 17 00:00:00 2001 From: Horace Ko Date: Thu, 25 Jun 2015 11:54:22 -0700 Subject: [PATCH 0008/1364] Recommend using .jsx extension for React components, rather than .js. --- react/README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/react/README.md b/react/README.md index 3ff7bb9f37..afcf1020ad 100644 --- a/react/README.md +++ b/react/README.md @@ -24,8 +24,8 @@ ## Naming - - **Extensions**: Use `.js` extension for React components. - - **Filename**: Use PascalCase for filenames. E.g., `ReservationCard.js`. + - **Extensions**: Use `.jsx` extension for React components. + - **Filename**: Use PascalCase for filenames. E.g., `ReservationCard.jsx`. - **Reference Naming**: Use PascalCase for React components and camelCase for their instances: ```javascript // bad @@ -41,13 +41,13 @@ const reservationItem = ; ``` - **Component Naming**: Use the filename as the component name. So `ReservationCard.js` should have a reference name of ReservationCard. However, for root components of a directory, use index.js as the filename and use the directory name as the component name: + **Component Naming**: Use the filename as the component name. For example, `ReservationCard.jsx` should have a reference name of `ReservationCard`. However, for root components of a directory, use `index.jsx` as the filename and use the directory name as the component name: ```javascript // bad - const Footer = require('./Footer/Footer.js') + const Footer = require('./Footer/Footer.jsx') // bad - const Footer = require('./Footer/index.js') + const Footer = require('./Footer/index.jsx') // good const Footer = require('./Footer') @@ -55,7 +55,7 @@ ## Declaration - - Do not use displayName for naming components, instead name the component by reference. + - Do not use displayName for naming components. Instead, name the component by reference. ```javascript // bad @@ -72,7 +72,7 @@ ``` ## Alignment - - Follow these alignment styles for js syntax + - Follow these alignment styles for JS syntax ```javascript // bad @@ -98,7 +98,7 @@ ``` ## Quotes - - Always use double quotes (`"`) for JSX attributes, but single quotes for all other JavaScript. + - Always use double quotes (`"`) for JSX attributes, but single quotes for all other JS. ```javascript // bad @@ -197,7 +197,7 @@ ``` ## Methods - - Do not use underscore prefix for internal methods of a react component. + - Do not use underscore prefix for internal methods of a React component. ```javascript // bad React.createClass({ @@ -219,10 +219,10 @@ ``` ## Ordering - - Always follow the following order for methods in a react component: + - Always follow the following order for methods in a React component: 1. displayName - 2. mixins (as of React v0.13 mixins are deprecated) + 2. mixins (as of React v0.13, mixins are deprecated) 3. statics 4. propTypes 5. getDefaultProps From ee899996b6b6e3b2d098ee71725aef9d8b368ec8 Mon Sep 17 00:00:00 2001 From: Tomek Wiszniewski Date: Sat, 2 May 2015 00:14:17 +0200 Subject: [PATCH 0009/1364] Allow reserved words as keys in ES6 module context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `