diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8c52ff9 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..fcadb2c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..552f221 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +*.log diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..24690e0 --- /dev/null +++ b/.npmignore @@ -0,0 +1,4 @@ +.* +AUTHORS.md +CONTRIBUTING.md +README.md diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..3849918 --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,3 @@ +# Authors ordered by first contribution + +* Alasdair Mercer diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..df33089 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,15 @@ +# Contributing + +If you have any questions about [eslint-config-notninja](https://github.com/NotNinja/eslint-config-notninja) please feel +free to [raise an issue](https://github.com/NotNinja/eslint-config-notninja/issues/new). + +Please [search existing issues](https://github.com/NotNinja/eslint-config-notninja/issues) for the same feature and/or +issue before raising a new issue. Commenting on an existing issue is usually preferred over raising duplicate issues. + +Please ensure that all files conform to the coding standards, using the same coding style as the rest of the code base. + +All pull requests should be made to the `develop` branch. + +Don't forget to add your details to the list of +[AUTHORS.md](https://github.com/NotNinja/eslint-config-notninja/blob/master/AUTHORS.md) if you want your contribution to +be recognized by others. diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..6cc536a --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,19 @@ +Copyright (C) 2017 Alasdair Mercer, !ninja + +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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9c1d26b --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +# !ninja ESlint Configuration + +[eslint-config-notninja](https://github.com/NotNinja/eslint-config-notninja) contains standard ESLint configurations for +!ninja packages. + +[![License](https://img.shields.io/npm/l/eslint-config-notninja.svg?style=flat-square)](https://github.com/NotNinja/eslint-config-notninja/blob/master/LICENSE.md) +[![Release](https://img.shields.io/npm/v/eslint-config-notninja.svg?style=flat-square)](https://www.npmjs.com/package/eslint-config-notninja) + +* [Install](#install) +* [Configuration](#configuration) +* [Bugs](#bugs) +* [Contributors](#contributors) +* [License](#license) + +## Install + +Install using `npm`: + +``` bash +$ npm install --save-dev eslint-config-notninja +``` + +You'll need to have at least [Node.js](https://nodejs.org) installed. + +## Configuration + +Create an ESLint configuration file within your package that extends this configuration: + +``` json +{ + "extends": "notninja", + ... +} +``` + +This will import the ECMAScript 5 configuration by default. This can also be done by extending `"notninja/es5"`. For +ECMAScript 6 packages, please extend `"notninja/es6"` instead. + +## Bugs + +If you have any problems or would like to see changes currently in development you can do so +[here](https://github.com/NotNinja/eslint-config-notninja/issues). + +## Contributors + +If you want to contribute, you're a legend! Information on how you can do so can be found in +[CONTRIBUTING.md](https://github.com/NotNinja/eslint-config-notninja/blob/master/CONTRIBUTING.md). We want your +suggestions and pull requests! + +A list of contributors can be found in +[AUTHORS.md](https://github.com/NotNinja/eslint-config-notninja/blob/master/AUTHORS.md). + +## License + +See [LICENSE.md](https://github.com/NotNinja/eslint-config-notninja/raw/master/LICENSE.md) for more information on our +MIT license. + +[![Copyright !ninja](https://cdn.rawgit.com/NotNinja/branding/master/assets/copyright/base/not-ninja-copyright-186x25.png)](https://not.ninja) diff --git a/es5.js b/es5.js new file mode 100644 index 0000000..f8a63cf --- /dev/null +++ b/es5.js @@ -0,0 +1,297 @@ +/* + * Copyright (C) 2017 Alasdair Mercer, !ninja + * + * 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. + */ + +'use strict'; + +module.exports = { + parserOptions: { + ecmaVersion: 5 + }, + rules: { + 'no-cond-assign': 'error', + 'no-console': 'error', + 'no-constant-condition': 'error', + 'no-control-regex': 'error', + 'no-debugger': 'error', + 'no-dupe-args': 'error', + 'no-dupe-keys': 'error', + 'no-duplicate-case': 'error', + 'no-empty-character-class': 'error', + 'no-empty': 'error', + 'no-ex-assign': 'error', + 'no-extra-boolean-cast': 'error', + 'no-extra-parens': [ + 'error', + 'all', + { + 'nestedBinaryExpressions': false + } + ], + 'no-extra-semi': 'error', + 'no-func-assign': 'error', + 'no-inner-declarations': 'error', + 'no-invalid-regexp': 'error', + 'no-irregular-whitespace': 'error', + 'no-obj-calls': 'error', + 'no-prototype-builtins': 'error', + 'no-regex-spaces': 'error', + 'no-sparse-arrays': 'error', + 'no-template-curly-in-string': 'error', + 'no-unexpected-multiline': 'error', + 'no-unreachable': 'error', + 'no-unsafe-finally': 'error', + 'no-unsafe-negation': 'error', + 'use-isnan': 'error', + 'valid-jsdoc': 'error', + 'valid-typeof': 'error', + + 'accessor-pairs': 'error', + 'array-callback-return': 'error', + 'block-scoped-var': 'error', + 'complexity': 'warn', + 'consistent-return': 'warn', + 'curly': 'error', + 'default-case': 'warn', + 'dot-location': [ + 'error', + 'property' + ], + 'dot-notation': 'error', + 'eqeqeq': [ + 'error', + 'always', + { + 'null': 'ignore' + } + ], + 'guard-for-in': 'error', + 'no-alert': 'error', + 'no-caller': 'error', + 'no-case-declarations': 'error', + 'no-div-regex': 'error', + 'no-else-return': 'warn', + 'no-empty-function': 'warn', + 'no-empty-pattern': 'error', + 'no-eq-null': 'off', + 'no-eval': 'error', + 'no-extend-native': 'error', + 'no-extra-bind': 'warn', + 'no-extra-label': 'error', + 'no-fallthrough': 'warn', + 'no-floating-decimal': 'error', + 'no-global-assign': 'error', + 'no-implicit-coercion': 'error', + 'no-implicit-globals': 'error', + 'no-implied-eval': 'error', + 'no-invalid-this': 'error', + 'no-iterator': 'error', + 'no-labels': 'error', + 'no-lone-blocks': 'error', + 'no-loop-func': 'error', + 'no-magic-numbers': 'off', + 'no-multi-spaces': 'error', + 'no-multi-str': 'error', + 'no-new-func': 'error', + 'no-new-wrappers': 'error', + 'no-new': 'error', + 'no-octal-escape': 'error', + 'no-octal': 'error', + 'no-param-reassign': 'off', + 'no-proto': 'error', + 'no-redeclare': 'error', + 'no-return-assign': 'error', + 'no-script-url': 'error', + 'no-self-assign': 'error', + 'no-self-compare': 'error', + 'no-sequences': 'error', + 'no-throw-literal': 'error', + 'no-unmodified-loop-condition': 'error', + 'no-unused-expressions': 'warn', + 'no-unused-labels': 'error', + 'no-useless-call': 'error', + 'no-useless-concat': 'error', + 'no-useless-escape': 'error', + 'no-void': 'error', + 'no-warning-comments': 'warn', + 'no-with': 'error', + 'radix': 'error', + 'vars-on-top': 'off', + 'wrap-iife': 'error', + 'yoda': 'off', + + 'strict': 'error', + + 'init-declarations': 'off', + 'no-catch-shadow': 'error', + 'no-delete-var': 'error', + 'no-label-var': 'error', + 'no-restricted-globals': 'error', + 'no-shadow-restricted-names': 'error', + 'no-shadow': 'error', + 'no-undef-init': 'error', + 'no-undef': 'error', + 'no-undefined': 'error', + 'no-unused-vars': 'warn', + 'no-use-before-define': 'error', + + 'callback-return': 'warn', + 'global-require': 'error', + 'handle-callback-err': 'warn', + 'no-mixed-requires': 'warn', + 'no-new-require': 'error', + 'no-path-concat': 'error', + 'no-process-env': 'error', + 'no-process-exit': 'error', + 'no-restricted-modules': 'off', + 'no-sync': 'off', + + 'array-bracket-spacing': [ + 'error', + 'always' + ], + 'block-spacing': 'error', + 'brace-style': 'error', + 'camelcase': 'error', + 'comma-dangle': 'error', + 'comma-spacing': 'error', + 'comma-style': 'error', + 'computed-property-spacing': 'error', + 'consistent-this': 'off', + 'eol-last': [ + 'error', + 'unix' + ], + 'func-call-spacing': 'error', + 'func-name-matching': 'error', + 'func-names': [ + 'error', + 'never' + ], + 'func-style': 'off', + 'id-blacklist': 'off', + 'id-length': 'off', + 'id-match': 'off', + 'indent': [ + 'error', + 2 + ], + 'jsx-quotes': 'error', + 'key-spacing': 'error', + 'keyword-spacing': 'error', + 'linebreak-style': [ + 'error', + 'unix' + ], + 'lines-around-comment': 'off', + 'max-depth': 'warn', + 'max-len': [ + 'warn', + 120, + 2 + ], + 'max-lines': 'off', + 'max-nested-callbacks': 'error', + 'max-params': 'error', + 'max-statements-per-line': 'error', + 'max-statements': 'off', + 'multiline-ternary': 'off', + 'new-cap': 'error', + 'new-parens': 'error', + 'newline-after-var': 'off', + 'newline-before-return': 'off', + 'newline-per-chained-call': 'off', + 'no-array-constructor': 'error', + 'no-bitwise': 'error', + 'no-continue': 'off', + 'no-inline-comments': 'error', + 'no-lonely-if': 'error', + 'no-mixed-operators': 'warn', + 'no-mixed-spaces-and-tabs': 'error', + 'no-multiple-empty-lines': 'error', + 'no-negated-condition': 'off', + 'no-nested-ternary': 'warn', + 'no-new-object': 'error', + 'no-plusplus': 'off', + 'no-restricted-syntax': 'off', + 'no-tabs': 'error', + 'no-ternary': 'off', + 'no-trailing-spaces': 'error', + 'no-underscore-dangle': 'off', + 'no-unneeded-ternary': 'error', + 'no-whitespace-before-property': 'error', + 'object-curly-newline': [ + 'error', + { + 'multiline': true + } + ], + 'object-curly-spacing': [ + 'error', + 'always' + ], + 'object-property-newline': 'off', + 'one-var-declaration-per-line': 'error', + 'one-var': [ + 'error', + { + 'initialized': 'never' + } + ], + 'operator-assignment': 'warn', + 'operator-linebreak': 'error', + 'padded-blocks': [ + 'error', + { + 'blocks': 'never', + 'classes': 'always', + 'switches': 'never' + } + ], + 'quote-props': [ + 'error', + 'consistent-as-needed' + ], + 'quotes': [ + 'error', + 'single' + ], + 'require-jsdoc': 'off', + 'semi-spacing': 'error', + 'semi': [ + 'error', + 'always' + ], + 'sort-keys': 'off' + 'sort-vars': 'off', + 'space-before-blocks': 'error', + 'space-before-function-paren': [ + 'error', + 'never' + ], + 'space-in-parens': 'error', + 'space-infix-ops': 'error', + 'space-unary-ops': 'error', + 'spaced-comment': 'error', + 'unicode-bom': 'error', + 'wrap-regex': 'off' + } +}; diff --git a/es6.js b/es6.js new file mode 100644 index 0000000..19f61f6 --- /dev/null +++ b/es6.js @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2017 Alasdair Mercer, !ninja + * + * 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. + */ + +'use strict'; + +module.exports = { + extends: './es5.js', + env: { + es6: true + }, + parserOptions: { + ecmaVersion: 6 + }, + rules: { + 'arrow-body-style': 'off', + 'arrow-parens': [ + 'error', + 'always' + ], + 'arrow-spacing': 'error', + 'constructor-super': 'warn', + 'generator-star-spacing': 'error', + 'no-class-assign': 'error', + 'no-confusing-arrow': 'error', + 'no-const-assign': 'error', + 'no-dupe-class-members': 'error', + 'no-duplicate-imports': 'error', + 'no-new-symbol': 'error', + 'no-restricted-imports': 'off', + 'no-this-before-super': 'error', + 'no-useless-computed-key': 'error', + 'no-useless-constructor': 'warn', + 'no-useless-rename': 'error', + 'no-var': 'error', + 'object-shorthand': 'warn', + 'prefer-arrow-callback': 'warn', + 'prefer-const': 'warn', + 'prefer-reflect': 'off', + 'prefer-rest-params': 'warn', + 'prefer-spread': 'warn', + 'prefer-template': 'error', + 'require-yield': 'error', + 'rest-spread-spacing': 'error', + 'sort-imports': 'off', + 'symbol-description': 'warn', + 'template-curly-spacing': 'error', + 'yield-star-spacing': 'error' + } +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..e0c9288 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "eslint-config-notninja", + "version": "0.1.0", + "description": "Standard ESLint configurations for !ninja packages", + "homepage": "https://github.com/NotNinja/eslint-config-notninja", + "bugs": { + "url": "https://github.com/NotNinja/eslint-config-notninja/issues" + }, + "author": { + "name": "Alasdair Mercer", + "email": "mercer.alasdair@gmail.com", + "url": "https://not.ninja" + }, + "license": "MIT", + "keywords": [ + "eslint", + "config", + "notninja" + ], + "repository": { + "type": "git", + "url": "https://github.com/NotNinja/eslint-config-notninja.git" + }, + "main": "es5.js" +}