[6.x] [eslint-config-kibana] 0.9.0 and 0.10.0 (#13318)
* [eslint-config-kibana] Add jest plugin and settings (#13090) * Add AirBnB linting rules for React best practices. Bump to v0.10.0. (#13259)
This commit is contained in:
parent
df2e5a655f
commit
0ac9c2fdf2
|
@ -5,7 +5,7 @@ module.exports = {
|
||||||
'mocha',
|
'mocha',
|
||||||
'babel',
|
'babel',
|
||||||
'react',
|
'react',
|
||||||
'import'
|
'import',
|
||||||
],
|
],
|
||||||
|
|
||||||
env: {
|
env: {
|
||||||
|
@ -89,6 +89,7 @@ module.exports = {
|
||||||
'object-curly-spacing': 'off', // overriden with babel/object-curly-spacing
|
'object-curly-spacing': 'off', // overriden with babel/object-curly-spacing
|
||||||
'babel/object-curly-spacing': [ 'error', 'always' ],
|
'babel/object-curly-spacing': [ 'error', 'always' ],
|
||||||
|
|
||||||
|
'jsx-quotes': ['error', 'prefer-double'],
|
||||||
'react/jsx-uses-react': 'error',
|
'react/jsx-uses-react': 'error',
|
||||||
'react/react-in-jsx-scope': 'error',
|
'react/react-in-jsx-scope': 'error',
|
||||||
'react/jsx-uses-vars': 'error',
|
'react/jsx-uses-vars': 'error',
|
||||||
|
@ -96,6 +97,7 @@ module.exports = {
|
||||||
'react/jsx-pascal-case': 'error',
|
'react/jsx-pascal-case': 'error',
|
||||||
'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
|
'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
|
||||||
'react/jsx-closing-tag-location': 'error',
|
'react/jsx-closing-tag-location': 'error',
|
||||||
|
'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }],
|
||||||
'react/jsx-indent-props': ['error', 2],
|
'react/jsx-indent-props': ['error', 2],
|
||||||
'react/jsx-max-props-per-line': ['error', { maximum: 1, when: 'multiline' }],
|
'react/jsx-max-props-per-line': ['error', { maximum: 1, when: 'multiline' }],
|
||||||
'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
|
'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
|
||||||
|
@ -109,6 +111,15 @@ module.exports = {
|
||||||
'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
|
'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
|
||||||
'react/jsx-equals-spacing': ['error', 'never'],
|
'react/jsx-equals-spacing': ['error', 'never'],
|
||||||
'react/jsx-indent': ['error', 2],
|
'react/jsx-indent': ['error', 2],
|
||||||
|
'react/no-did-mount-set-state': 'error',
|
||||||
|
'react/no-did-update-set-state': 'error',
|
||||||
|
'react/no-will-update-set-state': 'error',
|
||||||
|
'react/no-is-mounted': 'error',
|
||||||
|
'react/no-multi-comp': ['error', { ignoreStateless: true }],
|
||||||
|
'react/no-unknown-property': 'error',
|
||||||
|
'react/prefer-es6-class': ['error', 'always'],
|
||||||
|
'react/prefer-stateless-function': ['error', { ignorePureComponents: true }],
|
||||||
|
'react/no-unescaped-entities': 'error',
|
||||||
|
|
||||||
'mocha/handle-done-callback': 'error',
|
'mocha/handle-done-callback': 'error',
|
||||||
'mocha/no-exclusive-tests': 'error',
|
'mocha/no-exclusive-tests': 'error',
|
||||||
|
|
|
@ -1,3 +1,31 @@
|
||||||
# eslint-config-kibana
|
# eslint-config-kibana
|
||||||
|
|
||||||
The eslint config used by the kibana team
|
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
packages/eslint-config-kibana/jest.js
Normal file
15
packages/eslint-config-kibana/jest.js
Normal file
|
@ -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',
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@elastic/eslint-config-kibana",
|
"name": "@elastic/eslint-config-kibana",
|
||||||
"version": "0.8.1",
|
"version": "0.10.0",
|
||||||
"description": "The eslint config used by the kibana team",
|
"description": "The eslint config used by the kibana team",
|
||||||
"main": ".eslintrc.js",
|
"main": ".eslintrc.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
"eslint": "^4.1.0",
|
"eslint": "^4.1.0",
|
||||||
"eslint-plugin-babel": "^4.1.1",
|
"eslint-plugin-babel": "^4.1.1",
|
||||||
"eslint-plugin-import": "^2.6.0",
|
"eslint-plugin-import": "^2.6.0",
|
||||||
|
"eslint-plugin-jest": "^20.0.3",
|
||||||
"eslint-plugin-mocha": "^4.9.0",
|
"eslint-plugin-mocha": "^4.9.0",
|
||||||
"eslint-plugin-react": "^7.1.0"
|
"eslint-plugin-react": "^7.1.0"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue