From c3ef6bd25aedc9fa94729495c30f564ce5d8b4e3 Mon Sep 17 00:00:00 2001 From: Javi Velasco Date: Sun, 10 Apr 2016 17:49:23 +0200 Subject: [PATCH] Update linting --- .eslintrc | 2 +- components/_globals.scss | 10 +++---- components/autocomplete/Autocomplete.jsx | 4 +-- components/date_picker/Calendar.jsx | 7 +++-- components/input/Input.jsx | 11 ++++---- components/tabs/Tabs.jsx | 6 ++--- tools/generateMarkdown.js | 33 ++++++++++++------------ 7 files changed, 35 insertions(+), 38 deletions(-) diff --git a/.eslintrc b/.eslintrc index 03a58a79..1b11bd11 100644 --- a/.eslintrc +++ b/.eslintrc @@ -164,7 +164,7 @@ "no-with": [2], "one-var": [0], "operator-assignment": [0, "always"], - "operator-linebreak": [2, "after"], + "operator-linebreak": [2, "before"], "padded-blocks": [0], "prefer-const": [2], "prefer-spread": [2], diff --git a/components/_globals.scss b/components/_globals.scss index 53a2ac01..1759ac61 100644 --- a/components/_globals.scss +++ b/components/_globals.scss @@ -32,11 +32,11 @@ $shadow-key-penumbra-opacity: 0.14 !default; $shadow-ambient-shadow-opacity: 0.12 !default; //-- Depth Shadows -$zdepth-shadow-1: 0 1px 6px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.24); -$zdepth-shadow-2: 0 3px 10px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.23); -$zdepth-shadow-3: 0 10px 30px rgba(0,0,0,0.19), 0 6px 10px rgba(0,0,0,0.23); -$zdepth-shadow-4: 0 14px 45px rgba(0,0,0,0.25), 0 10px 18px rgba(0,0,0,0.22); -$zdepth-shadow-5: 0 19px 60px rgba(0,0,0,0.30), 0 15px 20px rgba(0,0,0,0.22); +$zdepth-shadow-1: 0 1px 6px rgba(0,0,0,.12), 0 1px 4px rgba(0,0,0,.24); +$zdepth-shadow-2: 0 3px 10px rgba(0,0,0,.16), 0 3px 10px rgba(0,0,0,.23); +$zdepth-shadow-3: 0 10px 30px rgba(0,0,0,.19), 0 6px 10px rgba(0,0,0,.23); +$zdepth-shadow-4: 0 14px 45px rgba(0,0,0,.25), 0 10px 18px rgba(0,0,0,.22); +$zdepth-shadow-5: 0 19px 60px rgba(0,0,0,.3), 0 15px 20px rgba(0,0,0,.22); //-- Animation $animation-duration: .35s; diff --git a/components/autocomplete/Autocomplete.jsx b/components/autocomplete/Autocomplete.jsx index 2dd75a98..3897b1b1 100644 --- a/components/autocomplete/Autocomplete.jsx +++ b/components/autocomplete/Autocomplete.jsx @@ -113,8 +113,8 @@ class Autocomplete extends React.Component { const query = this.state.query.toLowerCase().trim() || ''; const values = this.values(); for (const [key, value] of this.source()) { - if (value.toLowerCase().trim().startsWith(query) && - (!values.has(key) || !this.props.multiple)) { + if (value.toLowerCase().trim().startsWith(query) + && (!values.has(key) || !this.props.multiple)) { suggest.set(key, value); } } diff --git a/components/date_picker/Calendar.jsx b/components/date_picker/Calendar.jsx index 610731b5..a204550b 100644 --- a/components/date_picker/Calendar.jsx +++ b/components/date_picker/Calendar.jsx @@ -33,10 +33,9 @@ class Calendar extends React.Component { } scrollToActive () { - this.refs.years.scrollTop = - this.refs.activeYear.offsetTop - - this.refs.years.offsetHeight / 2 + - this.refs.activeYear.offsetHeight / 2; + this.refs.years.scrollTop = this.refs.activeYear.offsetTop + - this.refs.years.offsetHeight / 2 + + this.refs.activeYear.offsetHeight / 2; } handleDayClick = (day) => { diff --git a/components/input/Input.jsx b/components/input/Input.jsx index 03b04d52..13f5d646 100644 --- a/components/input/Input.jsx +++ b/components/input/Input.jsx @@ -83,11 +83,12 @@ class Input extends React.Component { {InputElement} {icon ? : null} - {labelText ? - : null} + {labelText + ? + : null} {hint ? {hint} : null} {error ? {error} : null} {maxLength ? {length}/{maxLength} : null} diff --git a/components/tabs/Tabs.jsx b/components/tabs/Tabs.jsx index ad73e249..f0ae6872 100644 --- a/components/tabs/Tabs.jsx +++ b/components/tabs/Tabs.jsx @@ -21,13 +21,11 @@ class Tabs extends React.Component { }; componentDidMount () { - !this.props.disableAnimatedBottomBorder && - this.updatePointer(this.props.index); + !this.props.disableAnimatedBottomBorder && this.updatePointer(this.props.index); } componentWillReceiveProps (nextProps) { - !this.props.disableAnimatedBottomBorder && - this.updatePointer(nextProps.index); + !this.props.disableAnimatedBottomBorder && this.updatePointer(nextProps.index); } componentWillUnmount () { diff --git a/tools/generateMarkdown.js b/tools/generateMarkdown.js index 660c7aae..8fe93782 100644 --- a/tools/generateMarkdown.js +++ b/tools/generateMarkdown.js @@ -11,11 +11,11 @@ function generateDesciption (description) { function generatePropType (type) { let values; if (Array.isArray(type.value)) { - values = '(`' + - type.value.map(function (typeValue) { + values = '(`' + + type.value.map(function (typeValue) { return typeValue.name || typeValue.value; - }).join('`,`') + - '`)'; + }).join('`,`') + + '`)'; } else { values = type.value; } @@ -33,11 +33,11 @@ function generateProp (propName, prop) { } return ( - `| \`${propName}\` ${prop.required ? '(required)' : ''}` + - `| ${(prop.type ? generatePropType(prop.type) : '')} ` + - `| ${(prop.defaultValue ? `\`${prop.defaultValue}\`` : '')} ` + - `| ${(prop.description ? prop.description : '')} ` + - '|' + `| \`${propName}\` ${prop.required ? '(required)' : ''}` + + `| ${(prop.type ? generatePropType(prop.type) : '')} ` + + `| ${(prop.defaultValue ? `\`${prop.defaultValue}\`` : '')} ` + + `| ${(prop.description ? prop.description : '')} ` + + '|' ); } @@ -45,20 +45,19 @@ function generateProps (props) { const title = '### Properties'; return ( - `${title}\n` + - '| Name | Type | Default | Description |\n' + - '|:-----|:-----|:-----|:-----|\n' + - Object.keys(props).sort().map(propName => { + `${title}\n` + + '| Name | Type | Default | Description |\n' + + '|:-----|:-----|:-----|:-----|\n' + + Object.keys(props).sort().map(propName => { return generateProp(propName, props[propName]); }).join('\n') ); } function generateMarkdown (name, reactAPI) { - const markdownString = - generateTitle(name) + '\n' + - (reactAPI.description ? generateDesciption(reactAPI.description) + '\n' : '\n') + - generateProps(reactAPI.props); + const markdownString = generateTitle(name) + '\n' + + (reactAPI.description ? generateDesciption(reactAPI.description) + '\n' : '\n') + + generateProps(reactAPI.props); return markdownString; }