Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eslint-config-kibana] Add jest plugin and settings #13090

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/eslint-config-kibana/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
'mocha',
'babel',
'react',
'import'
'import',
],

env: {
Expand Down
28 changes: 28 additions & 0 deletions packages/eslint-config-kibana/README.md
Original file line number Diff line number Diff line change
@@ -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'
]
}
```
15 changes: 15 additions & 0 deletions packages/eslint-config-kibana/jest.js
Original file line number Diff line number Diff line change
@@ -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',
},
};
3 changes: 2 additions & 1 deletion packages/eslint-config-kibana/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will always require the jest eslint plugin be installed, but I think that's okey. I don't see any harm in people not using Jest having to install this, as this works great for Kibana and xpack.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't peer dependencies always considered optional?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah, you'll just receive the warning

"eslint-plugin-mocha": "^4.9.0",
"eslint-plugin-react": "^7.1.0"
}
Expand Down