From f753744d89674d600a456604b7e1db111fdb8b4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Tue, 25 Jul 2017 10:34:02 +0200 Subject: [PATCH 1/2] [eslint-config-kibana] Add jest plugin and settings This extracts the ui-specific eslint settings from elastic/kibana so they can be applied to other repositories as well. --- packages/eslint-config-kibana/.eslintrc.js | 2 +- packages/eslint-config-kibana/README.md | 28 ++++++++++++++++++++++ packages/eslint-config-kibana/jest.js | 15 ++++++++++++ packages/eslint-config-kibana/package.json | 1 + 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 packages/eslint-config-kibana/jest.js diff --git a/packages/eslint-config-kibana/.eslintrc.js b/packages/eslint-config-kibana/.eslintrc.js index 0da188502cf7f..91f200949342c 100644 --- a/packages/eslint-config-kibana/.eslintrc.js +++ b/packages/eslint-config-kibana/.eslintrc.js @@ -5,7 +5,7 @@ module.exports = { 'mocha', 'babel', 'react', - 'import' + 'import', ], env: { diff --git a/packages/eslint-config-kibana/README.md b/packages/eslint-config-kibana/README.md index 4b20fc999b48a..68c1639b834a5 100644 --- a/packages/eslint-config-kibana/README.md +++ b/packages/eslint-config-kibana/README.md @@ -1,3 +1,31 @@ # eslint-config-kibana The eslint config used by the kibana team + +## Usage + +To use this eslint config, just install the peer dependencies and reference it +in your `.eslintrc`: + +```javascript +{ + extends: [ + '@elastic/eslint-config-kibana' + ] +} +``` + +## Optional jest config + +If the project uses the [jest test runner](https://facebook.github.io/jest/), +the `@elastic/eslint-config-kibana/jest` config can be extended as well to use +`eslint-plugin-jest` and add settings specific to it: + +```javascript +{ + extends: [ + '@elastic/eslint-config-kibana', + '@elastic/eslint-config-kibana/jest' + ] +} +``` diff --git a/packages/eslint-config-kibana/jest.js b/packages/eslint-config-kibana/jest.js new file mode 100644 index 0000000000000..68776bb3db147 --- /dev/null +++ b/packages/eslint-config-kibana/jest.js @@ -0,0 +1,15 @@ +module.exports = { + plugins: [ + 'jest', + ], + + env: { + 'jest/globals': true, + }, + + rules: { + 'jest/no-disabled-tests': 'error', + 'jest/no-focused-tests': 'error', + 'jest/no-identical-title': 'error', + }, +}; diff --git a/packages/eslint-config-kibana/package.json b/packages/eslint-config-kibana/package.json index f3bb21dfe7c6d..d24489c1ecf98 100644 --- a/packages/eslint-config-kibana/package.json +++ b/packages/eslint-config-kibana/package.json @@ -22,6 +22,7 @@ "eslint": "^4.1.0", "eslint-plugin-babel": "^4.1.1", "eslint-plugin-import": "^2.6.0", + "eslint-plugin-jest": "^20.0.3", "eslint-plugin-mocha": "^4.9.0", "eslint-plugin-react": "^7.1.0" } From e78698d2c370cb99fb802f2057db216a5a683ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Thu, 27 Jul 2017 11:22:52 +0200 Subject: [PATCH 2/2] Bump eslint-config-kibana package version --- packages/eslint-config-kibana/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-config-kibana/package.json b/packages/eslint-config-kibana/package.json index d24489c1ecf98..9c042fe34734f 100644 --- a/packages/eslint-config-kibana/package.json +++ b/packages/eslint-config-kibana/package.json @@ -1,6 +1,6 @@ { "name": "@elastic/eslint-config-kibana", - "version": "0.8.1", + "version": "0.9.0", "description": "The eslint config used by the kibana team", "main": ".eslintrc.js", "scripts": {