From bdaf8485b0b459da7b814b5fd155bfac31c52550 Mon Sep 17 00:00:00 2001 From: Kim Joar Bekkelund Date: Tue, 25 Jul 2017 10:02:14 +0200 Subject: [PATCH] Move eslint-config-kibana into core (#12725) * Initial commit * added actual config * version 0.0.1 * version 0.0.2 * [no-const-assign] Disallow assignment to const http://eslint.org/docs/rules/no-const-assign * [no-redeclare] Disallow redeclaring variables http://eslint.org/docs/rules/no-redeclare * version 0.0.3 * [no-unused-vars]: Disallow declaration of variables that are not used in the code. * Bump to 0.1.0. * upgrade deps in preperation for babel6 transition * 0.2.0-alpha1 * use yaml for readability * 0.2.0 * update/pin peed dependency versions * 0.2.1 * [quotes] allow template literals This allows eslint to validate this rule from the styleguide: https://github.com/elastic/kibana/blob/master/style_guides/js_style_guide.md#use-template-strings-to-avoid-escaping-single-quotes * 0.2.2 * add object-curly-spacing and no-global-assign rules * sort .eslintrc.yaml rules * 0.3.0 * add basic react support * 0.4.0 * Disallow using 'context' in tests * 0.5.0 * move from .eslintrc.yaml to .eslintrc.js without .json generation (#6) * Implement import plugin (#7) * update deps * include eslint-plugin-import * Dereference import config (#8) * reorganize existing rules into groups * defreference eslint-plugin-import "recommended" config Based on https://github.com/benmosher/eslint-plugin-import/blob/ea9c92c7324473ef303ac76b127e17af2becd2ee/config/recommended.js * 0.6.0 * set environment info for import rule * 0.6.1 * update peerDependencies * 0.7.0 * Move eslint-config-kibana into packages directory --- packages/eslint-config-kibana/.eslintrc.js | 109 +++++++++++++++++++++ packages/eslint-config-kibana/.gitignore | 36 +++++++ packages/eslint-config-kibana/.npmignore | 2 + packages/eslint-config-kibana/README.md | 3 + packages/eslint-config-kibana/package.json | 28 ++++++ 5 files changed, 178 insertions(+) create mode 100644 packages/eslint-config-kibana/.eslintrc.js create mode 100644 packages/eslint-config-kibana/.gitignore create mode 100644 packages/eslint-config-kibana/.npmignore create mode 100644 packages/eslint-config-kibana/README.md create mode 100644 packages/eslint-config-kibana/package.json diff --git a/packages/eslint-config-kibana/.eslintrc.js b/packages/eslint-config-kibana/.eslintrc.js new file mode 100644 index 0000000000000..2e488a745ee39 --- /dev/null +++ b/packages/eslint-config-kibana/.eslintrc.js @@ -0,0 +1,109 @@ +module.exports = { + parser: 'babel-eslint', + + plugins: [ + 'mocha', + 'babel', + 'react', + 'import' + ], + + env: { + es6: true, + amd: true, + node: true, + mocha: true, + browser: true, + }, + + parserOptions: { + sourceType: 'module', + ecmaVersion: 6, + ecmaFeatures: { experimentalObjectRestSpread: true }, + }, + + rules: { + 'block-scoped-var': 'error', + camelcase: [ 'error', { properties: 'never' } ], + 'comma-dangle': 'off', + 'comma-style': [ 'error', 'last' ], + 'consistent-return': 'off', + curly: [ 'error', 'multi-line' ], + 'dot-location': [ 'error', 'property' ], + 'dot-notation': [ 'error', { allowKeywords: true } ], + eqeqeq: [ 'error', 'allow-null' ], + 'guard-for-in': 'error', + indent: [ 'error', 2, { SwitchCase: 1 } ], + 'key-spacing': [ 'off', { align: 'value' } ], + 'max-len': [ 'error', 140, 2, { ignoreComments: true, ignoreUrls: true } ], + 'new-cap': [ 'error', { capIsNewExceptions: [ 'Private' ] } ], + 'no-bitwise': 'off', + 'no-caller': 'error', + 'no-cond-assign': 'off', + 'no-const-assign': 'error', + 'no-debugger': 'error', + 'no-empty': 'error', + 'no-eval': 'error', + 'no-extend-native': 'error', + 'no-extra-parens': 'off', + 'no-extra-semi': [ 'error' ], + 'no-global-assign': 'error', + 'no-irregular-whitespace': 'error', + 'no-iterator': 'error', + 'no-loop-func': 'error', + 'no-multi-spaces': 'off', + 'no-multi-str': 'error', + 'no-nested-ternary': 'error', + 'no-new': 'off', + 'no-path-concat': 'off', + 'no-proto': 'error', + 'no-redeclare': 'error', + 'no-restricted-globals': [ 'error', 'context' ], + 'no-return-assign': 'off', + 'no-script-url': 'error', + 'no-sequences': 'error', + 'no-shadow': 'off', + 'no-trailing-spaces': 'error', + 'no-undef': 'error', + 'no-underscore-dangle': 'off', + 'no-unused-expressions': 'off', + 'no-unused-vars': [ 'error' ], + 'no-use-before-define': [ 'error', 'nofunc' ], + 'no-var': 'error', + 'no-with': 'error', + 'one-var': [ 'error', 'never' ], + 'prefer-const': 'error', + quotes: [ 'error', 'single', { allowTemplateLiterals: true } ], + 'semi-spacing': [ 'error', { before: false, after: true } ], + semi: [ 'error', 'always' ], + 'space-before-blocks': [ 'error', 'always' ], + 'space-before-function-paren': [ 'error', { anonymous: 'always', named: 'never' } ], + 'space-in-parens': [ 'error', 'never' ], + 'space-infix-ops': [ 'error', { int32Hint: false } ], + 'space-unary-ops': [ 'error' ], + strict: [ 'error', 'never' ], + 'valid-typeof': 'error', + 'wrap-iife': [ 'error', 'outside' ], + yoda: 'off', + + 'object-curly-spacing': 'off', // overriden with babel/object-curly-spacing + 'babel/object-curly-spacing': [ 'error', 'always' ], + + 'react/jsx-uses-react': 'error', + 'react/jsx-uses-vars': 'error', + 'react/jsx-no-undef': 'error', + 'react/jsx-pascal-case': 'error', + + 'mocha/handle-done-callback': 'error', + 'mocha/no-exclusive-tests': 'error', + + 'import/no-unresolved': [ 'error', { 'amd': true, 'commonjs': true } ], + 'import/named': 'error', + 'import/namespace': 'error', + 'import/default': 'error', + 'import/export': 'error', + 'import/no-named-as-default': 'error', + 'import/no-named-as-default-member': 'error', + 'import/no-duplicates': 'error', + } +} \ No newline at end of file diff --git a/packages/eslint-config-kibana/.gitignore b/packages/eslint-config-kibana/.gitignore new file mode 100644 index 0000000000000..7c0c9807a8b7d --- /dev/null +++ b/packages/eslint-config-kibana/.gitignore @@ -0,0 +1,36 @@ +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +node_modules + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history +.eslintrc.json + +yarn.lock \ No newline at end of file diff --git a/packages/eslint-config-kibana/.npmignore b/packages/eslint-config-kibana/.npmignore new file mode 100644 index 0000000000000..2ba159593147d --- /dev/null +++ b/packages/eslint-config-kibana/.npmignore @@ -0,0 +1,2 @@ +.eslintrc.yaml +tasks diff --git a/packages/eslint-config-kibana/README.md b/packages/eslint-config-kibana/README.md new file mode 100644 index 0000000000000..4b20fc999b48a --- /dev/null +++ b/packages/eslint-config-kibana/README.md @@ -0,0 +1,3 @@ +# eslint-config-kibana + +The eslint config used by the kibana team diff --git a/packages/eslint-config-kibana/package.json b/packages/eslint-config-kibana/package.json new file mode 100644 index 0000000000000..09e2ee7db6b86 --- /dev/null +++ b/packages/eslint-config-kibana/package.json @@ -0,0 +1,28 @@ +{ + "name": "@elastic/eslint-config-kibana", + "version": "0.7.0", + "description": "The eslint config used by the kibana team", + "main": ".eslintrc.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/elastic/eslint-config-kibana.git" + }, + "keywords": [], + "author": "Spencer Alger ", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/elastic/eslint-config-kibana/issues" + }, + "homepage": "https://github.com/elastic/eslint-config-kibana#readme", + "peerDependencies": { + "babel-eslint": "^7.2.3", + "eslint": "^4.1.0", + "eslint-plugin-babel": "^4.1.1", + "eslint-plugin-import": "^2.6.0", + "eslint-plugin-mocha": "^4.9.0", + "eslint-plugin-react": "^7.0.1" + } +}