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

[UI Framework] [K7] Upgrade linter to 0.9.0. #13290

Merged
merged 2 commits into from
Aug 2, 2017
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
6 changes: 4 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
extends: '@elastic/kibana'
extends:
- '@elastic/eslint-config-kibana'
- '@elastic/eslint-config-kibana/jest'

settings:
import/resolver:
'@elastic/eslint-import-resolver-kibana':
rootPackageName: 'kibana'
kibanaPath: .
kibanaPath: .
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
"yauzl": "2.7.0"
},
"devDependencies": {
"@elastic/eslint-config-kibana": "0.6.1",
"@elastic/eslint-config-kibana": "0.9.0",
"@elastic/eslint-import-resolver-kibana": "0.8.1",
"@elastic/eslint-plugin-kibana-custom": "1.0.3",
"angular-mocks": "1.4.7",
Expand All @@ -222,7 +222,7 @@
"eslint-plugin-import": "2.3.0",
"eslint-plugin-jest": "20.0.3",
"eslint-plugin-mocha": "4.9.0",
"eslint-plugin-react": "7.0.1",
"eslint-plugin-react": "7.1.0",
"event-stream": "3.3.2",
"expect.js": "0.3.1",
"faker": "1.1.0",
Expand Down
125 changes: 125 additions & 0 deletions packages/eslint-config-kibana/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
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/react-in-jsx-scope': 'error',
'react/jsx-uses-vars': 'error',
'react/jsx-no-undef': 'error',
'react/jsx-pascal-case': 'error',
'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
'react/jsx-closing-tag-location': 'error',
'react/jsx-indent-props': ['error', 2],
'react/jsx-max-props-per-line': ['error', { maximum: 1, when: 'multiline' }],
'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
'react/self-closing-comp': 'error',
'react/jsx-wrap-multilines': ['error', {
declaration: true,
assignment: true,
return: true,
arrow: true,
}],
'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
'react/jsx-equals-spacing': ['error', 'never'],
'react/jsx-indent': ['error', 2],

'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
31 changes: 31 additions & 0 deletions packages/eslint-config-kibana/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +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',
},
};
29 changes: 29 additions & 0 deletions packages/eslint-config-kibana/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "@elastic/eslint-config-kibana",
"version": "0.9.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-jest": "^20.0.3",
"eslint-plugin-mocha": "^4.9.0",
"eslint-plugin-react": "^7.1.0"
}
}
13 changes: 0 additions & 13 deletions ui_framework/.eslintrc

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class GuideSandboxCodeToggle extends Component {
className="guideSandboxCodeToggle guideSection__sourceButton"
onClick={this.onClickSource}
>
<span className="fa fa-code"></span>
<span className="fa fa-code" />
</button>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class GuideSection extends Component {
className="guideSection__sourceButton"
onClick={this.onClickSource}
>
<span className="fa fa-code"></span>
<span className="fa fa-code" />
</button>
</div>

Expand Down
16 changes: 8 additions & 8 deletions ui_framework/doc_site/src/views/button/button_with_icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default () => (
<div>
<KuiButton
onClick={() => window.alert('Button clicked')}
icon = "arrowUp"
icon="arrowUp"
>
Default
</KuiButton>
Expand All @@ -17,7 +17,7 @@ export default () => (

<KuiButton
fill
icon = "arrowDown"
icon="arrowDown"
onClick={() => window.alert('Button clicked')}
>
Filled
Expand All @@ -26,7 +26,7 @@ export default () => (
&nbsp;&nbsp;

<KuiButton
icon = "arrowLeft"
icon="arrowLeft"
size="small"
onClick={() => window.alert('Button clicked')}
>
Expand All @@ -36,7 +36,7 @@ export default () => (
&nbsp;&nbsp;

<KuiButton
icon = "arrowRight"
icon="arrowRight"
size="small"
fill
onClick={() => window.alert('Button clicked')}
Expand All @@ -49,7 +49,7 @@ export default () => (
<KuiButton
iconReverse
onClick={() => window.alert('Button clicked')}
icon = "arrowUp"
icon="arrowUp"
>
Default
</KuiButton>
Expand All @@ -59,7 +59,7 @@ export default () => (
<KuiButton
iconReverse
fill
icon = "arrowDown"
icon="arrowDown"
onClick={() => window.alert('Button clicked')}
>
Filled
Expand All @@ -69,7 +69,7 @@ export default () => (

<KuiButton
iconReverse
icon = "arrowLeft"
icon="arrowLeft"
size="small"
onClick={() => window.alert('Button clicked')}
>
Expand All @@ -80,7 +80,7 @@ export default () => (

<KuiButton
iconReverse
icon = "arrowRight"
icon="arrowRight"
size="small"
fill
onClick={() => window.alert('Button clicked')}
Expand Down
3 changes: 1 addition & 2 deletions ui_framework/doc_site/src/views/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ export default class extends Component {
>
<div className="kuiHeaderProfile kui--flexRow kui--flexAlignItemsCenter">
<div className="kui--flexShrink1 kui--paddingRight">
<div className="kuiAvatar kuiAvatar--large" style={{ background: `url('http://lorempixel.com/64/64/cats/')` }}>
</div>
<div className="kuiAvatar kuiAvatar--large" style={{ background: `url('http://lorempixel.com/64/64/cats/')` }} />
</div>
<div className="kui--flexGrow1">
<p className="kui--marginBottom">John Username</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const NotFoundView = () => (
to="/"
>
home page
</Link>?
</Link>?
</p>
</div>
</div>
Expand Down
Loading