Skip to content

Commit

Permalink
Move eslint-config-kibana into core (#12725) (#13124)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
cjcenizal committed Jul 26, 2017
1 parent 4d8120d commit 739360a
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 0 deletions.
109 changes: 109 additions & 0 deletions packages/eslint-config-kibana/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -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',
}
}
36 changes: 36 additions & 0 deletions packages/eslint-config-kibana/.gitignore
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions packages/eslint-config-kibana/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.eslintrc.yaml
tasks
3 changes: 3 additions & 0 deletions packages/eslint-config-kibana/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# eslint-config-kibana

The eslint config used by the kibana team
28 changes: 28 additions & 0 deletions packages/eslint-config-kibana/package.json
Original file line number Diff line number Diff line change
@@ -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 <email@spalger.com>",
"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"
}
}

0 comments on commit 739360a

Please sign in to comment.