From 6dadda9e57098e6e87e0fdc8602f3e029ed0b742 Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Thu, 22 Dec 2016 01:33:29 +0100 Subject: [PATCH 01/21] docs(license): Add license file --- LICENSE | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6802bc4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file From 3b8aebdb9ed30dda69cdbda456b1a4894960c046 Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Thu, 22 Dec 2016 01:37:52 +0100 Subject: [PATCH 02/21] refactor(.gitignore): Add more ignores Ignoring debug files --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b512c09..4cc0196 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -node_modules \ No newline at end of file +node_modules +npm-debug.log +yarn-error.log +yarn.lock From 47be9e6e55d3bd11efefb546deecdfbd9d70af5d Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Thu, 22 Dec 2016 01:45:07 +0100 Subject: [PATCH 03/21] refactor(package.json): Update package.json tag values --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index a74c516..31441d0 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,17 @@ { "name": "eslint-config-casumo", "version": "1.0.0", - "description": "Holds Casumo's base JS .eslintrc as an extensible shared config", + "description": "ESLint shareable config for the Casumo JavaScript code style", "main": "index.js", - "scripts": {}, + "author": "Casumo", + "license": "MIT", + "homepage": "https://github.com/Casumo/eslint-config-casumo#readme", "repository": { "type": "git", - "url": "git+https://github.com/Casumo/eslint-config-casumo.git" + "url": "https://github.com/Casumo/eslint-config-casumo.git" }, - "author": "", - "license": "MIT", "bugs": { "url": "https://github.com/Casumo/eslint-config-casumo/issues" }, - "homepage": "https://github.com/Casumo/eslint-config-casumo#readme" + "scripts": {} } From ae27671c62babc6ef276dc17cce540a99200c1c5 Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Thu, 22 Dec 2016 01:47:37 +0100 Subject: [PATCH 04/21] refactor(package.json): Add new dev dependencies Added support for commitizen, and validation for commit messages. Also added eslint as a dev dependency and peer dependency --- package.json | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 31441d0..5383755 100644 --- a/package.json +++ b/package.json @@ -13,5 +13,23 @@ "bugs": { "url": "https://github.com/Casumo/eslint-config-casumo/issues" }, - "scripts": {} + "scripts": { + "commit": "git-cz", + "commitmsg": "validate-commit-msg" + }, + "devDependencies": { + "commitizen": "^2.9.2", + "cz-conventional-changelog": "^1.2.0", + "eslint": "^3.12.2", + "husky": "^0.12.0", + "validate-commit-msg": "^2.8.2" + }, + "peerDependencies": { + "eslint": "^3.12.2" + }, + "config": { + "commitizen": { + "path": "./node_modules/cz-conventional-changelog" + } + } } From 8ca91901633413505999f12bbd2a8422b71a34b3 Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Thu, 22 Dec 2016 01:48:04 +0100 Subject: [PATCH 05/21] docs(README): Update readme Updated readme to be more expressive --- README.md | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 71fec4d..1450c83 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,26 @@ # eslint-config-casumo -Holds Casumo's base JS .eslintrc as an extensible shared config +[![version](https://img.shields.io/npm/v/eslint-config-casumo.svg?style=flat-square)](https://www.npmjs.com/package/eslint-config-casumo) +[![downloads](https://img.shields.io/npm/dm/eslint-config-casumo.svg?style=flat-square)](http://npm-stat.com/charts.html?package=eslint-config-casumo&from=2015-08-01) +[![MIT License](https://img.shields.io/npm/l/eslint-config-casumo.svg?style=flat-square)](http://opensource.org/licenses/MIT) +[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) -## Install +> ESLint [shareable config](http://eslint.org/docs/developer-guide/shareable-configs.html) for the Casumo JavaScript code style + +## Installation ```bash -npm install eslint-config-casumo +npm install --save-dev eslint-config-casumo ``` ## Usage -Add the following to your `.eslintrc` file: -```javascript + +Once the `eslint-config-casumo` package is installed, you can use it by specifying `casumo` in the [`extends`](http://eslint.org/docs/user-guide/configuring#extending-configuration-files) section of your [ESLint configuration](http://eslint.org/docs/user-guide/configuring). + +```js { - "extends": "eslint-config-casumo" + "extends": "casumo", + "rules": { + // Additional, per-project rules... + } } ``` \ No newline at end of file From 2690ec87bca7f13eaf566c32214f7c4329c1c1ae Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Thu, 22 Dec 2016 03:05:17 +0100 Subject: [PATCH 06/21] refactor(rules): Enumerated all eslint rules Added all rules according to http://eslint.org/docs/rules/ --- .eslintrc | 6 ++ best-practices.js | 77 ++++++++++++++++++++ ecma-script-6.js | 38 ++++++++++ index.js | 153 +++------------------------------------ node-js-and-common-js.js | 18 +++++ package.json | 3 +- possible-errors.js | 39 ++++++++++ strict-mode.js | 9 +++ stylistic-issues.js | 89 +++++++++++++++++++++++ variables.js | 20 +++++ 10 files changed, 310 insertions(+), 142 deletions(-) create mode 100644 .eslintrc create mode 100644 best-practices.js create mode 100644 ecma-script-6.js create mode 100644 node-js-and-common-js.js create mode 100644 possible-errors.js create mode 100644 strict-mode.js create mode 100644 stylistic-issues.js create mode 100644 variables.js diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..871285a --- /dev/null +++ b/.eslintrc @@ -0,0 +1,6 @@ +{ + "extends": ["./index.js"], + "rules": { + "no-magic-numbers": 0 // because rules are 0, 1, 2 + } +} \ No newline at end of file diff --git a/best-practices.js b/best-practices.js new file mode 100644 index 0000000..22a4a3b --- /dev/null +++ b/best-practices.js @@ -0,0 +1,77 @@ +module.exports = { + env: { + browser: true, + node: true + }, + rules: { + // 'accessor-pairs': 2, + // 'array-callback-return': 2, + // 'block-scoped-var': 2, + // NO_RULE 'class-methods-use-this': 2, + // 'complexity': [2, 5], + // 'consistent-return': 2, + curly: [2, 'all'], + // 'default-case': 2, + // 'dot-location': [2, 'property'], + 'dot-notation': 2, + eqeqeq: 2, + 'guard-for-in': 2, + // 'no-alert': 2, + 'no-caller': 2, + // 'no-case-declarations': 2, + // 'no-div-regex': 2, + // NO_RULE 'no-else-return': 2, + // NO_RULE 'no-empty-function': 2, + // 'no-empty-pattern': 2, + // 'no-eq-null': 2, + 'no-eval': 2, + 'no-extend-native': 2, + // 'no-extra-bind': 2, + // 'no-extra-label': 2, + // 'no-fallthrough': 2, + // 'no-floating-decimal': 2, + // 'no-global-assign': 2, + // NO_RULE 'no-implicit-coercion': 2, + // 'no-implicit-globals': 2, + // 'no-implied-eval': 2, + // 'no-invalid-this': 2, + // 'no-iterator': 2, + // 'no-labels': 2, + // 'no-lone-blocks': 2, + // 'no-loop-func': 2, + // NO_RULE 'no-magic-numbers': 2, + // 'no-multi-spaces': 2, + 'no-multi-str': 2, + // 'no-new-func': 2, + // 'no-new-wrappers': 2, + 'no-new': 2, + // 'no-octal-escape': 2, + // 'no-octal': 2, + // NO_RULE 'no-param-reassign': 2, + // 'no-proto': 2, + // 'no-redeclare': 2, + // NO_RULE 'no-restricted-properties': 2, + 'no-return-assign': 2, + // NO_RULE 'no-return-await': 2, + // 'no-script-url': 2, + // 'no-self-assign': 2, + // 'no-self-compare': 2, + // 'no-sequences': 2, + // 'no-throw-literal': 2, + // 'no-unmodified-loop-condition': 2, + 'no-unused-expressions': 2, + // 'no-unused-labels': 2, + // 'no-useless-call': 2, + // 'no-useless-concat': 2, + // 'no-useless-escape': 2, + // 'no-useless-return': 2, + // 'no-void': 2, + // 'no-warning-comments': [2, { terms: [Object], location: 'anywhere' }], + 'no-with': 2, + radix: 2, + // NO_RULE 'require-await': 2, + 'vars-on-top': 2, + 'wrap-iife': 2 + // 'yoda': 2 + } +}; diff --git a/ecma-script-6.js b/ecma-script-6.js new file mode 100644 index 0000000..faa948f --- /dev/null +++ b/ecma-script-6.js @@ -0,0 +1,38 @@ +module.exports = { + env: { + browser: true, + node: true + }, + rules: { + // NO_RULE 'arrow-body-style': 2, + // NO_RULE 'arrow-parens': 2, + // 'arrow-spacing': [ 2, { before: true, after: true } ], + // 'constructor-super': 2, + // NO_RULE 'generator-star-spacing': 2, + // 'no-class-assign': 2, + // NO_RULE 'no-confusing-arrow': 2, + // 'no-const-assign': 2, + // 'no-dupe-class-members': 2, + // 'no-duplicate-imports': 2, + // 'no-new-symbol': 2, + // NO_RULE 'no-restricted-imports': 2, + // 'no-this-before-super': 2, + // 'no-useless-computed-key': 2, + // 'no-useless-constructor': 2, + // 'no-useless-rename': 2, + // NO_RULE 'no-var': 2, + // NO_RULE 'object-shorthand': 2, + // NO_RULE 'prefer-arrow-callback': 2, + // NO_RULE 'prefer-const': 2, + // NO_RULE 'prefer-numeric-literals': 2, + // NO_RULE 'prefer-rest-params': 2, + // NO_RULE 'prefer-spread': 2, + // NO_RULE 'prefer-template': 2, + // NO_RULE 'require-yield': 2, + // 'rest-spread-spacing': [ 2, 'never' ], + // NO_RULE 'sort-imports': 2, + // NO_RULE 'symbol-description': 2, + // 'template-curly-spacing': [ 2, 'never' ], + // 'yield-star-spacing': [ 2, 'both' ] + } +}; diff --git a/index.js b/index.js index ebd7c1f..79f3e6c 100644 --- a/index.js +++ b/index.js @@ -1,9 +1,18 @@ module.exports = { env: { browser: true, - node: true, - es6: true + node: true }, + extends: [ + './possible-errors.js', + './best-practices.js', + './strict-mode.js', + './variables.js', + './node-js-and-common-js.js', + './stylistic-issues.js', + './ecma-script-6.js' + ], + rules: {}, globals: { ActiveXObject: true, define: true, @@ -16,143 +25,5 @@ module.exports = { after: true, should: true, module: true - }, - rules: { - 'no-bitwise': 2, - 'camelcase': 2, - 'curly': [ - 2, - 'all' - ], - 'eqeqeq': 2, - 'no-eval': 2, - 'no-unused-expressions': 2, - 'guard-for-in': 2, - 'wrap-iife': 2, - 'indent': [ - 2, - 4, - { - SwitchCase: 1 - } - ], - 'no-use-before-define': [ - 'error', - { - functions: false, - classes: true - } - ], - 'func-style': [ - 'error', - 'declaration', - { - allowArrowFunctions: true - } - ], - 'new-cap': 2, - 'no-caller': 2, - 'no-empty': 2, - 'no-new': 2, - 'quotes': [ - 2, - 'single' - ], - 'strict': 0, - 'no-undef': 2, - 'no-unused-vars': 2, - 'keyword-spacing': [ - 2, - {} - ], - 'space-before-blocks': [ - 2, - 'always' - ], - 'space-before-function-paren': [ - 2, - 'always' - ], - 'one-var': [ - 2, - 'always' - ], - 'vars-on-top': 2, - 'array-bracket-spacing': [ - 2, - 'never' - ], - 'space-in-parens': [ - 2, - 'never' - ], - 'no-underscore-dangle': 2, - 'comma-style': [ - 2, - 'last' - ], - 'space-unary-ops': [ - 2, - { - words: false, - nonwords: false - } - ], - 'space-infix-ops': 2, - 'no-with': 2, - 'no-mixed-spaces-and-tabs': 2, - 'no-trailing-spaces': 2, - 'comma-dangle': [ - 2, - 'never' - ], - 'brace-style': 2, - 'eol-last': 2, - 'dot-notation': 2, - 'no-multi-str': 2, - 'key-spacing': [ - 2, - { - afterColon: true - } - ], - 'no-multiple-empty-lines': [ - 2, - { - max: 1, - maxEOF: 1 - } - ], - 'max-len': [ - 2, - 110 - ], - 'newline-after-var': [ - 2, - 'always' - ], - 'max-nested-callbacks': [ - 'error', - 3 - ], - 'max-depth': [ - 'error', - 2 - ], - 'max-statements': [ - 'error', - 20 - ], - 'max-params': [ - 'error', - 10 - ], - 'no-extend-native': 2, - 'no-return-assign': 2, - 'no-undefined': 2, - 'radix': 2, - 'semi': 2, - 'no-extra-semi': 2, - 'no-unreachable': 2 } -}; \ No newline at end of file +}; diff --git a/node-js-and-common-js.js b/node-js-and-common-js.js new file mode 100644 index 0000000..fc156b9 --- /dev/null +++ b/node-js-and-common-js.js @@ -0,0 +1,18 @@ +module.exports = { + env: { + browser: true, + node: true + }, + rules: { + // NO_RULE 'callback-return': 2, + // NO_RULE 'global-require': 2, + // NO_RULE 'handle-callback-err': 2, + // NO_RULE 'no-mixed-requires': 2, + // NO_RULE 'no-new-require': 2, + // NO_RULE 'no-path-concat': 2, + // NO_RULE 'no-process-env': 2, + // NO_RULE 'no-process-exit': 2, + // NO_RULE 'no-restricted-modules': 2, + // NO_RULE 'no-sync': 2 + } +}; diff --git a/package.json b/package.json index 5383755..d27ebbd 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ }, "scripts": { "commit": "git-cz", - "commitmsg": "validate-commit-msg" + "commitmsg": "validate-commit-msg", + "lint": "eslint ." }, "devDependencies": { "commitizen": "^2.9.2", diff --git a/possible-errors.js b/possible-errors.js new file mode 100644 index 0000000..bd1f586 --- /dev/null +++ b/possible-errors.js @@ -0,0 +1,39 @@ +module.exports = { + env: { + browser: true, + node: true + }, + rules: { + // NO_RULE 'no-await-in-loop': 2, + // 'no-cond-assign': 2, + // 'no-console': 2, + // 'no-constant-condition': 2, + // 'no-control-regex': 2, + // 'no-debugger': 2, + // 'no-dupe-args': 2, + // 'no-dupe-keys': 2, + // 'no-duplicate-case': 2, + // 'no-empty-character-class': 2, + 'no-empty': 2, + // 'no-ex-assign': 2, + // NO_RULE 'no-extra-boolean-cast': 2, + // NO_RULE 'no-extra-parens': 2, + 'no-extra-semi': 2, + // 'no-func-assign': 2, + // 'no-inner-declarations': 2, + // 'no-invalid-regexp': 2, + // 'no-irregular-whitespace': 2, + // 'no-obj-calls': 2, + // NO_RULE 'no-prototype-builtins': 2, + // 'no-regex-spaces': 2, + // 'no-sparse-arrays': 2, + // 'no-template-curly-in-string': 2, + // 'no-unexpected-multiline': 2, + 'no-unreachable': 2 + // 'no-unsafe-finally': 2, + // 'no-unsafe-negation': 2, + // 'use-isnan': 2, + // 'valid-jsdoc': [ 2, { requireReturn: false } ], + // 'valid-typeof': 2 + } +}; diff --git a/strict-mode.js b/strict-mode.js new file mode 100644 index 0000000..31b21ef --- /dev/null +++ b/strict-mode.js @@ -0,0 +1,9 @@ +module.exports = { + env: { + browser: true, + node: true + }, + rules: { + strict: 0 + } +}; diff --git a/stylistic-issues.js b/stylistic-issues.js new file mode 100644 index 0000000..98cd1d2 --- /dev/null +++ b/stylistic-issues.js @@ -0,0 +1,89 @@ +module.exports = { + env: { + browser: true, + node: true + }, + rules: { + 'array-bracket-spacing': [2, 'never'], + // 'block-spacing': 2, + 'brace-style': 2, + camelcase: 2, + // NO_RULE 'capitalized-comments': 2, + 'comma-dangle': [2, 'never'], + // 'comma-spacing': [ 2, { before: false, after: true } ], + 'comma-style': [2, 'last'], + // 'computed-property-spacing': [ 2, 'never' ], + // NO_RULE 'consistent-this': 2, + 'eol-last': 2, + // 'func-call-spacing': [ 2, 'never' ], + // 'func-name-matching': 2, + // 'func-names': 2, + 'func-style': ['error', 'declaration', { allowArrowFunctions: true }], + // 'id-blacklist': 2, + // NO_RULE 'id-length': 2, + // 'id-match': [ 2, '^\\$?(__)?(([A-Z]|[a-z]|[0-9]+)|([A-Z_]))*\\$?$' ], + indent: [2, 4, { SwitchCase: 1 }], + // 'jsx-quotes': [ 2, 'prefer-double' ], + 'key-spacing': [2, { afterColon: true }], + 'keyword-spacing': [2, {}], + // NO_RULE 'line-comment-position': 2, + // 'linebreak-style': [ 2, 'unix' ], + // NO_RULE 'lines-around-comment': 2, + // NO_RULE 'lines-around-directive': 2, + 'max-depth': ['error', 2], + 'max-len': [2, 110], + // 'max-lines': [ 2, { max: 500, skipBlankLines: false, skipComments: false } ], + 'max-nested-callbacks': ['error', 3], + 'max-params': ['error', 10], + // 'max-statements-per-line': [ 2, { max: 1 } ], + 'max-statements': ['error', 20], + // NO_RULE 'multiline-ternary': 2, + 'new-cap': 2, + // 'new-parens': 2, + 'newline-after-var': [2, 'always'], + // NO_RULE 'newline-before-return': 2, + // NO_RULE 'newline-per-chained-call': 2, + // 'no-array-constructor': 2, + 'no-bitwise': 2, + // 'no-continue': 2, + // NO_RULE 'no-inline-comments': 2, + // 'no-lonely-if': 2, + // NO_RULE 'no-mixed-operators': 2, + 'no-mixed-spaces-and-tabs': 2, + 'no-multiple-empty-lines': [2, { max: 1, maxEOF: 1 }], + // 'no-negated-condition': 2, + // 'no-nested-ternary': 2, + // 'no-new-object': 2, + // NO_RULE 'no-plusplus': 2, + // NO_RULE 'no-restricted-syntax': 2, + // 'no-tabs': 2, + // NO_RULE 'no-ternary': 2, + 'no-trailing-spaces': 2, + 'no-underscore-dangle': 2, + // 'no-unneeded-ternary': 2, + // 'no-whitespace-before-property': 2, + // NO_RULE 'object-curly-newline': 2, + // NO_RULE 'object-curly-spacing': 2, + // NO_RULE 'object-property-newline': 2, + // 'one-var-declaration-per-line': 2, + 'one-var': [2, 'always'], + // NO_RULE 'operator-assignment': 2, + // 'operator-linebreak': [ 2, 'after' ], + // NO_RULE 'padded-blocks': 2, + // 'quote-props': [ 2, 'as-needed' ], + quotes: [2, 'single'], + // NO_RULE 'require-jsdoc': 2, + // 'semi-spacing': [ 2, { before: false, after: true } ], + semi: 2, + // NO_RULE 'sort-keys': 2, + // NO_RULE 'sort-vars': 2, + 'space-before-blocks': [2, 'always'], + 'space-before-function-paren': [2, 'always'], + 'space-in-parens': [2, 'never'], + 'space-infix-ops': 2, + 'space-unary-ops': [2, { words: false, nonwords: false }] + // NO_RULE 'spaced-comment': 2, + // 'unicode-bom': [ 2, 'never' ], + // NO_RULE 'wrap-regex': 2 + } +}; diff --git a/variables.js b/variables.js new file mode 100644 index 0000000..3e0cb06 --- /dev/null +++ b/variables.js @@ -0,0 +1,20 @@ +module.exports = { + env: { + browser: true, + node: true + }, + rules: { + // NO_RULE 'init-declarations': 2, + // 'no-catch-shadow': 2, + // 'no-delete-var': 2, + // 'no-label-var': 2, + // 'no-restricted-globals': ['error', 'event', 'fdescribe'], + // 'no-shadow-restricted-names': 2, + // 'no-shadow': 2, + // 'no-undef-init': 2, + 'no-undef': 2, + 'no-undefined': 2, + 'no-unused-vars': 2, + 'no-use-before-define': ['error', { functions: false, classes: true }] + } +}; From ceb1ea96f7e24000fef93d8b2bb66c44dd0a7665 Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Thu, 22 Dec 2016 03:16:44 +0100 Subject: [PATCH 07/21] docs(README): Update docs --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1450c83..a6a4ce3 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,8 @@ Once the `eslint-config-casumo` package is installed, you can use it by specifyi // Additional, per-project rules... } } -``` \ No newline at end of file +``` +_Note: We omitted the eslint-config- prefix since it is automatically assumed by ESLint._ + +You can override settings from the shareable config by adding them directly into your .eslintrc file. + From 3ec2407c84d4fcf090037f614530286715d8c034 Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Thu, 22 Dec 2016 03:47:39 +0100 Subject: [PATCH 08/21] feat(rules): Add es6 eslint rules --- es6/index.js | 6 ++++++ es6/no-rules-config.js | 8 ++++++++ es6/stylistic-issues.js | 10 ++++++++++ 3 files changed, 24 insertions(+) create mode 100644 es6/index.js create mode 100644 es6/no-rules-config.js create mode 100644 es6/stylistic-issues.js diff --git a/es6/index.js b/es6/index.js new file mode 100644 index 0000000..5436c0e --- /dev/null +++ b/es6/index.js @@ -0,0 +1,6 @@ +module.exports = { + extends: [ + './no-rules-config.js' + ], + rules: {} +}; diff --git a/es6/no-rules-config.js b/es6/no-rules-config.js new file mode 100644 index 0000000..4b9fe84 --- /dev/null +++ b/es6/no-rules-config.js @@ -0,0 +1,8 @@ +module.exports = { + env: { + es6: true + }, + parserOptions: { + sourceType: 'module' + } +}; diff --git a/es6/stylistic-issues.js b/es6/stylistic-issues.js new file mode 100644 index 0000000..d2431ef --- /dev/null +++ b/es6/stylistic-issues.js @@ -0,0 +1,10 @@ +module.exports = { + extends: './no-rules-config.js', + rules: { + 'one-var': [2, { + var: 'always', + let: 'never', + const: 'never' + }] + } +}; From 89851abbff7a6d51855e7b62bd84199deeb6b28f Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Thu, 22 Dec 2016 11:04:18 +0100 Subject: [PATCH 09/21] refactor(rules): Bundle es6 extenders for easy importing --- es6/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/es6/index.js b/es6/index.js index 5436c0e..8528d12 100644 --- a/es6/index.js +++ b/es6/index.js @@ -1,6 +1,7 @@ module.exports = { extends: [ - './no-rules-config.js' + './no-rules-config.js', + './stylistic-issues.js' ], rules: {} }; From 4de82717ea99b96d99f139a6c94d4978efc4e0f9 Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Fri, 23 Dec 2016 09:27:52 +0100 Subject: [PATCH 10/21] refactor(rules): Move rules from root to rules folder --- index.js | 14 +++++++------- best-practices.js => rules/best-practices.js | 0 ecma-script-6.js => rules/ecma-script-6.js | 0 .../node-js-and-common-js.js | 0 possible-errors.js => rules/possible-errors.js | 0 strict-mode.js => rules/strict-mode.js | 0 stylistic-issues.js => rules/stylistic-issues.js | 0 variables.js => rules/variables.js | 0 8 files changed, 7 insertions(+), 7 deletions(-) rename best-practices.js => rules/best-practices.js (100%) rename ecma-script-6.js => rules/ecma-script-6.js (100%) rename node-js-and-common-js.js => rules/node-js-and-common-js.js (100%) rename possible-errors.js => rules/possible-errors.js (100%) rename strict-mode.js => rules/strict-mode.js (100%) rename stylistic-issues.js => rules/stylistic-issues.js (100%) rename variables.js => rules/variables.js (100%) diff --git a/index.js b/index.js index 79f3e6c..96f83da 100644 --- a/index.js +++ b/index.js @@ -4,13 +4,13 @@ module.exports = { node: true }, extends: [ - './possible-errors.js', - './best-practices.js', - './strict-mode.js', - './variables.js', - './node-js-and-common-js.js', - './stylistic-issues.js', - './ecma-script-6.js' + './rules/possible-errors.js', + './rules/best-practices.js', + './rules/strict-mode.js', + './rules/variables.js', + './rules/node-js-and-common-js.js', + './rules/stylistic-issues.js', + './rules/ecma-script-6.js' ], rules: {}, globals: { diff --git a/best-practices.js b/rules/best-practices.js similarity index 100% rename from best-practices.js rename to rules/best-practices.js diff --git a/ecma-script-6.js b/rules/ecma-script-6.js similarity index 100% rename from ecma-script-6.js rename to rules/ecma-script-6.js diff --git a/node-js-and-common-js.js b/rules/node-js-and-common-js.js similarity index 100% rename from node-js-and-common-js.js rename to rules/node-js-and-common-js.js diff --git a/possible-errors.js b/rules/possible-errors.js similarity index 100% rename from possible-errors.js rename to rules/possible-errors.js diff --git a/strict-mode.js b/rules/strict-mode.js similarity index 100% rename from strict-mode.js rename to rules/strict-mode.js diff --git a/stylistic-issues.js b/rules/stylistic-issues.js similarity index 100% rename from stylistic-issues.js rename to rules/stylistic-issues.js diff --git a/variables.js b/rules/variables.js similarity index 100% rename from variables.js rename to rules/variables.js From a0ef6227e6af298952c1210125084b799af5de9c Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Fri, 23 Dec 2016 12:25:28 +0100 Subject: [PATCH 11/21] chore(.edtiroconfig): Add .editorconfig --- .editorconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e9a9bff --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false From f28d85189316cf382d3303ccb817d167c3055618 Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Fri, 23 Dec 2016 12:43:19 +0100 Subject: [PATCH 12/21] refactor(rules): Split rules into configuration for better composability --- configurations/es5-browser.js | 6 ++ configurations/es5-node.js | 12 ++++ configurations/es5-test.js | 13 +++++ configurations/es5.js | 24 ++++++++ configurations/es6-browser.js | 6 ++ configurations/es6-node-test.js | 18 ++++++ configurations/es6-node.js | 24 ++++++++ configurations/es6-test.js | 13 +++++ configurations/es6.js | 18 ++++++ configurations/off.js | 19 +++++++ es6/index.js | 7 --- es6/no-rules-config.js | 8 --- es6/stylistic-issues.js | 10 ---- index.js | 29 +--------- rules/best-practices.js | 77 -------------------------- rules/ecma-script-6.js | 38 ------------- rules/eslint/best-practices/off.js | 73 ++++++++++++++++++++++++ rules/eslint/best-practices/on.js | 73 ++++++++++++++++++++++++ rules/eslint/deprecated/off.js | 8 +++ rules/eslint/errors/off.js | 35 ++++++++++++ rules/eslint/errors/on.js | 35 ++++++++++++ rules/eslint/es6/off.js | 34 ++++++++++++ rules/eslint/es6/on.js | 34 ++++++++++++ rules/eslint/node/off.js | 14 +++++ rules/eslint/node/on.js | 14 +++++ rules/eslint/strict/off.js | 5 ++ rules/eslint/strict/on.js | 5 ++ rules/eslint/style/off.js | 85 ++++++++++++++++++++++++++++ rules/eslint/style/on.js | 85 ++++++++++++++++++++++++++++ rules/eslint/variables/off.js | 16 ++++++ rules/eslint/variables/on.js | 16 ++++++ rules/mocha/on.js | 5 ++ rules/node-js-and-common-js.js | 18 ------ rules/possible-errors.js | 39 ------------- rules/strict-mode.js | 9 --- rules/stylistic-issues.js | 89 ------------------------------ rules/variables.js | 20 ------- 37 files changed, 693 insertions(+), 341 deletions(-) create mode 100644 configurations/es5-browser.js create mode 100644 configurations/es5-node.js create mode 100644 configurations/es5-test.js create mode 100644 configurations/es5.js create mode 100644 configurations/es6-browser.js create mode 100644 configurations/es6-node-test.js create mode 100644 configurations/es6-node.js create mode 100644 configurations/es6-test.js create mode 100644 configurations/es6.js create mode 100644 configurations/off.js delete mode 100644 es6/index.js delete mode 100644 es6/no-rules-config.js delete mode 100644 es6/stylistic-issues.js delete mode 100644 rules/best-practices.js delete mode 100644 rules/ecma-script-6.js create mode 100644 rules/eslint/best-practices/off.js create mode 100644 rules/eslint/best-practices/on.js create mode 100644 rules/eslint/deprecated/off.js create mode 100644 rules/eslint/errors/off.js create mode 100644 rules/eslint/errors/on.js create mode 100644 rules/eslint/es6/off.js create mode 100644 rules/eslint/es6/on.js create mode 100644 rules/eslint/node/off.js create mode 100644 rules/eslint/node/on.js create mode 100644 rules/eslint/strict/off.js create mode 100644 rules/eslint/strict/on.js create mode 100644 rules/eslint/style/off.js create mode 100644 rules/eslint/style/on.js create mode 100644 rules/eslint/variables/off.js create mode 100644 rules/eslint/variables/on.js create mode 100644 rules/mocha/on.js delete mode 100644 rules/node-js-and-common-js.js delete mode 100644 rules/possible-errors.js delete mode 100644 rules/strict-mode.js delete mode 100644 rules/stylistic-issues.js delete mode 100644 rules/variables.js diff --git a/configurations/es5-browser.js b/configurations/es5-browser.js new file mode 100644 index 0000000..fc9bb7e --- /dev/null +++ b/configurations/es5-browser.js @@ -0,0 +1,6 @@ +module.exports = { + extends: '../configurations/es5.js', + env: { + browser: true + } +}; diff --git a/configurations/es5-node.js b/configurations/es5-node.js new file mode 100644 index 0000000..c9d523a --- /dev/null +++ b/configurations/es5-node.js @@ -0,0 +1,12 @@ +module.exports = { + extends: [ + '../configurations/es5.js', + '../rules/eslint/node/on.js' + ], + env: { + node: true + }, + rules: { + strict: [2, 'global'] + } +}; diff --git a/configurations/es5-test.js b/configurations/es5-test.js new file mode 100644 index 0000000..9bff3ee --- /dev/null +++ b/configurations/es5-test.js @@ -0,0 +1,13 @@ +module.exports = { + extends: [ + '../configurations/es5.js', + '../rules/mocha/on.js' + ], + env: { + mocha: true + }, + rules: { + 'max-nested-callbacks': 0, + 'no-magic-numbers': 0 + } +}; diff --git a/configurations/es5.js b/configurations/es5.js new file mode 100644 index 0000000..3e55cb9 --- /dev/null +++ b/configurations/es5.js @@ -0,0 +1,24 @@ +module.exports = { + extends: [ + '../rules/eslint/best-practices/on.js', + '../rules/eslint/errors/on.js', + '../rules/eslint/es6/off.js', + '../rules/eslint/node/off.js', + '../rules/eslint/strict/on.js', + '../rules/eslint/style/on.js', + '../rules/eslint/variables/on.js' + ], + parserOptions: { + ecmaVersion: 5, + sourceType: 'script', + ecmaFeatures: {} + }, + env: { + amd: true + }, + globals: { + module: false, + process: false + }, + rules: {} +}; diff --git a/configurations/es6-browser.js b/configurations/es6-browser.js new file mode 100644 index 0000000..d9b7f16 --- /dev/null +++ b/configurations/es6-browser.js @@ -0,0 +1,6 @@ +module.exports = { + extends: '../configurations/es6.js', + env: { + browser: true + } +}; diff --git a/configurations/es6-node-test.js b/configurations/es6-node-test.js new file mode 100644 index 0000000..a9f5c89 --- /dev/null +++ b/configurations/es6-node-test.js @@ -0,0 +1,18 @@ +module.exports = { + extends: [ + '../configurations/es6-test.js' + ], + env: { + mocha: true, + phantomjs: true + }, + globals: { + expect: true, + sandbox: true + }, + rules: { + 'max-nested-callbacks': 0, + 'no-unused-expressions': 0, + 'no-magic-numbers': 0 + } +}; diff --git a/configurations/es6-node.js b/configurations/es6-node.js new file mode 100644 index 0000000..24ceb53 --- /dev/null +++ b/configurations/es6-node.js @@ -0,0 +1,24 @@ +module.exports = { + extends: [ + '../configurations/es6.js', + '../rules/eslint/node/on.js' + ], + env: { + node: true + }, + parserOptions: { + sourceType: 'script', + ecmaFeatures: { + impliedStrict: false + } + }, + globals: {}, + rules: { + 'constructor-super': 0, + 'no-class-assign': 0, + 'no-dupe-class-members': 0, + 'no-this-before-super': 0, + 'prefer-reflect': 0, + strict: [2, 'global'] + } +}; diff --git a/configurations/es6-test.js b/configurations/es6-test.js new file mode 100644 index 0000000..aba9073 --- /dev/null +++ b/configurations/es6-test.js @@ -0,0 +1,13 @@ +module.exports = { + extends: [ + '../configurations/es6' + ], + env: { + mocha: true, + phantomjs: true + }, + rules: { + 'max-nested-callbacks': 0, + 'no-magic-numbers': 0 + } +}; diff --git a/configurations/es6.js b/configurations/es6.js new file mode 100644 index 0000000..d594425 --- /dev/null +++ b/configurations/es6.js @@ -0,0 +1,18 @@ +module.exports = { + extends: [ + '../configurations/es5.js', + '../rules/eslint/es6/on.js' + ], + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + ecmaFeatures: { + impliedStrict: true + } + }, + env: { + es6: true + }, + globals: {}, + rules: {} +}; diff --git a/configurations/off.js b/configurations/off.js new file mode 100644 index 0000000..d919d3c --- /dev/null +++ b/configurations/off.js @@ -0,0 +1,19 @@ +module.exports = { + extends: [ + '../rules/eslint/best-practices/off.js', + '../rules/eslint/errors/off.js', + '../rules/eslint/es6/off.js', + '../rules/eslint/node/off.js', + '../rules/eslint/strict/off.js', + '../rules/eslint/style/off.js', + '../rules/eslint/variables/off.js' + ], + parserOptions: { + ecmaVersion: 5, + sourceType: 'script', + ecmaFeatures: {} + }, + env: {}, + globals: {}, + rules: {} +}; diff --git a/es6/index.js b/es6/index.js deleted file mode 100644 index 8528d12..0000000 --- a/es6/index.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - extends: [ - './no-rules-config.js', - './stylistic-issues.js' - ], - rules: {} -}; diff --git a/es6/no-rules-config.js b/es6/no-rules-config.js deleted file mode 100644 index 4b9fe84..0000000 --- a/es6/no-rules-config.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - env: { - es6: true - }, - parserOptions: { - sourceType: 'module' - } -}; diff --git a/es6/stylistic-issues.js b/es6/stylistic-issues.js deleted file mode 100644 index d2431ef..0000000 --- a/es6/stylistic-issues.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - extends: './no-rules-config.js', - rules: { - 'one-var': [2, { - var: 'always', - let: 'never', - const: 'never' - }] - } -}; diff --git a/index.js b/index.js index 96f83da..16f0eb4 100644 --- a/index.js +++ b/index.js @@ -1,29 +1,6 @@ module.exports = { - env: { - browser: true, - node: true - }, extends: [ - './rules/possible-errors.js', - './rules/best-practices.js', - './rules/strict-mode.js', - './rules/variables.js', - './rules/node-js-and-common-js.js', - './rules/stylistic-issues.js', - './rules/ecma-script-6.js' - ], - rules: {}, - globals: { - ActiveXObject: true, - define: true, - require: true, - describe: true, - it: true, - beforeEach: true, - afterEach: true, - before: true, - after: true, - should: true, - module: true - } + './configurations/es5-test.js', + './rules/eslint/deprecated/off.js' + ] }; diff --git a/rules/best-practices.js b/rules/best-practices.js deleted file mode 100644 index 22a4a3b..0000000 --- a/rules/best-practices.js +++ /dev/null @@ -1,77 +0,0 @@ -module.exports = { - env: { - browser: true, - node: true - }, - rules: { - // 'accessor-pairs': 2, - // 'array-callback-return': 2, - // 'block-scoped-var': 2, - // NO_RULE 'class-methods-use-this': 2, - // 'complexity': [2, 5], - // 'consistent-return': 2, - curly: [2, 'all'], - // 'default-case': 2, - // 'dot-location': [2, 'property'], - 'dot-notation': 2, - eqeqeq: 2, - 'guard-for-in': 2, - // 'no-alert': 2, - 'no-caller': 2, - // 'no-case-declarations': 2, - // 'no-div-regex': 2, - // NO_RULE 'no-else-return': 2, - // NO_RULE 'no-empty-function': 2, - // 'no-empty-pattern': 2, - // 'no-eq-null': 2, - 'no-eval': 2, - 'no-extend-native': 2, - // 'no-extra-bind': 2, - // 'no-extra-label': 2, - // 'no-fallthrough': 2, - // 'no-floating-decimal': 2, - // 'no-global-assign': 2, - // NO_RULE 'no-implicit-coercion': 2, - // 'no-implicit-globals': 2, - // 'no-implied-eval': 2, - // 'no-invalid-this': 2, - // 'no-iterator': 2, - // 'no-labels': 2, - // 'no-lone-blocks': 2, - // 'no-loop-func': 2, - // NO_RULE 'no-magic-numbers': 2, - // 'no-multi-spaces': 2, - 'no-multi-str': 2, - // 'no-new-func': 2, - // 'no-new-wrappers': 2, - 'no-new': 2, - // 'no-octal-escape': 2, - // 'no-octal': 2, - // NO_RULE 'no-param-reassign': 2, - // 'no-proto': 2, - // 'no-redeclare': 2, - // NO_RULE 'no-restricted-properties': 2, - 'no-return-assign': 2, - // NO_RULE 'no-return-await': 2, - // 'no-script-url': 2, - // 'no-self-assign': 2, - // 'no-self-compare': 2, - // 'no-sequences': 2, - // 'no-throw-literal': 2, - // 'no-unmodified-loop-condition': 2, - 'no-unused-expressions': 2, - // 'no-unused-labels': 2, - // 'no-useless-call': 2, - // 'no-useless-concat': 2, - // 'no-useless-escape': 2, - // 'no-useless-return': 2, - // 'no-void': 2, - // 'no-warning-comments': [2, { terms: [Object], location: 'anywhere' }], - 'no-with': 2, - radix: 2, - // NO_RULE 'require-await': 2, - 'vars-on-top': 2, - 'wrap-iife': 2 - // 'yoda': 2 - } -}; diff --git a/rules/ecma-script-6.js b/rules/ecma-script-6.js deleted file mode 100644 index faa948f..0000000 --- a/rules/ecma-script-6.js +++ /dev/null @@ -1,38 +0,0 @@ -module.exports = { - env: { - browser: true, - node: true - }, - rules: { - // NO_RULE 'arrow-body-style': 2, - // NO_RULE 'arrow-parens': 2, - // 'arrow-spacing': [ 2, { before: true, after: true } ], - // 'constructor-super': 2, - // NO_RULE 'generator-star-spacing': 2, - // 'no-class-assign': 2, - // NO_RULE 'no-confusing-arrow': 2, - // 'no-const-assign': 2, - // 'no-dupe-class-members': 2, - // 'no-duplicate-imports': 2, - // 'no-new-symbol': 2, - // NO_RULE 'no-restricted-imports': 2, - // 'no-this-before-super': 2, - // 'no-useless-computed-key': 2, - // 'no-useless-constructor': 2, - // 'no-useless-rename': 2, - // NO_RULE 'no-var': 2, - // NO_RULE 'object-shorthand': 2, - // NO_RULE 'prefer-arrow-callback': 2, - // NO_RULE 'prefer-const': 2, - // NO_RULE 'prefer-numeric-literals': 2, - // NO_RULE 'prefer-rest-params': 2, - // NO_RULE 'prefer-spread': 2, - // NO_RULE 'prefer-template': 2, - // NO_RULE 'require-yield': 2, - // 'rest-spread-spacing': [ 2, 'never' ], - // NO_RULE 'sort-imports': 2, - // NO_RULE 'symbol-description': 2, - // 'template-curly-spacing': [ 2, 'never' ], - // 'yield-star-spacing': [ 2, 'both' ] - } -}; diff --git a/rules/eslint/best-practices/off.js b/rules/eslint/best-practices/off.js new file mode 100644 index 0000000..1a3754f --- /dev/null +++ b/rules/eslint/best-practices/off.js @@ -0,0 +1,73 @@ +module.exports = { + rules: { + 'accessor-pairs': 0, + 'array-callback-return': 0, + 'block-scoped-var': 0, + 'class-methods-use-this': 0, + 'complexity': 0, + 'consistent-return': 0, + curly: 0, + 'default-case': 0, + 'dot-location': 0, + 'dot-notation': 0, + eqeqeq: 0, + 'guard-for-in': 0, + 'no-alert': 0, + 'no-caller': 0, + 'no-case-declarations': 0, + 'no-div-regex': 0, + 'no-else-return': 0, + 'no-empty-function': 0, + 'no-empty-pattern': 0, + 'no-eq-null': 0, + 'no-eval': 0, + 'no-extend-native': 0, + 'no-extra-bind': 0, + 'no-extra-label': 0, + 'no-fallthrough': 0, + 'no-floating-decimal': 0, + 'no-global-assign': 0, + 'no-implicit-coercion': 0, + 'no-implicit-globals': 0, + 'no-implied-eval': 0, + 'no-invalid-this': 0, + 'no-iterator': 0, + 'no-labels': 0, + 'no-lone-blocks': 0, + 'no-loop-func': 0, + 'no-magic-numbers': 0, + 'no-multi-spaces': 0, + 'no-multi-str': 0, + 'no-new-func': 0, + 'no-new-wrappers': 0, + 'no-new': 0, + 'no-octal-escape': 0, + 'no-octal': 0, + 'no-param-reassign': 0, + 'no-proto': 0, + 'no-redeclare': 0, + 'no-restricted-properties': 0, + 'no-return-assign': 0, + 'no-return-await': 0, + 'no-script-url': 0, + 'no-self-assign': 0, + 'no-self-compare': 0, + 'no-sequences': 0, + 'no-throw-literal': 0, + 'no-unmodified-loop-condition': 0, + 'no-unused-expressions': 0, + 'no-unused-labels': 0, + 'no-useless-call': 0, + 'no-useless-concat': 0, + 'no-useless-escape': 0, + 'no-useless-return': 0, + 'no-void': 0, + 'no-warning-comments': 0, + 'no-with': 0, + radix: 0, + 'require-await': 0, + 'vars-on-top': 0, + 'wrap-iife': 0, + 'yoda': 0 + } +}; diff --git a/rules/eslint/best-practices/on.js b/rules/eslint/best-practices/on.js new file mode 100644 index 0000000..9433edc --- /dev/null +++ b/rules/eslint/best-practices/on.js @@ -0,0 +1,73 @@ +module.exports = { + rules: { + 'accessor-pairs': 0, + 'array-callback-return': 0, + 'block-scoped-var': 0, + 'class-methods-use-this': 0, + 'complexity': 0, + 'consistent-return': 0, + curly: [2, 'all'], + 'default-case': 0, + 'dot-location': 0, + 'dot-notation': 2, + eqeqeq: 2, + 'guard-for-in': 2, + 'no-alert': 0, + 'no-caller': 2, + 'no-case-declarations': 0, + 'no-div-regex': 0, + 'no-else-return': 0, + 'no-empty-function': 0, + 'no-empty-pattern': 0, + 'no-eq-null': 0, + 'no-eval': 2, + 'no-extend-native': 2, + 'no-extra-bind': 0, + 'no-extra-label': 0, + 'no-fallthrough': 0, + 'no-floating-decimal': 0, + 'no-global-assign': 0, + 'no-implicit-coercion': 0, + 'no-implicit-globals': 0, + 'no-implied-eval': 0, + 'no-invalid-this': 0, + 'no-iterator': 0, + 'no-labels': 0, + 'no-lone-blocks': 0, + 'no-loop-func': 0, + 'no-magic-numbers': 0, + 'no-multi-spaces': 0, + 'no-multi-str': 2, + 'no-new-func': 0, + 'no-new-wrappers': 0, + 'no-new': 2, + 'no-octal-escape': 0, + 'no-octal': 0, + 'no-param-reassign': 0, + 'no-proto': 0, + 'no-redeclare': 0, + 'no-restricted-properties': 0, + 'no-return-assign': 2, + 'no-return-await': 0, + 'no-script-url': 0, + 'no-self-assign': 0, + 'no-self-compare': 0, + 'no-sequences': 0, + 'no-throw-literal': 0, + 'no-unmodified-loop-condition': 0, + 'no-unused-expressions': 2, + 'no-unused-labels': 0, + 'no-useless-call': 0, + 'no-useless-concat': 0, + 'no-useless-escape': 0, + 'no-useless-return': 0, + 'no-void': 0, + 'no-warning-comments': 0, + 'no-with': 2, + radix: 2, + 'require-await': 0, + 'vars-on-top': 2, + 'wrap-iife': 2, + 'yoda': 0 + } +}; diff --git a/rules/eslint/deprecated/off.js b/rules/eslint/deprecated/off.js new file mode 100644 index 0000000..2342d14 --- /dev/null +++ b/rules/eslint/deprecated/off.js @@ -0,0 +1,8 @@ +module.exports = { + rules: { + 'no-native-reassign': 0, + 'no-negated-in-lhs': 0, + 'no-spaced-func': 0, + 'prefer-reflect': 0 + } +}; diff --git a/rules/eslint/errors/off.js b/rules/eslint/errors/off.js new file mode 100644 index 0000000..86c3631 --- /dev/null +++ b/rules/eslint/errors/off.js @@ -0,0 +1,35 @@ +module.exports = { + rules: { + 'no-await-in-loop': 0, + 'no-cond-assign': 0, + 'no-console': 0, + 'no-constant-condition': 0, + 'no-control-regex': 0, + 'no-debugger': 0, + 'no-dupe-args': 0, + 'no-dupe-keys': 0, + 'no-duplicate-case': 0, + 'no-empty-character-class': 0, + 'no-empty': 0, + 'no-ex-assign': 0, + 'no-extra-boolean-cast': 0, + 'no-extra-parens': 0, + 'no-extra-semi': 0, + 'no-func-assign': 0, + 'no-inner-declarations': 0, + 'no-invalid-regexp': 0, + 'no-irregular-whitespace': 0, + 'no-obj-calls': 0, + 'no-prototype-builtins': 0, + 'no-regex-spaces': 0, + 'no-sparse-arrays': 0, + 'no-template-curly-in-string': 0, + 'no-unexpected-multiline': 0, + 'no-unreachable': 0, + 'no-unsafe-finally': 0, + 'no-unsafe-negation': 0, + 'use-isnan': 0, + 'valid-jsdoc': 0, + 'valid-typeof': 0 + } +}; diff --git a/rules/eslint/errors/on.js b/rules/eslint/errors/on.js new file mode 100644 index 0000000..1b28aae --- /dev/null +++ b/rules/eslint/errors/on.js @@ -0,0 +1,35 @@ +module.exports = { + rules: { + 'no-await-in-loop': 0, + 'no-cond-assign': 0, + 'no-console': 0, + 'no-constant-condition': 0, + 'no-control-regex': 0, + 'no-debugger': 0, + 'no-dupe-args': 0, + 'no-dupe-keys': 0, + 'no-duplicate-case': 0, + 'no-empty-character-class': 0, + 'no-empty': 2, + 'no-ex-assign': 0, + 'no-extra-boolean-cast': 0, + 'no-extra-parens': 0, + 'no-extra-semi': 2, + 'no-func-assign': 0, + 'no-inner-declarations': 0, + 'no-invalid-regexp': 0, + 'no-irregular-whitespace': 0, + 'no-obj-calls': 0, + 'no-prototype-builtins': 0, + 'no-regex-spaces': 0, + 'no-sparse-arrays': 0, + 'no-template-curly-in-string': 0, + 'no-unexpected-multiline': 0, + 'no-unreachable': 2, + 'no-unsafe-finally': 0, + 'no-unsafe-negation': 0, + 'use-isnan': 0, + 'valid-jsdoc': 0, + 'valid-typeof': 0 + } +}; diff --git a/rules/eslint/es6/off.js b/rules/eslint/es6/off.js new file mode 100644 index 0000000..d9ebf8f --- /dev/null +++ b/rules/eslint/es6/off.js @@ -0,0 +1,34 @@ +module.exports = { + rules: { + 'arrow-body-style': 0, + 'arrow-parens': 0, + 'arrow-spacing': 0, + 'constructor-super': 0, + 'generator-star-spacing': 0, + 'no-class-assign': 0, + 'no-confusing-arrow': 0, + 'no-const-assign': 0, + 'no-dupe-class-members': 0, + 'no-duplicate-imports': 0, + 'no-new-symbol': 0, + 'no-restricted-imports': 0, + 'no-this-before-super': 0, + 'no-useless-computed-key': 0, + 'no-useless-constructor': 0, + 'no-useless-rename': 0, + 'no-var': 0, + 'object-shorthand': 0, + 'prefer-arrow-callback': 0, + 'prefer-const': 0, + 'prefer-numeric-literals': 0, + 'prefer-rest-params': 0, + 'prefer-spread': 0, + 'prefer-template': 0, + 'require-yield': 0, + 'rest-spread-spacing': 0, + 'sort-imports': 0, + 'symbol-description': 0, + 'template-curly-spacing': 0, + 'yield-star-spacing': 0 + } +}; diff --git a/rules/eslint/es6/on.js b/rules/eslint/es6/on.js new file mode 100644 index 0000000..7486dea --- /dev/null +++ b/rules/eslint/es6/on.js @@ -0,0 +1,34 @@ +module.exports = { + rules: { + 'arrow-body-style': 0, + 'arrow-parens': 2, + 'arrow-spacing': 2, + 'constructor-super': 2, + 'generator-star-spacing': 2, + 'no-class-assign': 2, + 'no-confusing-arrow': 0, + 'no-const-assign': 2, + 'no-dupe-class-members': 2, + 'no-duplicate-imports': 0, + 'no-new-symbol': 0, + 'no-restricted-imports': 0, + 'no-this-before-super': 2, + 'no-useless-computed-key': 0, + 'no-useless-constructor': 0, + 'no-useless-rename': 0, + 'no-var': 2, + 'object-shorthand': 2, + 'prefer-arrow-callback': 1, + 'prefer-const': 2, + 'prefer-numeric-literals': 0, + 'prefer-rest-params': 0, + 'prefer-spread': 2, + 'prefer-template': 1, + 'require-yield': 2, + 'rest-spread-spacing': 0, + 'sort-imports': 0, + 'symbol-description': 0, + 'template-curly-spacing': 0, + 'yield-star-spacing': 0 + } +}; diff --git a/rules/eslint/node/off.js b/rules/eslint/node/off.js new file mode 100644 index 0000000..461075b --- /dev/null +++ b/rules/eslint/node/off.js @@ -0,0 +1,14 @@ +module.exports = { + rules: { + 'callback-return': 0, + 'global-require': 0, + 'handle-callback-err': 0, + 'no-mixed-requires': 0, + 'no-new-require': 0, + 'no-path-concat': 0, + 'no-process-env': 0, + 'no-process-exit': 0, + 'no-restricted-modules': 0, + 'no-sync': 0 + } +}; diff --git a/rules/eslint/node/on.js b/rules/eslint/node/on.js new file mode 100644 index 0000000..9ccb01e --- /dev/null +++ b/rules/eslint/node/on.js @@ -0,0 +1,14 @@ +module.exports = { + rules: { + 'callback-return': 2, + 'global-require': 1, + 'handle-callback-err': 0, + 'no-mixed-requires': 2, + 'no-new-require': 2, + 'no-path-concat': 0, + 'no-process-env': 0, + 'no-process-exit': 2, + 'no-restricted-modules': 0, + 'no-sync': 0 + } +}; diff --git a/rules/eslint/strict/off.js b/rules/eslint/strict/off.js new file mode 100644 index 0000000..faa69fc --- /dev/null +++ b/rules/eslint/strict/off.js @@ -0,0 +1,5 @@ +module.exports = { + rules: { + strict: 0 + } +}; diff --git a/rules/eslint/strict/on.js b/rules/eslint/strict/on.js new file mode 100644 index 0000000..fea0097 --- /dev/null +++ b/rules/eslint/strict/on.js @@ -0,0 +1,5 @@ +module.exports = { + rules: { + strict: [2, 'never'] + } +}; diff --git a/rules/eslint/style/off.js b/rules/eslint/style/off.js new file mode 100644 index 0000000..90c58f0 --- /dev/null +++ b/rules/eslint/style/off.js @@ -0,0 +1,85 @@ +module.exports = { + rules: { + 'array-bracket-spacing': 0, + 'block-spacing': 0, + 'brace-style': 0, + camelcase: 0, + 'capitalized-comments': 0, + 'comma-dangle': 0, + 'comma-spacing': 0, + 'comma-style': 0, + 'computed-property-spacing': 0, + 'consistent-this': 0, + 'eol-last': 0, + 'func-call-spacing': 0, + 'func-name-matching': 0, + 'func-names': 0, + 'func-style': 0, + 'id-blacklist': 0, + 'id-length': 0, + 'id-match': 0, + indent: 0, + 'jsx-quotes': 0, + 'key-spacing': 0, + 'keyword-spacing': 0, + 'line-comment-position': 0, + 'linebreak-style': 0, + 'lines-around-comment': 0, + 'lines-around-directive': 0, + 'max-depth': 0, + 'max-len': 0, + 'max-lines': 0, + 'max-nested-callbacks': 0, + 'max-params': 0, + 'max-statements-per-line': 0, + 'max-statements': 0, + 'multiline-ternary': 0, + 'new-cap': 0, + 'new-parens': 0, + 'newline-after-var': 0, + 'newline-before-return': 0, + 'newline-per-chained-call': 0, + 'no-array-constructor': 0, + 'no-bitwise': 0, + 'no-continue': 0, + 'no-inline-comments': 0, + 'no-lonely-if': 0, + 'no-mixed-operators': 0, + 'no-mixed-spaces-and-tabs': 0, + 'no-multiple-empty-lines': 0, + 'no-negated-condition': 0, + 'no-nested-ternary': 0, + 'no-new-object': 0, + 'no-plusplus': 0, + 'no-restricted-syntax': 0, + 'no-tabs': 0, + 'no-ternary': 0, + 'no-trailing-spaces': 0, + 'no-underscore-dangle': 0, + 'no-unneeded-ternary': 0, + 'no-whitespace-before-property': 0, + 'object-curly-newline': 0, + 'object-curly-spacing': 0, + 'object-property-newline': 0, + 'one-var-declaration-per-line': 0, + 'one-var': 0, + 'operator-assignment': 0, + 'operator-linebreak': 0, + 'padded-blocks': 0, + 'quote-props': 0, + quotes: 0, + 'require-jsdoc': 0, + 'semi-spacing': 0, + semi: 0, + 'sort-keys': 0, + 'sort-vars': 0, + 'space-before-blocks': 0, + 'space-before-function-paren': 0, + 'space-in-parens': 0, + 'space-infix-ops': 0, + 'space-unary-ops': 0, + 'spaced-comment': 0, + 'unicode-bom': 0, + 'wrap-regex': 0, + } +}; diff --git a/rules/eslint/style/on.js b/rules/eslint/style/on.js new file mode 100644 index 0000000..a0af91a --- /dev/null +++ b/rules/eslint/style/on.js @@ -0,0 +1,85 @@ +module.exports = { + rules: { + 'array-bracket-spacing': [2, 'never'], + 'block-spacing': 0, + 'brace-style': 2, + camelcase: 2, + 'capitalized-comments': 0, + 'comma-dangle': [2, 'never'], + 'comma-spacing': 0, + 'comma-style': [2, 'last'], + 'computed-property-spacing': 0, + 'consistent-this': 0, + 'eol-last': 2, + 'func-call-spacing': 0, + 'func-name-matching': 0, + 'func-names': 0, + 'func-style': ['error', 'declaration', { allowArrowFunctions: true }], + 'id-blacklist': 0, + 'id-length': 0, + 'id-match': 0, + indent: [2, 4, { SwitchCase: 1 }], + 'jsx-quotes': 0, + 'key-spacing': [2, { afterColon: true }], + 'keyword-spacing': [2, {}], + 'line-comment-position': 0, + 'linebreak-style': 0, + 'lines-around-comment': 0, + 'lines-around-directive': 0, + 'max-depth': ['error', 2], + 'max-len': [2, 110], + 'max-lines': 0, + 'max-nested-callbacks': ['error', 3], + 'max-params': ['error', 10], + 'max-statements-per-line': 0, + 'max-statements': ['error', 20], + 'multiline-ternary': 0, + 'new-cap': 2, + 'new-parens': 0, + 'newline-after-var': [2, 'always'], + 'newline-before-return': 0, + 'newline-per-chained-call': 0, + 'no-array-constructor': 0, + 'no-bitwise': 2, + 'no-continue': 0, + 'no-inline-comments': 0, + 'no-lonely-if': 0, + 'no-mixed-operators': 0, + 'no-mixed-spaces-and-tabs': 2, + 'no-multiple-empty-lines': [2, { max: 1, maxEOF: 1 }], + 'no-negated-condition': 0, + 'no-nested-ternary': 0, + 'no-new-object': 0, + 'no-plusplus': 0, + 'no-restricted-syntax': 0, + 'no-tabs': 0, + 'no-ternary': 0, + 'no-trailing-spaces': 2, + 'no-underscore-dangle': 2, + 'no-unneeded-ternary': 0, + 'no-whitespace-before-property': 0, + 'object-curly-newline': 0, + 'object-curly-spacing': 0, + 'object-property-newline': 0, + 'one-var-declaration-per-line': 0, + 'one-var': [2, { var: 'always', let: 'never', const: 'never' }], + 'operator-assignment': 0, + 'operator-linebreak': 0, + 'padded-blocks': 0, + 'quote-props': 0, + quotes: [2, 'single'], + 'require-jsdoc': 0, + 'semi-spacing': 0, + semi: 2, + 'sort-keys': 0, + 'sort-vars': 0, + 'space-before-blocks': [2, 'always'], + 'space-before-function-paren': [2, 'always'], + 'space-in-parens': [2, 'never'], + 'space-infix-ops': 2, + 'space-unary-ops': [2, { words: false, nonwords: false }], + 'spaced-comment': 0, + 'unicode-bom': 0, + 'wrap-regex': 0 + } +}; diff --git a/rules/eslint/variables/off.js b/rules/eslint/variables/off.js new file mode 100644 index 0000000..8636980 --- /dev/null +++ b/rules/eslint/variables/off.js @@ -0,0 +1,16 @@ +module.exports = { + rules: { + 'init-declarations': 0, + 'no-catch-shadow': 0, + 'no-delete-var': 0, + 'no-label-var': 0, + 'no-restricted-globals': 0, + 'no-shadow-restricted-names': 0, + 'no-shadow': 0, + 'no-undef-init': 0, + 'no-undef': 0, + 'no-undefined': 0, + 'no-unused-vars': 0, + 'no-use-before-define': 0 + } +}; diff --git a/rules/eslint/variables/on.js b/rules/eslint/variables/on.js new file mode 100644 index 0000000..7f5977d --- /dev/null +++ b/rules/eslint/variables/on.js @@ -0,0 +1,16 @@ +module.exports = { + rules: { + 'init-declarations': 0, + 'no-catch-shadow': 0, + 'no-delete-var': 0, + 'no-label-var': 0, + 'no-restricted-globals': 0, + 'no-shadow-restricted-names': 0, + 'no-shadow': 0, + 'no-undef-init': 0, + 'no-undef': 2, + 'no-undefined': 2, + 'no-unused-vars': 2, + 'no-use-before-define': ['error', { functions: false, classes: true }] + } +}; diff --git a/rules/mocha/on.js b/rules/mocha/on.js new file mode 100644 index 0000000..ad77de4 --- /dev/null +++ b/rules/mocha/on.js @@ -0,0 +1,5 @@ +module.exports = { + globals: { + should: true + } +}; diff --git a/rules/node-js-and-common-js.js b/rules/node-js-and-common-js.js deleted file mode 100644 index fc156b9..0000000 --- a/rules/node-js-and-common-js.js +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = { - env: { - browser: true, - node: true - }, - rules: { - // NO_RULE 'callback-return': 2, - // NO_RULE 'global-require': 2, - // NO_RULE 'handle-callback-err': 2, - // NO_RULE 'no-mixed-requires': 2, - // NO_RULE 'no-new-require': 2, - // NO_RULE 'no-path-concat': 2, - // NO_RULE 'no-process-env': 2, - // NO_RULE 'no-process-exit': 2, - // NO_RULE 'no-restricted-modules': 2, - // NO_RULE 'no-sync': 2 - } -}; diff --git a/rules/possible-errors.js b/rules/possible-errors.js deleted file mode 100644 index bd1f586..0000000 --- a/rules/possible-errors.js +++ /dev/null @@ -1,39 +0,0 @@ -module.exports = { - env: { - browser: true, - node: true - }, - rules: { - // NO_RULE 'no-await-in-loop': 2, - // 'no-cond-assign': 2, - // 'no-console': 2, - // 'no-constant-condition': 2, - // 'no-control-regex': 2, - // 'no-debugger': 2, - // 'no-dupe-args': 2, - // 'no-dupe-keys': 2, - // 'no-duplicate-case': 2, - // 'no-empty-character-class': 2, - 'no-empty': 2, - // 'no-ex-assign': 2, - // NO_RULE 'no-extra-boolean-cast': 2, - // NO_RULE 'no-extra-parens': 2, - 'no-extra-semi': 2, - // 'no-func-assign': 2, - // 'no-inner-declarations': 2, - // 'no-invalid-regexp': 2, - // 'no-irregular-whitespace': 2, - // 'no-obj-calls': 2, - // NO_RULE 'no-prototype-builtins': 2, - // 'no-regex-spaces': 2, - // 'no-sparse-arrays': 2, - // 'no-template-curly-in-string': 2, - // 'no-unexpected-multiline': 2, - 'no-unreachable': 2 - // 'no-unsafe-finally': 2, - // 'no-unsafe-negation': 2, - // 'use-isnan': 2, - // 'valid-jsdoc': [ 2, { requireReturn: false } ], - // 'valid-typeof': 2 - } -}; diff --git a/rules/strict-mode.js b/rules/strict-mode.js deleted file mode 100644 index 31b21ef..0000000 --- a/rules/strict-mode.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = { - env: { - browser: true, - node: true - }, - rules: { - strict: 0 - } -}; diff --git a/rules/stylistic-issues.js b/rules/stylistic-issues.js deleted file mode 100644 index 98cd1d2..0000000 --- a/rules/stylistic-issues.js +++ /dev/null @@ -1,89 +0,0 @@ -module.exports = { - env: { - browser: true, - node: true - }, - rules: { - 'array-bracket-spacing': [2, 'never'], - // 'block-spacing': 2, - 'brace-style': 2, - camelcase: 2, - // NO_RULE 'capitalized-comments': 2, - 'comma-dangle': [2, 'never'], - // 'comma-spacing': [ 2, { before: false, after: true } ], - 'comma-style': [2, 'last'], - // 'computed-property-spacing': [ 2, 'never' ], - // NO_RULE 'consistent-this': 2, - 'eol-last': 2, - // 'func-call-spacing': [ 2, 'never' ], - // 'func-name-matching': 2, - // 'func-names': 2, - 'func-style': ['error', 'declaration', { allowArrowFunctions: true }], - // 'id-blacklist': 2, - // NO_RULE 'id-length': 2, - // 'id-match': [ 2, '^\\$?(__)?(([A-Z]|[a-z]|[0-9]+)|([A-Z_]))*\\$?$' ], - indent: [2, 4, { SwitchCase: 1 }], - // 'jsx-quotes': [ 2, 'prefer-double' ], - 'key-spacing': [2, { afterColon: true }], - 'keyword-spacing': [2, {}], - // NO_RULE 'line-comment-position': 2, - // 'linebreak-style': [ 2, 'unix' ], - // NO_RULE 'lines-around-comment': 2, - // NO_RULE 'lines-around-directive': 2, - 'max-depth': ['error', 2], - 'max-len': [2, 110], - // 'max-lines': [ 2, { max: 500, skipBlankLines: false, skipComments: false } ], - 'max-nested-callbacks': ['error', 3], - 'max-params': ['error', 10], - // 'max-statements-per-line': [ 2, { max: 1 } ], - 'max-statements': ['error', 20], - // NO_RULE 'multiline-ternary': 2, - 'new-cap': 2, - // 'new-parens': 2, - 'newline-after-var': [2, 'always'], - // NO_RULE 'newline-before-return': 2, - // NO_RULE 'newline-per-chained-call': 2, - // 'no-array-constructor': 2, - 'no-bitwise': 2, - // 'no-continue': 2, - // NO_RULE 'no-inline-comments': 2, - // 'no-lonely-if': 2, - // NO_RULE 'no-mixed-operators': 2, - 'no-mixed-spaces-and-tabs': 2, - 'no-multiple-empty-lines': [2, { max: 1, maxEOF: 1 }], - // 'no-negated-condition': 2, - // 'no-nested-ternary': 2, - // 'no-new-object': 2, - // NO_RULE 'no-plusplus': 2, - // NO_RULE 'no-restricted-syntax': 2, - // 'no-tabs': 2, - // NO_RULE 'no-ternary': 2, - 'no-trailing-spaces': 2, - 'no-underscore-dangle': 2, - // 'no-unneeded-ternary': 2, - // 'no-whitespace-before-property': 2, - // NO_RULE 'object-curly-newline': 2, - // NO_RULE 'object-curly-spacing': 2, - // NO_RULE 'object-property-newline': 2, - // 'one-var-declaration-per-line': 2, - 'one-var': [2, 'always'], - // NO_RULE 'operator-assignment': 2, - // 'operator-linebreak': [ 2, 'after' ], - // NO_RULE 'padded-blocks': 2, - // 'quote-props': [ 2, 'as-needed' ], - quotes: [2, 'single'], - // NO_RULE 'require-jsdoc': 2, - // 'semi-spacing': [ 2, { before: false, after: true } ], - semi: 2, - // NO_RULE 'sort-keys': 2, - // NO_RULE 'sort-vars': 2, - 'space-before-blocks': [2, 'always'], - 'space-before-function-paren': [2, 'always'], - 'space-in-parens': [2, 'never'], - 'space-infix-ops': 2, - 'space-unary-ops': [2, { words: false, nonwords: false }] - // NO_RULE 'spaced-comment': 2, - // 'unicode-bom': [ 2, 'never' ], - // NO_RULE 'wrap-regex': 2 - } -}; diff --git a/rules/variables.js b/rules/variables.js deleted file mode 100644 index 3e0cb06..0000000 --- a/rules/variables.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = { - env: { - browser: true, - node: true - }, - rules: { - // NO_RULE 'init-declarations': 2, - // 'no-catch-shadow': 2, - // 'no-delete-var': 2, - // 'no-label-var': 2, - // 'no-restricted-globals': ['error', 'event', 'fdescribe'], - // 'no-shadow-restricted-names': 2, - // 'no-shadow': 2, - // 'no-undef-init': 2, - 'no-undef': 2, - 'no-undefined': 2, - 'no-unused-vars': 2, - 'no-use-before-define': ['error', { functions: false, classes: true }] - } -}; From 8226d7e400c7bb1d3f8b5c8e2d2105329cc7c014 Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Fri, 23 Dec 2016 12:59:50 +0100 Subject: [PATCH 13/21] refactor(rules): Match rule folder categories to eslint documentation --- configurations/es5-node.js | 2 +- configurations/es5.js | 10 +++++----- configurations/es6-node.js | 2 +- configurations/es6-test.js | 2 +- configurations/es6.js | 2 +- configurations/off.js | 10 +++++----- index.js | 2 +- rules/eslint/{es6 => ecma-script-6}/off.js | 0 rules/eslint/{es6 => ecma-script-6}/on.js | 0 rules/eslint/{node => node-js-and-common-js}/off.js | 0 rules/eslint/{node => node-js-and-common-js}/on.js | 0 rules/eslint/{errors => possible-errors}/off.js | 0 rules/eslint/{errors => possible-errors}/on.js | 0 rules/eslint/{strict => strict-mode}/off.js | 0 rules/eslint/{strict => strict-mode}/on.js | 0 rules/eslint/{style => stylistic-issues}/off.js | 0 rules/eslint/{style => stylistic-issues}/on.js | 0 17 files changed, 15 insertions(+), 15 deletions(-) rename rules/eslint/{es6 => ecma-script-6}/off.js (100%) rename rules/eslint/{es6 => ecma-script-6}/on.js (100%) rename rules/eslint/{node => node-js-and-common-js}/off.js (100%) rename rules/eslint/{node => node-js-and-common-js}/on.js (100%) rename rules/eslint/{errors => possible-errors}/off.js (100%) rename rules/eslint/{errors => possible-errors}/on.js (100%) rename rules/eslint/{strict => strict-mode}/off.js (100%) rename rules/eslint/{strict => strict-mode}/on.js (100%) rename rules/eslint/{style => stylistic-issues}/off.js (100%) rename rules/eslint/{style => stylistic-issues}/on.js (100%) diff --git a/configurations/es5-node.js b/configurations/es5-node.js index c9d523a..8d1fbce 100644 --- a/configurations/es5-node.js +++ b/configurations/es5-node.js @@ -1,7 +1,7 @@ module.exports = { extends: [ '../configurations/es5.js', - '../rules/eslint/node/on.js' + '../rules/eslint/node-js-and-common-js/on.js' ], env: { node: true diff --git a/configurations/es5.js b/configurations/es5.js index 3e55cb9..f2a88f5 100644 --- a/configurations/es5.js +++ b/configurations/es5.js @@ -1,11 +1,11 @@ module.exports = { extends: [ '../rules/eslint/best-practices/on.js', - '../rules/eslint/errors/on.js', - '../rules/eslint/es6/off.js', - '../rules/eslint/node/off.js', - '../rules/eslint/strict/on.js', - '../rules/eslint/style/on.js', + '../rules/eslint/possible-errors/on.js', + '../rules/eslint/ecma-script-6/off.js', + '../rules/eslint/node-js-and-common-js/off.js', + '../rules/eslint/strict-mode/on.js', + '../rules/eslint/stylistic-issues/on.js', '../rules/eslint/variables/on.js' ], parserOptions: { diff --git a/configurations/es6-node.js b/configurations/es6-node.js index 24ceb53..7de31dc 100644 --- a/configurations/es6-node.js +++ b/configurations/es6-node.js @@ -1,7 +1,7 @@ module.exports = { extends: [ '../configurations/es6.js', - '../rules/eslint/node/on.js' + '../rules/eslint/node-js-and-common-js/on.js' ], env: { node: true diff --git a/configurations/es6-test.js b/configurations/es6-test.js index aba9073..913864d 100644 --- a/configurations/es6-test.js +++ b/configurations/es6-test.js @@ -1,6 +1,6 @@ module.exports = { extends: [ - '../configurations/es6' + '../configurations/es6.js' ], env: { mocha: true, diff --git a/configurations/es6.js b/configurations/es6.js index d594425..da6db93 100644 --- a/configurations/es6.js +++ b/configurations/es6.js @@ -1,7 +1,7 @@ module.exports = { extends: [ '../configurations/es5.js', - '../rules/eslint/es6/on.js' + '../rules/eslint/ecma-script-6/on.js' ], parserOptions: { ecmaVersion: 6, diff --git a/configurations/off.js b/configurations/off.js index d919d3c..bf4cb35 100644 --- a/configurations/off.js +++ b/configurations/off.js @@ -1,11 +1,11 @@ module.exports = { extends: [ '../rules/eslint/best-practices/off.js', - '../rules/eslint/errors/off.js', - '../rules/eslint/es6/off.js', - '../rules/eslint/node/off.js', - '../rules/eslint/strict/off.js', - '../rules/eslint/style/off.js', + '../rules/eslint/possible-errors/off.js', + '../rules/eslint/ecma-script-6/off.js', + '../rules/eslint/node-js-and-common-js/off.js', + '../rules/eslint/strict-mode/off.js', + '../rules/eslint/stylistic-issues/off.js', '../rules/eslint/variables/off.js' ], parserOptions: { diff --git a/index.js b/index.js index 16f0eb4..1a6c65a 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ module.exports = { extends: [ - './configurations/es5-test.js', + './configurations/es5.js', './rules/eslint/deprecated/off.js' ] }; diff --git a/rules/eslint/es6/off.js b/rules/eslint/ecma-script-6/off.js similarity index 100% rename from rules/eslint/es6/off.js rename to rules/eslint/ecma-script-6/off.js diff --git a/rules/eslint/es6/on.js b/rules/eslint/ecma-script-6/on.js similarity index 100% rename from rules/eslint/es6/on.js rename to rules/eslint/ecma-script-6/on.js diff --git a/rules/eslint/node/off.js b/rules/eslint/node-js-and-common-js/off.js similarity index 100% rename from rules/eslint/node/off.js rename to rules/eslint/node-js-and-common-js/off.js diff --git a/rules/eslint/node/on.js b/rules/eslint/node-js-and-common-js/on.js similarity index 100% rename from rules/eslint/node/on.js rename to rules/eslint/node-js-and-common-js/on.js diff --git a/rules/eslint/errors/off.js b/rules/eslint/possible-errors/off.js similarity index 100% rename from rules/eslint/errors/off.js rename to rules/eslint/possible-errors/off.js diff --git a/rules/eslint/errors/on.js b/rules/eslint/possible-errors/on.js similarity index 100% rename from rules/eslint/errors/on.js rename to rules/eslint/possible-errors/on.js diff --git a/rules/eslint/strict/off.js b/rules/eslint/strict-mode/off.js similarity index 100% rename from rules/eslint/strict/off.js rename to rules/eslint/strict-mode/off.js diff --git a/rules/eslint/strict/on.js b/rules/eslint/strict-mode/on.js similarity index 100% rename from rules/eslint/strict/on.js rename to rules/eslint/strict-mode/on.js diff --git a/rules/eslint/style/off.js b/rules/eslint/stylistic-issues/off.js similarity index 100% rename from rules/eslint/style/off.js rename to rules/eslint/stylistic-issues/off.js diff --git a/rules/eslint/style/on.js b/rules/eslint/stylistic-issues/on.js similarity index 100% rename from rules/eslint/style/on.js rename to rules/eslint/stylistic-issues/on.js From a95dd2a9e4f37bf84f8a52c83879cc31fe0ce73b Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Fri, 23 Dec 2016 13:21:08 +0100 Subject: [PATCH 14/21] refactor(rules): Move deprecated rules inside the configuration extenders --- configurations/es5.js | 3 ++- configurations/off.js | 3 ++- index.js | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/configurations/es5.js b/configurations/es5.js index f2a88f5..bb4ba5a 100644 --- a/configurations/es5.js +++ b/configurations/es5.js @@ -6,7 +6,8 @@ module.exports = { '../rules/eslint/node-js-and-common-js/off.js', '../rules/eslint/strict-mode/on.js', '../rules/eslint/stylistic-issues/on.js', - '../rules/eslint/variables/on.js' + '../rules/eslint/variables/on.js', + '../rules/eslint/deprecated/off.js' ], parserOptions: { ecmaVersion: 5, diff --git a/configurations/off.js b/configurations/off.js index bf4cb35..5e765cd 100644 --- a/configurations/off.js +++ b/configurations/off.js @@ -6,7 +6,8 @@ module.exports = { '../rules/eslint/node-js-and-common-js/off.js', '../rules/eslint/strict-mode/off.js', '../rules/eslint/stylistic-issues/off.js', - '../rules/eslint/variables/off.js' + '../rules/eslint/variables/off.js', + '../rules/eslint/deprecated/off.js' ], parserOptions: { ecmaVersion: 5, diff --git a/index.js b/index.js index 1a6c65a..8bbde51 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,5 @@ module.exports = { extends: [ - './configurations/es5.js', - './rules/eslint/deprecated/off.js' + './configurations/es5.js' ] }; From 649efcfd12f276b345311def7d7c3c8878e59a84 Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Fri, 23 Dec 2016 13:25:05 +0100 Subject: [PATCH 15/21] build(npm-scripts): Add `test` npm script --- package.json | 16 +++++++++++++++- rules/eslint/stylistic-issues/off.js | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d27ebbd..795ed90 100644 --- a/package.json +++ b/package.json @@ -16,13 +16,27 @@ "scripts": { "commit": "git-cz", "commitmsg": "validate-commit-msg", - "lint": "eslint ." + "lint": "eslint .", + "find-new-eslint-rules:es5-browser": "eslint-find-rules -u ./configurations/es5-browser.js", + "find-new-eslint-rules:es5-node": "eslint-find-rules -u ./configurations/es5-node.js", + "find-new-eslint-rules:es5-test": "eslint-find-rules -u ./configurations/es5-test.js", + "find-new-eslint-rules:es5": "eslint-find-rules -u ./configurations/es5.js", + "find-new-eslint-rules:es6-browser": "eslint-find-rules -u ./configurations/es6-browser.js", + "find-new-eslint-rules:es6-node-test": "eslint-find-rules -u ./configurations/es6-node-test.js", + "find-new-eslint-rules:es6-node": "eslint-find-rules -u ./configurations/es6-node.js", + "find-new-eslint-rules:es6-test": "eslint-find-rules -u ./configurations/es6-test.js", + "find-new-eslint-rules:es6": "eslint-find-rules -u ./configurations/es6.js", + "find-new-eslint-rules:off": "eslint-find-rules -u ./configurations/off.js", + "find-new-eslint-rules": "npm-run-all --parallel find-new-eslint-rules:*", + "test": "npm-run-all --parallel lint find-new-eslint-rules" }, "devDependencies": { "commitizen": "^2.9.2", "cz-conventional-changelog": "^1.2.0", "eslint": "^3.12.2", + "eslint-find-rules": "^1.14.3", "husky": "^0.12.0", + "npm-run-all": "^3.1.2", "validate-commit-msg": "^2.8.2" }, "peerDependencies": { diff --git a/rules/eslint/stylistic-issues/off.js b/rules/eslint/stylistic-issues/off.js index 90c58f0..5479401 100644 --- a/rules/eslint/stylistic-issues/off.js +++ b/rules/eslint/stylistic-issues/off.js @@ -80,6 +80,6 @@ module.exports = { 'space-unary-ops': 0, 'spaced-comment': 0, 'unicode-bom': 0, - 'wrap-regex': 0, + 'wrap-regex': 0 } }; From fb651647dc0c44329c65ffb5f896e921f9ef7f0e Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Fri, 23 Dec 2016 13:30:45 +0100 Subject: [PATCH 16/21] chore(.npmignore): Add .npmignore --- .npmignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .npmignore diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..d0d1a66 --- /dev/null +++ b/.npmignore @@ -0,0 +1,4 @@ +node_modules +.editorconfig +.gitignore +.travis.yml From 37afb4a0a48ba9050d312859b325861c2902bfc0 Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Fri, 23 Dec 2016 16:14:49 +0100 Subject: [PATCH 17/21] docs(README): Update docs --- README.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a6a4ce3..242af5a 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,25 @@ -# eslint-config-casumo -[![version](https://img.shields.io/npm/v/eslint-config-casumo.svg?style=flat-square)](https://www.npmjs.com/package/eslint-config-casumo) -[![downloads](https://img.shields.io/npm/dm/eslint-config-casumo.svg?style=flat-square)](http://npm-stat.com/charts.html?package=eslint-config-casumo&from=2015-08-01) -[![MIT License](https://img.shields.io/npm/l/eslint-config-casumo.svg?style=flat-square)](http://opensource.org/licenses/MIT) -[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) +

eslint-config-casumo

-> ESLint [shareable config](http://eslint.org/docs/developer-guide/shareable-configs.html) for the Casumo JavaScript code style +

+ + + + + + + + + + + + +

+ +

+ ESLint shareable config for the Casumo JavaScript code style +

+ +*** ## Installation @@ -13,7 +28,6 @@ npm install --save-dev eslint-config-casumo ``` ## Usage - Once the `eslint-config-casumo` package is installed, you can use it by specifying `casumo` in the [`extends`](http://eslint.org/docs/user-guide/configuring#extending-configuration-files) section of your [ESLint configuration](http://eslint.org/docs/user-guide/configuring). ```js @@ -24,7 +38,32 @@ Once the `eslint-config-casumo` package is installed, you can use it by specifyi } } ``` -_Note: We omitted the eslint-config- prefix since it is automatically assumed by ESLint._ -You can override settings from the shareable config by adding them directly into your .eslintrc file. +_Note: We omitted the `eslint-config-` prefix since it is automatically assumed by ESLint._ + +You can override settings from the shareable config by adding them directly into your `.eslintrc` file. + +### Full configurations + +This package includes the following complete and ready to use configurations: + +- `casumo` - ES5 config +- `casumo/configurations/es5` - ES5 config +- `casumo/configurations/es5-browser` - ES5 + browser +- `casumo/configurations/es5-node` - ES5 + node +- `casumo/configurations/es5-test` - ES5 + test +- `casumo/configurations/es6` - ES6 config +- `casumo/configurations/es6-browser` - ES6 + browser +- `casumo/configurations/es6-node` - ES6 + node +- `casumo/configurations/es6-test` - ES6 + test +- `casumo/configurations/off` - All rules disabled + +## NPM scripts + +- `commit` - use this if you do not have [`commitizen`](https://github.com/commitizen/cz-cli) installed globally +- `lint` - lints the current project +- `find-new-eslint-rules` - checks for new (missing) rules +- `test` - runs a couple of tests +## Thanks to +- [eslint-config-walmart](https://github.com/walmartlabs/eslint-config-walmart) - for inspiration From a9bebb4188959220ad9b0440e45b3472a1d7e10b Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Fri, 23 Dec 2016 16:29:32 +0100 Subject: [PATCH 18/21] refactor(rules): Add comment on why `deprecated/off` is needed --- configurations/es5.js | 2 ++ configurations/off.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/configurations/es5.js b/configurations/es5.js index bb4ba5a..6b2cbe8 100644 --- a/configurations/es5.js +++ b/configurations/es5.js @@ -7,6 +7,8 @@ module.exports = { '../rules/eslint/strict-mode/on.js', '../rules/eslint/stylistic-issues/on.js', '../rules/eslint/variables/on.js', + // The following line is needed since `eslint-find-rules -u` does not skip deprecated rules. + // This can be removed once https://github.com/sarbbottam/eslint-find-rules/issues/172 is resolved. '../rules/eslint/deprecated/off.js' ], parserOptions: { diff --git a/configurations/off.js b/configurations/off.js index 5e765cd..64de2a3 100644 --- a/configurations/off.js +++ b/configurations/off.js @@ -7,6 +7,8 @@ module.exports = { '../rules/eslint/strict-mode/off.js', '../rules/eslint/stylistic-issues/off.js', '../rules/eslint/variables/off.js', + // The following line is needed since `eslint-find-rules -u` does not skip deprecated rules. + // This can be removed once https://github.com/sarbbottam/eslint-find-rules/issues/172 is resolved. '../rules/eslint/deprecated/off.js' ], parserOptions: { From 72a3ab1aeff35f529245c3d9982598e296ae3d49 Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Fri, 23 Dec 2016 16:31:59 +0100 Subject: [PATCH 19/21] refactor(rules): Update relative paths to `configurations` folder --- configurations/es5-browser.js | 2 +- configurations/es5-node.js | 2 +- configurations/es5-test.js | 2 +- configurations/es6-browser.js | 2 +- configurations/es6-node-test.js | 2 +- configurations/es6-node.js | 2 +- configurations/es6-test.js | 2 +- configurations/es6.js | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/configurations/es5-browser.js b/configurations/es5-browser.js index fc9bb7e..23679f1 100644 --- a/configurations/es5-browser.js +++ b/configurations/es5-browser.js @@ -1,5 +1,5 @@ module.exports = { - extends: '../configurations/es5.js', + extends: './es5.js', env: { browser: true } diff --git a/configurations/es5-node.js b/configurations/es5-node.js index 8d1fbce..78e0703 100644 --- a/configurations/es5-node.js +++ b/configurations/es5-node.js @@ -1,6 +1,6 @@ module.exports = { extends: [ - '../configurations/es5.js', + './es5.js', '../rules/eslint/node-js-and-common-js/on.js' ], env: { diff --git a/configurations/es5-test.js b/configurations/es5-test.js index 9bff3ee..a7e6d5b 100644 --- a/configurations/es5-test.js +++ b/configurations/es5-test.js @@ -1,6 +1,6 @@ module.exports = { extends: [ - '../configurations/es5.js', + './es5.js', '../rules/mocha/on.js' ], env: { diff --git a/configurations/es6-browser.js b/configurations/es6-browser.js index d9b7f16..a006c6d 100644 --- a/configurations/es6-browser.js +++ b/configurations/es6-browser.js @@ -1,5 +1,5 @@ module.exports = { - extends: '../configurations/es6.js', + extends: './es6.js', env: { browser: true } diff --git a/configurations/es6-node-test.js b/configurations/es6-node-test.js index a9f5c89..2c0fa07 100644 --- a/configurations/es6-node-test.js +++ b/configurations/es6-node-test.js @@ -1,6 +1,6 @@ module.exports = { extends: [ - '../configurations/es6-test.js' + './es6-test.js' ], env: { mocha: true, diff --git a/configurations/es6-node.js b/configurations/es6-node.js index 7de31dc..9d9fb7d 100644 --- a/configurations/es6-node.js +++ b/configurations/es6-node.js @@ -1,6 +1,6 @@ module.exports = { extends: [ - '../configurations/es6.js', + './es6.js', '../rules/eslint/node-js-and-common-js/on.js' ], env: { diff --git a/configurations/es6-test.js b/configurations/es6-test.js index 913864d..843425c 100644 --- a/configurations/es6-test.js +++ b/configurations/es6-test.js @@ -1,6 +1,6 @@ module.exports = { extends: [ - '../configurations/es6.js' + './es6.js' ], env: { mocha: true, diff --git a/configurations/es6.js b/configurations/es6.js index da6db93..c1f9f5d 100644 --- a/configurations/es6.js +++ b/configurations/es6.js @@ -1,6 +1,6 @@ module.exports = { extends: [ - '../configurations/es5.js', + './es5.js', '../rules/eslint/ecma-script-6/on.js' ], parserOptions: { From 5e7d41b8711201c414956fcfdcf12922ff0e5a9a Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Mon, 9 Jan 2017 14:48:00 +0100 Subject: [PATCH 20/21] docs(README): Improve documentation Updated contribution steps and added better explenation of the configuration structure --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 242af5a..ba4069c 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,16 @@ _Note: We omitted the `eslint-config-` prefix since it is automatically assumed You can override settings from the shareable config by adding them directly into your `.eslintrc` file. +### Configuration structure +- `casumo/rules/...` - grouping for rules by category (f.ex `eslint`, `mocha`, etc.) + - Each group ideally would have `on/off.js` configurations files which will be used for composing presets +- `causmo/configuration/...` - composition of rules into 'presets' + +#### Why `on.js` and `off.js`? +The idea is to always ship a complete list of ESLint rules and explicitly turn off rule groups which are not needed. This is mostly useful for when `eslint-find-rules` runs. In case any new rule is added the plugin will call out the missing rule. + +For example if we want to completely ignore `ecma-script-6` rules we just extend the configuration preset with `/rules/eslint/ecma-script-6/off.js`. + ### Full configurations This package includes the following complete and ready to use configurations: @@ -65,5 +75,21 @@ This package includes the following complete and ready to use configurations: - `find-new-eslint-rules` - checks for new (missing) rules - `test` - runs a couple of tests +## Contributing + +To contribute to the project, please follow these steps: + +0. File an issue with the idea you wish to put forward +0. Fork the repo +0. Make a branch for your change +0. Run `npm` or `yarn install` +0. Make your changes +0. Run `npm` or `yarn test` +0. Run `git add -A` to add your changes +0. Run `npm` or `yarn run commit` (do not use git commit - unless you have [`commitizen`](https://github.com/commitizen/cz-cli) installed globally) +0. Push your changes +0. Create the Pull Request +0. Get merged and 🎉! + ## Thanks to - [eslint-config-walmart](https://github.com/walmartlabs/eslint-config-walmart) - for inspiration From 2cb604d648d8dcdef12ad050c80c8611e9624436 Mon Sep 17 00:00:00 2001 From: Luke Camilleri Date: Mon, 9 Jan 2017 16:31:08 +0100 Subject: [PATCH 21/21] chore(package.json): Bump version Version bump to 1.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 795ed90..6db9509 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-casumo", - "version": "1.0.0", + "version": "1.1.0", "description": "ESLint shareable config for the Casumo JavaScript code style", "main": "index.js", "author": "Casumo",