diff --git a/.gitignore b/.gitignore index 3c3629e647..5171c54083 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +npm-debug.log \ No newline at end of file diff --git a/README.md b/README.md index faadf80e4e..1dca205347 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,17 @@ -# Airbnb JavaScript Style Guide() { +# pebblecode JavaScript Style Guide() { *A mostly reasonable approach to JavaScript* -[![Downloads](https://img.shields.io/npm/dm/eslint-config-airbnb.svg)](https://www.npmjs.com/package/eslint-config-airbnb) +[![Downloads](https://img.shields.io/npm/dm/eslint-config-pebblecode.svg)](https://www.npmjs.com/package/eslint-config-pebblecode) [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/airbnb/javascript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +** Making Updates? [See here](./packages/eslint-config-pebblecode/README.md)** + Other Style Guides - [ES5](es5/) - [React](react/) - - [CSS & Sass](https://github.com/airbnb/css) - - [Ruby](https://github.com/airbnb/ruby) + - [CSS & Sass](https://github.com/pebblecode/css) + - [Ruby](https://github.com/pebblecode/ruby) ## Table of Contents @@ -145,7 +147,7 @@ Other Style Guides const item = {}; ``` - - [3.2](#3.2) If your code will be executed in browsers in script context, don't use [reserved words](http://es5.github.io/#x7.6.1) as keys. It won't work in IE8. [More info](https://github.com/airbnb/javascript/issues/61). It’s OK to use them in ES6 modules and server-side code. + - [3.2](#3.2) If your code will be executed in browsers in script context, don't use [reserved words](http://es5.github.io/#x7.6.1) as keys. It won't work in IE8. [More info](https://github.com/pebblecode/javascript/issues/61). It’s OK to use them in ES6 modules and server-side code. ```javascript // bad @@ -408,7 +410,7 @@ Other Style Guides ``` - [6.2](#6.2) Strings longer than 100 characters should be written across multiple lines using string concatenation. - - [6.3](#6.3) Note: If overused, long strings with concatenation could impact performance. [jsPerf](http://jsperf.com/ya-string-concat) & [Discussion](https://github.com/airbnb/javascript/issues/40). + - [6.3](#6.3) Note: If overused, long strings with concatenation could impact performance. [jsPerf](http://jsperf.com/ya-string-concat) & [Discussion](https://github.com/pebblecode/javascript/issues/40). ```javascript // bad @@ -799,15 +801,15 @@ Other Style Guides ```javascript // bad - const AirbnbStyleGuide = require('./AirbnbStyleGuide'); - module.exports = AirbnbStyleGuide.es6; + const pebblecodeStyleGuide = require('./pebblecodeStyleGuide'); + module.exports = pebblecodeStyleGuide.es6; // ok - import AirbnbStyleGuide from './AirbnbStyleGuide'; - export default AirbnbStyleGuide.es6; + import pebblecodeStyleGuide from './pebblecodeStyleGuide'; + export default pebblecodeStyleGuide.es6; // best - import { es6 } from './AirbnbStyleGuide'; + import { es6 } from './pebblecodeStyleGuide'; export default es6; ``` @@ -817,10 +819,10 @@ Other Style Guides ```javascript // bad - import * as AirbnbStyleGuide from './AirbnbStyleGuide'; + import * as pebblecodeStyleGuide from './pebblecodeStyleGuide'; // good - import AirbnbStyleGuide from './AirbnbStyleGuide'; + import pebblecodeStyleGuide from './pebblecodeStyleGuide'; ``` - [10.3](#10.3) And do not export directly from an import. @@ -830,11 +832,11 @@ Other Style Guides ```javascript // bad // filename es6.js - export { es6 as default } from './airbnbStyleGuide'; + export { es6 as default } from './pebblecodeStyleGuide'; // good // filename es6.js - import { es6 } from './AirbnbStyleGuide'; + import { es6 } from './pebblecodeStyleGuide'; export default es6; ``` @@ -1519,43 +1521,23 @@ Other Style Guides return arr; ``` - - [18.8](#18.8) Do not pad your blocks with blank lines. - + - [18.8](#18.8) Do pad your blocks with blank lines. + ***** THIS RULE IS DIFFERENT TO AIRBNB ********* + ```javascript - // bad + // use your judgement to add padding to improve readability. function bar() { console.log(foo); } - - // also bad - if (baz) { - - console.log(qux); - } else { - console.log(foo); - - } - - // good - function bar() { - console.log(foo); - } - - // good - if (baz) { - console.log(qux); - } else { - console.log(foo); - } ``` **[⬆ back to top](#table-of-contents)** ## Commas - + ***** THIS RULE IS DIFFERENT TO AIRBNB ********* - [19.1](#19.1) Leading commas: **Nope.** ```javascript @@ -1570,7 +1552,7 @@ Other Style Guides const story = [ once, upon, - aTime, + aTime ]; // bad @@ -1586,12 +1568,13 @@ Other Style Guides firstName: 'Ada', lastName: 'Lovelace', birthYear: 1815, - superPower: 'computers', + superPower: 'computers' }; ``` - - [19.2](#19.2) Additional trailing comma: **Yup.** + - [19.2](#19.2) Additional trailing comma: **NO.** + ***** THIS RULE IS DIFFERENT TO AIRBNB ********* > Why? This leads to cleaner git diffs. Also, transpilers like Babel will remove the additional trailing comma in the transpiled code which means you don't have to worry about the [trailing comma problem](es5/README.md#commas) in legacy browsers. ```javascript @@ -1716,7 +1699,7 @@ Other Style Guides const val = inputValue >> 0; ``` - - [21.5](#21.5) **Note:** Be careful when using bitshift operations. Numbers are represented as [64-bit values](http://es5.github.io/#x4.3.19), but Bitshift operations always return a 32-bit integer ([source](http://es5.github.io/#x11.7)). Bitshift can lead to unexpected behavior for integer values larger than 32 bits. [Discussion](https://github.com/airbnb/javascript/issues/109). Largest signed 32-bit Int is 2,147,483,647: + - [21.5](#21.5) **Note:** Be careful when using bitshift operations. Numbers are represented as [64-bit values](http://es5.github.io/#x4.3.19), but Bitshift operations always return a 32-bit integer ([source](http://es5.github.io/#x11.7)). Bitshift can lead to unexpected behavior for integer values larger than 32 bits. [Discussion](https://github.com/pebblecode/javascript/issues/109). Largest signed 32-bit Int is 2,147,483,647: ```javascript 2147483647 >> 0 //=> 2147483647 @@ -1864,12 +1847,12 @@ Other Style Guides - [22.8](#22.8) Use PascalCase when you export a singleton / function library / bare object. ```javascript - const AirbnbStyleGuide = { + const pebblecodeStyleGuide = { es6: { } }; - export default AirbnbStyleGuide; + export default pebblecodeStyleGuide; ``` @@ -2067,7 +2050,7 @@ Other Style Guides - Whichever testing framework you use, you should be writing tests! - Strive to write many small pure functions, and minimize where mutations occur. - Be cautious about stubs and mocks - they can make your tests more brittle. - - We primarily use [`mocha`](https://www.npmjs.com/package/mocha) at Airbnb. [`tape`](https://www.npmjs.com/package/tape) is also used occasionally for small, separate modules. + - We primarily use [`mocha`](https://www.npmjs.com/package/mocha) at pebblecode. [`tape`](https://www.npmjs.com/package/tape) is also used occasionally for small, separate modules. - 100% test coverage is a good goal to strive for, even if it's not always practical to reach it. - Whenever you fix a bug, _write a regression test_. A bug fixed without a regression test is almost certainly going to break again in the future. @@ -2104,9 +2087,9 @@ Other Style Guides **Tools** - Code Style Linters - + [ESlint](http://eslint.org/) - [Airbnb Style .eslintrc](https://github.com/airbnb/javascript/blob/master/linters/.eslintrc) - + [JSHint](http://jshint.com/) - [Airbnb Style .jshintrc](https://github.com/airbnb/javascript/blob/master/linters/jshintrc) - + [JSCS](https://github.com/jscs-dev/node-jscs) - [Airbnb Style Preset](https://github.com/jscs-dev/node-jscs/blob/master/presets/airbnb.json) + + [ESlint](http://eslint.org/) - [pebblecode Style .eslintrc](https://github.com/pebblecode/javascript/blob/master/linters/.eslintrc) + + [JSHint](http://jshint.com/) - [pebblecode Style .jshintrc](https://github.com/pebblecode/javascript/blob/master/linters/jshintrc) + + [JSCS](https://github.com/jscs-dev/node-jscs) - [pebblecode Style Preset](https://github.com/jscs-dev/node-jscs/blob/master/presets/pebblecode.json) **Other Style Guides** @@ -2117,7 +2100,7 @@ Other Style Guides **Other Styles** - [Naming this in nested functions](https://gist.github.com/cjohansen/4135065) - Christian Johansen - - [Conditional Callbacks](https://github.com/airbnb/javascript/issues/52) - Ross Allen + - [Conditional Callbacks](https://github.com/pebblecode/javascript/issues/52) - Ross Allen - [Popular JavaScript Coding Conventions on Github](http://sideeffect.kr/popularconvention/#javascript) - JeongHoon Byun - [Multiple var statements in JavaScript, not superfluous](http://benalman.com/news/2012/05/multiple-var-statements-javascript/) - Ben Alman @@ -2175,7 +2158,7 @@ Other Style Guides - **Aan Zee**: [AanZee/javascript](https://github.com/AanZee/javascript) - **Adult Swim**: [adult-swim/javascript](https://github.com/adult-swim/javascript) - - **Airbnb**: [airbnb/javascript](https://github.com/airbnb/javascript) + - **pebblecode**: [pebblecode/javascript](https://github.com/pebblecode/javascript) - **Apartmint**: [apartmint/javascript](https://github.com/apartmint/javascript) - **Avalara**: [avalara/javascript](https://github.com/avalara/javascript) - **Billabong**: [billabong/javascript](https://github.com/billabong/javascript) @@ -2252,22 +2235,22 @@ Other Style Guides ## The JavaScript Style Guide Guide - - [Reference](https://github.com/airbnb/javascript/wiki/The-JavaScript-Style-Guide-Guide) + - [Reference](https://github.com/pebblecode/javascript/wiki/The-JavaScript-Style-Guide-Guide) ## Chat With Us About JavaScript - - Find us on [gitter](https://gitter.im/airbnb/javascript). + - Find us on [gitter](https://gitter.im/pebblecode/javascript). ## Contributors - - [View Contributors](https://github.com/airbnb/javascript/graphs/contributors) + - [View Contributors](https://github.com/pebblecode/javascript/graphs/contributors) ## License (The MIT License) -Copyright (c) 2014 Airbnb +Copyright (c) 2014 pebblecode Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/es5/README.md b/es5/README.md index 2d24f1a4a2..536d31a726 100644 --- a/es5/README.md +++ b/es5/README.md @@ -1,6 +1,6 @@ -[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/airbnb/javascript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/pebblecode/javascript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) -# Airbnb JavaScript Style Guide() { +# pebblecode JavaScript Style Guide() { *A mostly reasonable approach to JavaScript* @@ -86,7 +86,7 @@ var item = {}; ``` - - Don't use [reserved words](http://es5.github.io/#x7.6.1) as keys. It won't work in IE8. [More info](https://github.com/airbnb/javascript/issues/61). + - Don't use [reserved words](http://es5.github.io/#x7.6.1) as keys. It won't work in IE8. [More info](https://github.com/pebblecode/javascript/issues/61). ```javascript // bad @@ -195,7 +195,7 @@ ``` - Strings longer than 100 characters should be written across multiple lines using string concatenation. - - Note: If overused, long strings with concatenation could impact performance. [jsPerf](http://jsperf.com/ya-string-concat) & [Discussion](https://github.com/airbnb/javascript/issues/40). + - Note: If overused, long strings with concatenation could impact performance. [jsPerf](http://jsperf.com/ya-string-concat) & [Discussion](https://github.com/pebblecode/javascript/issues/40). ```javascript // bad @@ -1100,7 +1100,7 @@ var val = inputValue >> 0; ``` - - **Note:** Be careful when using bitshift operations. Numbers are represented as [64-bit values](http://es5.github.io/#x4.3.19), but Bitshift operations always return a 32-bit integer ([source](http://es5.github.io/#x11.7)). Bitshift can lead to unexpected behavior for integer values larger than 32 bits. [Discussion](https://github.com/airbnb/javascript/issues/109). Largest signed 32-bit Int is 2,147,483,647: + - **Note:** Be careful when using bitshift operations. Numbers are represented as [64-bit values](http://es5.github.io/#x4.3.19), but Bitshift operations always return a 32-bit integer ([source](http://es5.github.io/#x11.7)). Bitshift can lead to unexpected behavior for integer values larger than 32 bits. [Discussion](https://github.com/pebblecode/javascript/issues/109). Largest signed 32-bit Int is 2,147,483,647: ```javascript 2147483647 >> 0 //=> 2147483647 @@ -1427,7 +1427,7 @@ ## Modules - - The module should start with a `!`. This ensures that if a malformed module forgets to include a final semicolon there aren't errors in production when the scripts get concatenated. [Explanation](https://github.com/airbnb/javascript/issues/44#issuecomment-13063933) + - The module should start with a `!`. This ensures that if a malformed module forgets to include a final semicolon there aren't errors in production when the scripts get concatenated. [Explanation](https://github.com/pebblecode/javascript/issues/44#issuecomment-13063933) - The file should be named with camelCase, live in a folder with the same name, and match the name of the single export. - Add a method called `noConflict()` that sets the exported module to the previous version and returns this one. - Always declare `'use strict';` at the top of the module. @@ -1562,8 +1562,8 @@ **Tools** - Code Style Linters - + [JSHint](http://www.jshint.com/) - [Airbnb Style .jshintrc](https://github.com/airbnb/javascript/blob/master/linters/jshintrc) - + [JSCS](https://github.com/jscs-dev/node-jscs) - [Airbnb Style Preset](https://github.com/jscs-dev/node-jscs/blob/master/presets/airbnb.json) + + [JSHint](http://www.jshint.com/) - [pebblecode Style .jshintrc](https://github.com/pebblecode/javascript/blob/master/linters/jshintrc) + + [JSCS](https://github.com/jscs-dev/node-jscs) - [pebblecode Style Preset](https://github.com/jscs-dev/node-jscs/blob/master/presets/pebblecode.json) **Other Style Guides** @@ -1575,7 +1575,7 @@ **Other Styles** - [Naming this in nested functions](https://gist.github.com/4135065) - Christian Johansen - - [Conditional Callbacks](https://github.com/airbnb/javascript/issues/52) - Ross Allen + - [Conditional Callbacks](https://github.com/pebblecode/javascript/issues/52) - Ross Allen - [Popular JavaScript Coding Conventions on Github](http://sideeffect.kr/popularconvention/#javascript) - JeongHoon Byun - [Multiple var statements in JavaScript, not superfluous](http://benalman.com/news/2012/05/multiple-var-statements-javascript/) - Ben Alman @@ -1633,7 +1633,7 @@ - **Aan Zee**: [AanZee/javascript](https://github.com/AanZee/javascript) - **Adult Swim**: [adult-swim/javascript](https://github.com/adult-swim/javascript) - - **Airbnb**: [airbnb/javascript](https://github.com/airbnb/javascript) + - **pebblecode**: [pebblecode/javascript](https://github.com/pebblecode/javascript) - **Apartmint**: [apartmint/javascript](https://github.com/apartmint/javascript) - **Avalara**: [avalara/javascript](https://github.com/avalara/javascript) - **Billabong**: [billabong/javascript](https://github.com/billabong/javascript) @@ -1701,22 +1701,22 @@ ## The JavaScript Style Guide Guide - - [Reference](https://github.com/airbnb/javascript/wiki/The-JavaScript-Style-Guide-Guide) + - [Reference](https://github.com/pebblecode/javascript/wiki/The-JavaScript-Style-Guide-Guide) ## Chat With Us About JavaScript - - Find us on [gitter](https://gitter.im/airbnb/javascript). + - Find us on [gitter](https://gitter.im/pebblecode/javascript). ## Contributors - - [View Contributors](https://github.com/airbnb/javascript/graphs/contributors) + - [View Contributors](https://github.com/pebblecode/javascript/graphs/contributors) ## License (The MIT License) -Copyright (c) 2014 Airbnb +Copyright (c) 2014 pebblecode Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/linters/.eslintrc b/linters/.eslintrc index 9e203a5473..1817f2064a 100644 --- a/linters/.eslintrc +++ b/linters/.eslintrc @@ -1,5 +1,5 @@ // Use this file as a starting point for your project's .eslintrc. // Copy this file, and add rule overrides as needed. { - "extends": "airbnb" + "extends": "pebblecode" } diff --git a/linters/README.md b/linters/README.md index 1deac701c7..23d5a8a324 100644 --- a/linters/README.md +++ b/linters/README.md @@ -4,7 +4,7 @@ Our `.eslintrc` requires the following NPM packages: ``` npm install --save-dev \ - eslint-config-airbnb \ + eslint-config-pebblecode \ eslint \ babel-eslint \ eslint-plugin-react diff --git a/linters/SublimeLinter/SublimeLinter.sublime-settings b/linters/SublimeLinter/SublimeLinter.sublime-settings index 12360f3f1c..ec0ee95bb1 100644 --- a/linters/SublimeLinter/SublimeLinter.sublime-settings +++ b/linters/SublimeLinter/SublimeLinter.sublime-settings @@ -1,5 +1,5 @@ /** - * Airbnb JSHint settings for use with SublimeLinter and Sublime Text 2. + * pebblecode JSHint settings for use with SublimeLinter and Sublime Text 2. * * 1. Install SublimeLinter at https://github.com/SublimeLinter/SublimeLinter * 2. Open user preferences for the SublimeLinter package in Sublime Text 2 diff --git a/package.json b/package.json index dc0225dc08..afbe4b20dd 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,19 @@ { - "name": "airbnb-style", - "version": "2.0.0", + "name": "pebblecode-style", + "version": "2.2.0", "description": "A mostly reasonable approach to JavaScript.", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "publish-all": "npm publish && cd ./packages/eslint-config-airbnb && npm publish" + "publish-all": "npm publish && cd ./packages/eslint-config-pebblecode && npm publish" }, "repository": { "type": "git", - "url": "https://github.com/airbnb/javascript.git" + "url": "https://github.com/pebblecode/javascript.git" }, "keywords": [ "style guide", "lint", - "airbnb", + "pebblecode", "es6", "es2015", "react", @@ -22,7 +22,7 @@ "author": "Harrison Shoff (https://twitter.com/hshoff)", "license": "MIT", "bugs": { - "url": "https://github.com/airbnb/javascript/issues" + "url": "https://github.com/pebblecode/javascript/issues" }, - "homepage": "https://github.com/airbnb/javascript" + "homepage": "https://github.com/pebblecode/javascript" } diff --git a/packages/eslint-config-airbnb/.eslintrc b/packages/eslint-config-airbnb/.eslintrc deleted file mode 100644 index 4b3b1fa429..0000000000 --- a/packages/eslint-config-airbnb/.eslintrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "airbnb", - "rules": { - // disable requiring trailing commas because it might be nice to revert to - // being JSON at some point, and I don't want to make big changes now. - "comma-dangle": 0 - } -} diff --git a/packages/eslint-config-airbnb/README.md b/packages/eslint-config-airbnb/README.md deleted file mode 100644 index b328aa9eb6..0000000000 --- a/packages/eslint-config-airbnb/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# eslint-config-airbnb - -This package provides Airbnb's .eslintrc as an extensible shared config. - -## Usage - -We export three ESLint configurations for your usage. - -### eslint-config-airbnb - -Our default export contains all of our ESLint rules, including EcmaScript 6+ -and React. It requires `eslint` and `eslint-plugin-react`. - -1. `npm install --save-dev eslint-config-airbnb eslint-plugin-react eslint` -2. add `"extends": "airbnb"` to your .eslintrc - -### eslint-config-airbnb/base - -Lints ES6+ but does not lint React. Requires `eslint`. - -1. `npm install --save-dev eslint-config-airbnb eslint` -2. add `"extends": "airbnb/base"` to your .eslintrc - -### eslint-config-airbnb/legacy - -Lints ES5 and below. Only requires `eslint`. - -1. `npm install --save-dev eslint-config-airbnb eslint` -2. add `"extends": "airbnb/legacy"` to your .eslintrc - -See [Airbnb's Javascript styleguide](https://github.com/airbnb/javascript) and -the [ESlint config docs](http://eslint.org/docs/user-guide/configuring#extending-configuration-files) -for more information. - -## Improving this config - -Consider adding test cases if you're making complicated rules changes, like -anything involving regexes. Perhaps in a distant future, we could use literate -programming to structure our README as test cases for our .eslintrc? - -You can run tests with `npm test`. - -You can make sure this module lints with itself using `npm run lint`. - -## Changelog - -### 1.0.0 -- require `eslint` `v1.0.0` or higher -- removes `babel-eslint` dependency - -### 0.1.1 -- remove id-length rule (#569) -- enable `no-mixed-spaces-and-tabs` (#539) -- enable `no-const-assign` (#560) -- enable `space-before-keywords` (#554) - -### 0.1.0 - -- switch to modular rules files courtesy the [eslint-config-default][ecd] - project and [@taion][taion]. [PR][pr-modular] -- export `eslint-config-airbnb/legacy` for ES5-only users. - `eslint-config-airbnb/legacy` does not require the `babel-eslint` parser. - [PR][pr-legacy] - -[ecd]: https://github.com/walmartlabs/eslint-config-defaults -[taion]: https://github.com/taion -[pr-modular]: https://github.com/airbnb/javascript/pull/526 -[pr-legacy]: https://github.com/airbnb/javascript/pull/527 - -### 0.0.9 - -- add rule no-undef -- add rule id-length - -### 0.0.8 - - now has a changelog - - now is modular (see instructions above for with react and without react versions) diff --git a/packages/eslint-config-airbnb/base.js b/packages/eslint-config-airbnb/base.js deleted file mode 100644 index db661c5d1a..0000000000 --- a/packages/eslint-config-airbnb/base.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - 'extends': [ - 'eslint-config-airbnb/legacy', - 'eslint-config-airbnb/rules/es6', - ], - 'rules': {} -}; diff --git a/packages/eslint-config-airbnb/index.js b/packages/eslint-config-airbnb/index.js deleted file mode 100644 index 46d601fe3f..0000000000 --- a/packages/eslint-config-airbnb/index.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - 'extends': [ - 'eslint-config-airbnb/base', - 'eslint-config-airbnb/rules/react', - ], - rules: {} -}; diff --git a/packages/eslint-config-airbnb/legacy.js b/packages/eslint-config-airbnb/legacy.js deleted file mode 100644 index 83a4931e84..0000000000 --- a/packages/eslint-config-airbnb/legacy.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = { - 'extends': [ - 'eslint-config-airbnb/rules/best-practices', - 'eslint-config-airbnb/rules/errors', - 'eslint-config-airbnb/rules/legacy', - 'eslint-config-airbnb/rules/node', - 'eslint-config-airbnb/rules/strict', - 'eslint-config-airbnb/rules/style', - 'eslint-config-airbnb/rules/variables' - ], - 'env': { - 'browser': true, - 'node': true, - 'amd': false, - 'mocha': false, - 'jasmine': false - }, - 'ecmaFeatures': {}, - 'globals': {}, - 'rules': {} -}; diff --git a/packages/eslint-config-airbnb/node_modules/eslint-config-airbnb b/packages/eslint-config-airbnb/node_modules/eslint-config-airbnb deleted file mode 120000 index a96aa0ea9d..0000000000 --- a/packages/eslint-config-airbnb/node_modules/eslint-config-airbnb +++ /dev/null @@ -1 +0,0 @@ -.. \ No newline at end of file diff --git a/packages/eslint-config-airbnb/rules/strict.js b/packages/eslint-config-airbnb/rules/strict.js deleted file mode 100644 index 6d32f8ca59..0000000000 --- a/packages/eslint-config-airbnb/rules/strict.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - 'rules': { - // babel inserts `'use strict';` for us - 'strict': [2, 'never'] - } -}; diff --git a/packages/eslint-config-pebblecode/.eslintrc b/packages/eslint-config-pebblecode/.eslintrc new file mode 100644 index 0000000000..acf38976e7 --- /dev/null +++ b/packages/eslint-config-pebblecode/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "pebblecode" +} diff --git a/packages/eslint-config-pebblecode/README.md b/packages/eslint-config-pebblecode/README.md new file mode 100644 index 0000000000..5ebc00f0f0 --- /dev/null +++ b/packages/eslint-config-pebblecode/README.md @@ -0,0 +1,94 @@ +# eslint-config-pebblecode + +This package provides pebblecode's .eslintrc as an extensible shared config. + +## Usage + +We export three ESLint configurations for your usage. + +### eslint-config-pebblecode + +Our default export contains all of our ESLint rules, including ES2015 +and React. It requires `eslint` and `eslint-plugin-react`. + +1. `npm install --save-dev eslint-config-pebblecode eslint-plugin-react eslint` +2. add `"extends": "pebblecode"` to your .eslintrc + +### eslint-config-pebblecode/basestrict + +Lints ES2015 but does not lint React. Requires `eslint`. + +1. `npm install --save-dev eslint-config-pebblecode eslint` +2. add `"extends": "pebblecode/base"` to your .eslintrc + +### eslint-config-pebblecode/legacy + +Lints ES5 and below. Only requires `eslint`. + +1. `npm install --save-dev eslint-config-pebblecode eslint` +2. add `"extends": "pebblecode/legacy"` to your .eslintrc + +See [pebblecode's Javascript styleguide](https://github.com/pebblecode/javascript) and +the [ESlint config docs](http://eslint.org/docs/user-guide/configuring#extending-configuration-files) +for more information. + +## Improving this config + +Consider adding test cases if you're making complicated rules changes, like +anything involving regexes. Perhaps in the distant future, we could use literate +programming to structure our README as test cases for our .eslintrc? + +You can run tests with `npm test`. + +You can make sure this module lints with itself using `npm run lint`. + +## Contributing + +In order to modify this package, you need to clone this repo. + +1. Make the changes you wish, including tests +2. Try out the updated rules locally by installing from local dir +3. Submit a PR back to the repo, or if you're flying by the seat of your pants, `GOTO 4` +4. `npm version minor` +5. `npm login` then `npm publish` +6. Commit and push your changes back to the repo + +## Changelog + +### 1.4.0 +- modify indent rule to include `{SwitchCase: 1}` + +### 1.3.0 +- add babel-eslint as default parser + +### 1.0.0 +- require `eslint` `v1.0.0` or higher +- removes `babel-eslint` dependency + +### 0.1.1 +- remove id-length rule (#569) +- enable `no-mixed-spaces-and-tabs` (#539) +- enable `no-const-assign` (#560) +- enable `space-before-keywords` (#554) + +### 0.1.0 + +- switch to modular rules files courtesy the [eslint-config-default][ecd] + project and [@taion][taion]. [PR][pr-modular] +- export `eslint-config-pebblecode/legacy` for ES5-only users. + `eslint-config-pebblecode/legacy` does not require the `babel-eslint` parser. + [PR][pr-legacy] + +[ecd]: https://github.com/walmartlabs/eslint-config-defaults +[taion]: https://github.com/taion +[pr-modular]: https://github.com/pebblecode/javascript/pull/526 +[pr-legacy]: https://github.com/pebblecode/javascript/pull/527 + +### 0.0.9 + +- add rule no-undef +- add rule id-length + +### 0.0.8 + - now has a changelog + - now is modular (see instructions above for with react and without react versions) diff --git a/packages/eslint-config-pebblecode/base.js b/packages/eslint-config-pebblecode/base.js new file mode 100644 index 0000000000..668a8a88bf --- /dev/null +++ b/packages/eslint-config-pebblecode/base.js @@ -0,0 +1,7 @@ +module.exports = { + 'extends': [ + 'eslint-config-pebblecode/legacy', + 'eslint-config-pebblecode/rules/es6', + ], + 'rules': {} +}; diff --git a/packages/eslint-config-pebblecode/index.js b/packages/eslint-config-pebblecode/index.js new file mode 100644 index 0000000000..79a9c354f6 --- /dev/null +++ b/packages/eslint-config-pebblecode/index.js @@ -0,0 +1,7 @@ +module.exports = { + 'extends': [ + 'eslint-config-pebblecode/base', + 'eslint-config-pebblecode/rules/react', + ], + rules: {} +}; diff --git a/packages/eslint-config-pebblecode/legacy.js b/packages/eslint-config-pebblecode/legacy.js new file mode 100644 index 0000000000..7f9666ef98 --- /dev/null +++ b/packages/eslint-config-pebblecode/legacy.js @@ -0,0 +1,21 @@ +module.exports = { + 'extends': [ + 'eslint-config-pebblecode/rules/best-practices', + 'eslint-config-pebblecode/rules/errors', + 'eslint-config-pebblecode/rules/legacy', + 'eslint-config-pebblecode/rules/node', + 'eslint-config-pebblecode/rules/strict', + 'eslint-config-pebblecode/rules/style', + 'eslint-config-pebblecode/rules/variables' + ], + 'env': { + 'browser': true, + 'node': true, + 'amd': false, + 'mocha': false, + 'jasmine': false + }, + 'ecmaFeatures': {}, + 'globals': {}, + 'rules': {} +}; diff --git a/packages/eslint-config-airbnb/package.json b/packages/eslint-config-pebblecode/package.json similarity index 61% rename from packages/eslint-config-airbnb/package.json rename to packages/eslint-config-pebblecode/package.json index 7eaca47e71..0962e2b862 100644 --- a/packages/eslint-config-airbnb/package.json +++ b/packages/eslint-config-pebblecode/package.json @@ -1,7 +1,7 @@ { - "name": "eslint-config-airbnb", - "version": "1.0.0", - "description": "Airbnb's ESLint config, following our styleguide", + "name": "eslint-config-pebblecode", + "version": "1.5.0", + "description": "pebblecode's ESLint config, following our styleguide, fork of airbnb styleguide", "main": "index.js", "scripts": { "lint": "eslint .", @@ -9,13 +9,13 @@ }, "repository": { "type": "git", - "url": "https://github.com/airbnb/javascript" + "url": "https://github.com/pebblecode/javascript" }, "keywords": [ "eslint", "eslintconfig", "config", - "airbnb", + "pebblecode", "javascript", "styleguide" ], @@ -29,16 +29,21 @@ "name": "Jordan Harband", "email": "ljharb@gmail.com", "url": "http://ljharb.codes" + }, + { + "name": "pebblecode", + "email": "opensource@pebblecode.com" } ], "license": "MIT", "bugs": { - "url": "https://github.com/airbnb/javascript/issues" + "url": "https://github.com/pebblecode/javascript/issues" }, - "homepage": "https://github.com/airbnb/javascript", + "homepage": "https://github.com/pebblecode/javascript", "devDependencies": { "babel-tape-runner": "1.2.0", - "eslint": "^1.8.0", + "eslint": "^1.9.0", + "eslint-plugin-babel": "^2.1.1", "eslint-plugin-react": "^3.7.1", "react": "^0.13.3", "tape": "^4.2.2" diff --git a/packages/eslint-config-airbnb/rules/best-practices.js b/packages/eslint-config-pebblecode/rules/best-practices.js similarity index 100% rename from packages/eslint-config-airbnb/rules/best-practices.js rename to packages/eslint-config-pebblecode/rules/best-practices.js diff --git a/packages/eslint-config-airbnb/rules/errors.js b/packages/eslint-config-pebblecode/rules/errors.js similarity index 100% rename from packages/eslint-config-airbnb/rules/errors.js rename to packages/eslint-config-pebblecode/rules/errors.js diff --git a/packages/eslint-config-airbnb/rules/es6.js b/packages/eslint-config-pebblecode/rules/es6.js similarity index 96% rename from packages/eslint-config-airbnb/rules/es6.js rename to packages/eslint-config-pebblecode/rules/es6.js index f192556a33..90522f8044 100644 --- a/packages/eslint-config-airbnb/rules/es6.js +++ b/packages/eslint-config-pebblecode/rules/es6.js @@ -1,6 +1,6 @@ module.exports = { 'env': { - 'es6': false + 'es6': false // one to look at. }, 'ecmaFeatures': { 'arrowFunctions': true, @@ -9,7 +9,7 @@ module.exports = { 'defaultParams': true, 'destructuring': true, 'forOf': true, - 'generators': false, + 'generators': true, 'modules': true, 'objectLiteralComputedProperties': true, 'objectLiteralDuplicateProperties': false, diff --git a/packages/eslint-config-airbnb/rules/legacy.js b/packages/eslint-config-pebblecode/rules/legacy.js similarity index 95% rename from packages/eslint-config-airbnb/rules/legacy.js rename to packages/eslint-config-pebblecode/rules/legacy.js index 1d0c518316..5f7b966c19 100644 --- a/packages/eslint-config-airbnb/rules/legacy.js +++ b/packages/eslint-config-pebblecode/rules/legacy.js @@ -1,4 +1,6 @@ module.exports = { + 'parser': 'babel-eslint', + 'rules': { // specify the maximum depth that blocks can be nested 'max-depth': [0, 4], diff --git a/packages/eslint-config-airbnb/rules/node.js b/packages/eslint-config-pebblecode/rules/node.js similarity index 92% rename from packages/eslint-config-airbnb/rules/node.js rename to packages/eslint-config-pebblecode/rules/node.js index 16b6f20d45..13c0080fd6 100644 --- a/packages/eslint-config-airbnb/rules/node.js +++ b/packages/eslint-config-pebblecode/rules/node.js @@ -1,6 +1,7 @@ module.exports = { 'env': { - 'node': true + 'node': true, + 'mocha': true }, 'rules': { // enforce return after a callback @@ -18,6 +19,6 @@ module.exports = { // restrict usage of specified node modules 'no-restricted-modules': 0, // disallow use of synchronous methods (off by default) - 'no-sync': 0 + 'no-sync': 0. } }; diff --git a/packages/eslint-config-airbnb/rules/react.js b/packages/eslint-config-pebblecode/rules/react.js similarity index 100% rename from packages/eslint-config-airbnb/rules/react.js rename to packages/eslint-config-pebblecode/rules/react.js diff --git a/packages/eslint-config-pebblecode/rules/strict.js b/packages/eslint-config-pebblecode/rules/strict.js new file mode 100644 index 0000000000..3cf2ccba01 --- /dev/null +++ b/packages/eslint-config-pebblecode/rules/strict.js @@ -0,0 +1,6 @@ +module.exports = { + 'rules': { + // babel inserts `'use strict';` for us but we also run node without babel so strict is allowed. + 'strict': 0 + } +}; diff --git a/packages/eslint-config-airbnb/rules/style.js b/packages/eslint-config-pebblecode/rules/style.js similarity index 98% rename from packages/eslint-config-airbnb/rules/style.js rename to packages/eslint-config-pebblecode/rules/style.js index c1d9ab9df8..1fb2c8db62 100644 --- a/packages/eslint-config-airbnb/rules/style.js +++ b/packages/eslint-config-pebblecode/rules/style.js @@ -10,6 +10,7 @@ module.exports = { 'comma-spacing': [2, {'before': false, 'after': true}], // enforce one true comma style 'comma-style': [2, 'last'], + 'comma-dangle': [2, 'never'], // require or disallow padding inside computed properties 'computed-property-spacing': 0, // enforces consistent naming when capturing the current execution context @@ -23,7 +24,7 @@ module.exports = { // this option enforces minimum and maximum identifier lengths (variable names, property names etc.) 'id-length': 0, // this option sets a specific tab width for your code - 'indent': [2, 2], + 'indent': [2, 2, {"SwitchCase": 1}], // specify whether double or single quotes should be used in JSX attributes 'jsx-quotes': 2, // enforces spacing between keys and values in object literal properties @@ -74,8 +75,6 @@ module.exports = { 'operator-assignment': 0, // enforce operators to be placed before or after line breaks 'operator-linebreak': 0, - // enforce padding within blocks - 'padded-blocks': [2, 'never'], // require quotes around object literal property names 'quote-props': 0, // specify whether double or single quotes should be used diff --git a/packages/eslint-config-airbnb/rules/variables.js b/packages/eslint-config-pebblecode/rules/variables.js similarity index 100% rename from packages/eslint-config-airbnb/rules/variables.js rename to packages/eslint-config-pebblecode/rules/variables.js diff --git a/packages/eslint-config-airbnb/test/.eslintrc b/packages/eslint-config-pebblecode/test/.eslintrc similarity index 100% rename from packages/eslint-config-airbnb/test/.eslintrc rename to packages/eslint-config-pebblecode/test/.eslintrc diff --git a/packages/eslint-config-airbnb/test/test-base.js b/packages/eslint-config-pebblecode/test/test-base.js similarity index 100% rename from packages/eslint-config-airbnb/test/test-base.js rename to packages/eslint-config-pebblecode/test/test-base.js diff --git a/packages/eslint-config-airbnb/test/test-react-order.js b/packages/eslint-config-pebblecode/test/test-react-order.js similarity index 95% rename from packages/eslint-config-airbnb/test/test-react-order.js rename to packages/eslint-config-pebblecode/test/test-react-order.js index 1a84b59230..77c4b6c1b9 100644 --- a/packages/eslint-config-airbnb/test/test-react-order.js +++ b/packages/eslint-config-pebblecode/test/test-react-order.js @@ -20,9 +20,9 @@ function lint(text) { function wrapComponent(body) { return ` -import React from 'react'; -export default class MyComponent extends React.Component { -${body} + import React from 'react'; + export default class MyComponent extends React.Component { + ${body} } `; } diff --git a/react/README.md b/react/README.md index 6b0a8e13e9..6b88fa06fc 100644 --- a/react/README.md +++ b/react/README.md @@ -1,4 +1,4 @@ -# Airbnb React/JSX Style Guide +# pebblecode React/JSX Style Guide *A mostly reasonable approach to React and JSX*