Skip to content

Commit

Permalink
chore: update ESLint (ElemeFE#9124)
Browse files Browse the repository at this point in the history
* chore: update ESLint

* chore: update eslint ignore
  • Loading branch information
QingWei-Li authored and Leopoldthecoder committed Jan 5, 2018
1 parent 5e06a1a commit be3dcbf
Show file tree
Hide file tree
Showing 32 changed files with 605 additions and 277 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ src/utils/date.js
node_modules
lib
coverage
*.md
7 changes: 5 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
"expect": true,
"sinon": true
},
"plugins": ['vue','json'],
"extends": 'elemefe',
"plugins": ["html", "json"],
"extends": "elemefe",
"rules": {
"no-restricted-globals": ["error", "event", "fdescribe"]
},
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
Expand Down
8 changes: 4 additions & 4 deletions build/bin/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ fileSave(path.join(__dirname, '../../components.json'))
// 创建 package
Files.forEach(file => {
fileSave(path.join(PackagePath, file.filename))
.write(file.content, 'utf8')
.end('\n');
.write(file.content, 'utf8')
.end('\n');
});

// 添加到 nav.config.json
Expand All @@ -123,8 +123,8 @@ Object.keys(navConfigFile).forEach(lang => {
groups[groups.length - 1].list.push({
path: `/${componentname}`,
title: lang === 'zh-CN' && componentname !== chineseName
? `${ComponentName} ${chineseName}`
: ComponentName
? `${ComponentName} ${chineseName}`
: ComponentName
});
});

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dist": "npm run clean && npm run build:file && npm run lint && cooking build -c build/cooking.conf.js,build/cooking.common.js,build/cooking.component.js -p && npm run build:utils && npm run build:umd && npm run build:theme",
"dist:all": "node build/bin/build-all.js && npm run build:theme",
"i18n": "node build/bin/i18n.js",
"lint": "eslint src/**/* test/**/* packages/**/*.{js,vue} build/**/* --quiet",
"lint": "eslint src/**/* test/**/* packages/**/* build/**/* --quiet",
"pub": "npm run bootstrap && sh build/git-release.sh && sh build/release.sh && node build/bin/gen-indices.js && sh build/deploy-faas.sh",
"pub:all": "npm run dist:all && lerna publish --skip-git && git commit -am 'publish independent packages' && git push eleme dev",
"test": "npm run lint && npm run build:theme && cross-env CI_ENV=/dev/ karma start test/unit/karma.conf.js --single-run",
Expand Down Expand Up @@ -81,7 +81,9 @@
"cross-env": "^3.1.3",
"css-loader": "^0.28.7",
"es6-promise": "^4.0.5",
"eslint": "^3.10.2",
"eslint": "4.14.0",
"eslint-loader": "^1.9.0",
"eslint-plugin-html": "^4.0.1",
"eslint-plugin-json": "^1.2.0",
"extract-text-webpack-plugin": "^3.0.1",
"file-loader": "^1.1.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/breadcrumb/src/breadcrumb-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
link.addEventListener('click', _ => {
let to = this.to;
self.replace ? self.$router.replace(to)
: self.$router.push(to);
: self.$router.push(to);
});
}
}
Expand Down
22 changes: 11 additions & 11 deletions packages/cascader/src/menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -314,17 +314,17 @@
{items}
{
isHoveredMenu
? (<svg
ref="hoverZone"
style={{
position: 'absolute',
top: 0,
height: '100%',
width: '100%',
left: 0,
pointerEvents: 'none'
}}
></svg>) : null
? (<svg
ref="hoverZone"
style={{
position: 'absolute',
top: 0,
height: '100%',
width: '100%',
left: 0,
pointerEvents: 'none'
}}
></svg>) : null
}
</ul>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/checkbox/src/checkbox-button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
get() {
return this._checkboxGroup
? this.store : this.value !== undefined
? this.value : this.selfModel;
? this.value : this.selfModel;
},
set(val) {
Expand Down
2 changes: 1 addition & 1 deletion packages/checkbox/src/checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
get() {
return this.isGroup
? this.store : this.value !== undefined
? this.value : this.selfModel;
? this.value : this.selfModel;
},
set(val) {
Expand Down
8 changes: 4 additions & 4 deletions packages/col/src/col.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export default {
if (this[prop] || this[prop] === 0) {
classList.push(
prop !== 'span'
? `el-col-${prop}-${this[prop]}`
: `el-col-${this[prop]}`
? `el-col-${prop}-${this[prop]}`
: `el-col-${this[prop]}`
);
}
});
Expand All @@ -56,8 +56,8 @@ export default {
Object.keys(props).forEach(prop => {
classList.push(
prop !== 'span'
? `el-col-${size}-${prop}-${props[prop]}`
: `el-col-${size}-${props[prop]}`
? `el-col-${size}-${prop}-${props[prop]}`
: `el-col-${size}-${props[prop]}`
);
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/collapse/src/collapse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
this.setActiveNames(
(this.activeNames[0] || this.activeNames[0] === 0) &&
this.activeNames[0] === item.name
? '' : item.name
? '' : item.name
);
} else {
let activeNames = this.activeNames.slice(0);
Expand Down
2 changes: 1 addition & 1 deletion packages/date-picker/src/basic/time-spinner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
props: {
date: {},
defaultValue: {}, // reserved for future use
defaultValue: {}, // reserved for future use
showSeconds: {
type: Boolean,
default: true
Expand Down
4 changes: 2 additions & 2 deletions packages/date-picker/src/panel/date-range.vue
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,10 @@
value && value[0] && value[1] &&
isDate(value[0]) && isDate(value[1]) &&
value[0].getTime() <= value[1].getTime() && (
typeof this.disabledDate === 'function'
typeof this.disabledDate === 'function'
? !this.disabledDate(value[0]) && !this.disabledDate(value[1])
: true
);
);
}
},
Expand Down
6 changes: 3 additions & 3 deletions packages/date-picker/src/panel/date.vue
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
event.stopPropagation();
event.preventDefault();
}
if (keyCode === 13) { // Enter
if (keyCode === 13) { // Enter
this.$emit('pick', this.date, false);
}
}
Expand Down Expand Up @@ -431,8 +431,8 @@
isValidValue(value) {
return value && !isNaN(value) && (
typeof this.disabledDate === 'function'
? !this.disabledDate(value)
: true
? !this.disabledDate(value)
: true
);
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/date-picker/src/panel/time-range.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
const keyCode = event.keyCode;
const mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
// Left or Right
// Left or Right
if (keyCode === 37 || keyCode === 39) {
const step = mapping[keyCode];
this.changeSelectionRange(step);
Expand Down
6 changes: 3 additions & 3 deletions packages/date-picker/src/picker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ const TYPE_VALUE_RESOLVER_MAP = {
let date = formatDate(trueDate, format);
date = /WW/.test(date)
? date.replace(/WW/, week < 10 ? '0' + week : week)
: date.replace(/W/, week);
? date.replace(/WW/, week < 10 ? '0' + week : week)
: date.replace(/W/, week);
return date;
},
parser(text) {
Expand Down Expand Up @@ -349,7 +349,7 @@ export default {
pickerVisible: false,
showClose: false,
userInput: null,
valueOnOpen: null, // value when picker opens, used to determine whether to emit change
valueOnOpen: null, // value when picker opens, used to determine whether to emit change
unwatchPickerOptions: null
};
},
Expand Down
14 changes: 7 additions & 7 deletions packages/dropdown/src/dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,13 @@
let triggerElm = !splitButton
? this.$slots.default
: (<el-button-group>
<el-button type={type} size={dropdownSize} nativeOn-click={handleMainButtonClick}>
{this.$slots.default}
</el-button>
<el-button ref="trigger" type={type} size={dropdownSize} class="el-dropdown__caret-button">
<i class="el-dropdown__icon el-icon-arrow-down"></i>
</el-button>
</el-button-group>);
<el-button type={type} size={dropdownSize} nativeOn-click={handleMainButtonClick}>
{this.$slots.default}
</el-button>
<el-button ref="trigger" type={type} size={dropdownSize} class="el-dropdown__caret-button">
<i class="el-dropdown__icon el-icon-arrow-down"></i>
</el-button>
</el-button-group>);
return (
<div class="el-dropdown" v-clickoutside={hide}>
Expand Down
4 changes: 2 additions & 2 deletions packages/pagination/src/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ export default {
render(h) {
return (
this.$parent.$slots.default
? this.$parent.$slots.default[0]
: ''
? this.$parent.$slots.default[0]
: ''
);
}
},
Expand Down
10 changes: 5 additions & 5 deletions packages/table/src/table-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ export default {
!this.fixed && this.layout.scrollY && this.layout.gutterWidth ? <td class="gutter" /> : ''
}
</tr>,
this.store.states.expandRows.indexOf(row) > -1
this.store.states.expandRows.indexOf(row) > -1
? (<tr>
<td colspan={ this.columns.length } class="el-table__expanded-cell">
{ this.table.renderExpanded ? this.table.renderExpanded(h, { row, $index, store: this.store }) : ''}
</td>
</tr>)
<td colspan={ this.columns.length } class="el-table__expanded-cell">
{ this.table.renderExpanded ? this.table.renderExpanded(h, { row, $index, store: this.store }) : ''}
</td>
</tr>)
: ''
]
).concat(
Expand Down
2 changes: 1 addition & 1 deletion packages/table/src/table-column.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const forced = {
renderCell: function(h, { row, store }, proxy) {
const expanded = store.states.expandRows.indexOf(row) > -1;
return <div class={ 'el-table__expand-icon ' + (expanded ? 'el-table__expand-icon--expanded' : '') }
on-click={ () => proxy.handleExpandClick(row) }>
on-click={ () => proxy.handleExpandClick(row) }>
<i class='el-icon el-icon-arrow-right'></i>
</div>;
},
Expand Down
38 changes: 19 additions & 19 deletions packages/table/src/table-footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,25 @@ export default {
</colgroup>
<tbody class={ [{ 'has-gutter': this.hasGutter }] }>
<tr>
{
this._l(this.columns, (column, cellIndex) =>
<td
colspan={ column.colSpan }
rowspan={ column.rowSpan }
class={ [column.id, column.headerAlign, column.className || '', this.isCellHidden(cellIndex, this.columns) ? 'is-hidden' : '', !column.children ? 'is-leaf' : '', column.labelClassName] }>
<div class={ ['cell', column.labelClassName] }>
{
this.summaryMethod ? this.summaryMethod({ columns: this.columns, data: this.store.states.data })[cellIndex] : sums[cellIndex]
}
</div>
</td>
)
}
{
this.hasGutter
? <td class="gutter" style={{ width: this.layout.scrollY ? this.layout.gutterWidth + 'px' : '0' }}></td>
: ''
}
{
this._l(this.columns, (column, cellIndex) =>
<td
colspan={ column.colSpan }
rowspan={ column.rowSpan }
class={ [column.id, column.headerAlign, column.className || '', this.isCellHidden(cellIndex, this.columns) ? 'is-hidden' : '', !column.children ? 'is-leaf' : '', column.labelClassName] }>
<div class={ ['cell', column.labelClassName] }>
{
this.summaryMethod ? this.summaryMethod({ columns: this.columns, data: this.store.states.data })[cellIndex] : sums[cellIndex]
}
</div>
</td>
)
}
{
this.hasGutter
? <td class="gutter" style={{ width: this.layout.scrollY ? this.layout.gutterWidth + 'px' : '0' }}></td>
: ''
}
</tr>
</tbody>
</table>
Expand Down
Loading

0 comments on commit be3dcbf

Please sign in to comment.