Skip to content

Commit be3dcbf

Browse files
QingWei-LiLeopoldthecoder
authored andcommitted
chore: update ESLint (ElemeFE#9124)
* chore: update ESLint * chore: update eslint ignore
1 parent 5e06a1a commit be3dcbf

32 files changed

+605
-277
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ src/utils/date.js
44
node_modules
55
lib
66
coverage
7+
*.md

.eslintrc

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
"expect": true,
77
"sinon": true
88
},
9-
"plugins": ['vue','json'],
10-
"extends": 'elemefe',
9+
"plugins": ["html", "json"],
10+
"extends": "elemefe",
11+
"rules": {
12+
"no-restricted-globals": ["error", "event", "fdescribe"]
13+
},
1114
"parserOptions": {
1215
"ecmaFeatures": {
1316
"experimentalObjectRestSpread": true,

build/bin/new.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ fileSave(path.join(__dirname, '../../components.json'))
111111
// 创建 package
112112
Files.forEach(file => {
113113
fileSave(path.join(PackagePath, file.filename))
114-
.write(file.content, 'utf8')
115-
.end('\n');
114+
.write(file.content, 'utf8')
115+
.end('\n');
116116
});
117117

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

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"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",
2525
"dist:all": "node build/bin/build-all.js && npm run build:theme",
2626
"i18n": "node build/bin/i18n.js",
27-
"lint": "eslint src/**/* test/**/* packages/**/*.{js,vue} build/**/* --quiet",
27+
"lint": "eslint src/**/* test/**/* packages/**/* build/**/* --quiet",
2828
"pub": "npm run bootstrap && sh build/git-release.sh && sh build/release.sh && node build/bin/gen-indices.js && sh build/deploy-faas.sh",
2929
"pub:all": "npm run dist:all && lerna publish --skip-git && git commit -am 'publish independent packages' && git push eleme dev",
3030
"test": "npm run lint && npm run build:theme && cross-env CI_ENV=/dev/ karma start test/unit/karma.conf.js --single-run",
@@ -81,7 +81,9 @@
8181
"cross-env": "^3.1.3",
8282
"css-loader": "^0.28.7",
8383
"es6-promise": "^4.0.5",
84-
"eslint": "^3.10.2",
84+
"eslint": "4.14.0",
85+
"eslint-loader": "^1.9.0",
86+
"eslint-plugin-html": "^4.0.1",
8587
"eslint-plugin-json": "^1.2.0",
8688
"extract-text-webpack-plugin": "^3.0.1",
8789
"file-loader": "^1.1.5",

packages/breadcrumb/src/breadcrumb-item.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
link.addEventListener('click', _ => {
3434
let to = this.to;
3535
self.replace ? self.$router.replace(to)
36-
: self.$router.push(to);
36+
: self.$router.push(to);
3737
});
3838
}
3939
}

packages/cascader/src/menu.vue

+11-11
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,17 @@
314314
{items}
315315
{
316316
isHoveredMenu
317-
? (<svg
318-
ref="hoverZone"
319-
style={{
320-
position: 'absolute',
321-
top: 0,
322-
height: '100%',
323-
width: '100%',
324-
left: 0,
325-
pointerEvents: 'none'
326-
}}
327-
></svg>) : null
317+
? (<svg
318+
ref="hoverZone"
319+
style={{
320+
position: 'absolute',
321+
top: 0,
322+
height: '100%',
323+
width: '100%',
324+
left: 0,
325+
pointerEvents: 'none'
326+
}}
327+
></svg>) : null
328328
}
329329
</ul>
330330
);

packages/checkbox/src/checkbox-button.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
get() {
8080
return this._checkboxGroup
8181
? this.store : this.value !== undefined
82-
? this.value : this.selfModel;
82+
? this.value : this.selfModel;
8383
},
8484
8585
set(val) {

packages/checkbox/src/checkbox.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
get() {
8282
return this.isGroup
8383
? this.store : this.value !== undefined
84-
? this.value : this.selfModel;
84+
? this.value : this.selfModel;
8585
},
8686
8787
set(val) {

packages/col/src/col.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export default {
4242
if (this[prop] || this[prop] === 0) {
4343
classList.push(
4444
prop !== 'span'
45-
? `el-col-${prop}-${this[prop]}`
46-
: `el-col-${this[prop]}`
45+
? `el-col-${prop}-${this[prop]}`
46+
: `el-col-${this[prop]}`
4747
);
4848
}
4949
});
@@ -56,8 +56,8 @@ export default {
5656
Object.keys(props).forEach(prop => {
5757
classList.push(
5858
prop !== 'span'
59-
? `el-col-${size}-${prop}-${props[prop]}`
60-
: `el-col-${size}-${props[prop]}`
59+
? `el-col-${size}-${prop}-${props[prop]}`
60+
: `el-col-${size}-${props[prop]}`
6161
);
6262
});
6363
}

packages/collapse/src/collapse.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
this.setActiveNames(
5151
(this.activeNames[0] || this.activeNames[0] === 0) &&
5252
this.activeNames[0] === item.name
53-
? '' : item.name
53+
? '' : item.name
5454
);
5555
} else {
5656
let activeNames = this.activeNames.slice(0);

packages/date-picker/src/basic/time-spinner.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
109109
props: {
110110
date: {},
111-
defaultValue: {}, // reserved for future use
111+
defaultValue: {}, // reserved for future use
112112
showSeconds: {
113113
type: Boolean,
114114
default: true

packages/date-picker/src/panel/date-range.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -588,10 +588,10 @@
588588
value && value[0] && value[1] &&
589589
isDate(value[0]) && isDate(value[1]) &&
590590
value[0].getTime() <= value[1].getTime() && (
591-
typeof this.disabledDate === 'function'
591+
typeof this.disabledDate === 'function'
592592
? !this.disabledDate(value[0]) && !this.disabledDate(value[1])
593593
: true
594-
);
594+
);
595595
}
596596
},
597597

packages/date-picker/src/panel/date.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@
369369
event.stopPropagation();
370370
event.preventDefault();
371371
}
372-
if (keyCode === 13) { // Enter
372+
if (keyCode === 13) { // Enter
373373
this.$emit('pick', this.date, false);
374374
}
375375
}
@@ -431,8 +431,8 @@
431431
isValidValue(value) {
432432
return value && !isNaN(value) && (
433433
typeof this.disabledDate === 'function'
434-
? !this.disabledDate(value)
435-
: true
434+
? !this.disabledDate(value)
435+
: true
436436
);
437437
}
438438
},

packages/date-picker/src/panel/time-range.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
const keyCode = event.keyCode;
228228
const mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
229229
230-
// Left or Right
230+
// Left or Right
231231
if (keyCode === 37 || keyCode === 39) {
232232
const step = mapping[keyCode];
233233
this.changeSelectionRange(step);

packages/date-picker/src/picker.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ const TYPE_VALUE_RESOLVER_MAP = {
173173
let date = formatDate(trueDate, format);
174174
175175
date = /WW/.test(date)
176-
? date.replace(/WW/, week < 10 ? '0' + week : week)
177-
: date.replace(/W/, week);
176+
? date.replace(/WW/, week < 10 ? '0' + week : week)
177+
: date.replace(/W/, week);
178178
return date;
179179
},
180180
parser(text) {
@@ -349,7 +349,7 @@ export default {
349349
pickerVisible: false,
350350
showClose: false,
351351
userInput: null,
352-
valueOnOpen: null, // value when picker opens, used to determine whether to emit change
352+
valueOnOpen: null, // value when picker opens, used to determine whether to emit change
353353
unwatchPickerOptions: null
354354
};
355355
},

packages/dropdown/src/dropdown.vue

+7-7
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,13 @@
251251
let triggerElm = !splitButton
252252
? this.$slots.default
253253
: (<el-button-group>
254-
<el-button type={type} size={dropdownSize} nativeOn-click={handleMainButtonClick}>
255-
{this.$slots.default}
256-
</el-button>
257-
<el-button ref="trigger" type={type} size={dropdownSize} class="el-dropdown__caret-button">
258-
<i class="el-dropdown__icon el-icon-arrow-down"></i>
259-
</el-button>
260-
</el-button-group>);
254+
<el-button type={type} size={dropdownSize} nativeOn-click={handleMainButtonClick}>
255+
{this.$slots.default}
256+
</el-button>
257+
<el-button ref="trigger" type={type} size={dropdownSize} class="el-dropdown__caret-button">
258+
<i class="el-dropdown__icon el-icon-arrow-down"></i>
259+
</el-button>
260+
</el-button-group>);
261261
262262
return (
263263
<div class="el-dropdown" v-clickoutside={hide}>

packages/pagination/src/pagination.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ export default {
9797
render(h) {
9898
return (
9999
this.$parent.$slots.default
100-
? this.$parent.$slots.default[0]
101-
: ''
100+
? this.$parent.$slots.default[0]
101+
: ''
102102
);
103103
}
104104
},

packages/table/src/table-body.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ export default {
116116
!this.fixed && this.layout.scrollY && this.layout.gutterWidth ? <td class="gutter" /> : ''
117117
}
118118
</tr>,
119-
this.store.states.expandRows.indexOf(row) > -1
119+
this.store.states.expandRows.indexOf(row) > -1
120120
? (<tr>
121-
<td colspan={ this.columns.length } class="el-table__expanded-cell">
122-
{ this.table.renderExpanded ? this.table.renderExpanded(h, { row, $index, store: this.store }) : ''}
123-
</td>
124-
</tr>)
121+
<td colspan={ this.columns.length } class="el-table__expanded-cell">
122+
{ this.table.renderExpanded ? this.table.renderExpanded(h, { row, $index, store: this.store }) : ''}
123+
</td>
124+
</tr>)
125125
: ''
126126
]
127127
).concat(

packages/table/src/table-column.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const forced = {
7171
renderCell: function(h, { row, store }, proxy) {
7272
const expanded = store.states.expandRows.indexOf(row) > -1;
7373
return <div class={ 'el-table__expand-icon ' + (expanded ? 'el-table__expand-icon--expanded' : '') }
74-
on-click={ () => proxy.handleExpandClick(row) }>
74+
on-click={ () => proxy.handleExpandClick(row) }>
7575
<i class='el-icon el-icon-arrow-right'></i>
7676
</div>;
7777
},

packages/table/src/table-footer.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,25 @@ export default {
5555
</colgroup>
5656
<tbody class={ [{ 'has-gutter': this.hasGutter }] }>
5757
<tr>
58-
{
59-
this._l(this.columns, (column, cellIndex) =>
60-
<td
61-
colspan={ column.colSpan }
62-
rowspan={ column.rowSpan }
63-
class={ [column.id, column.headerAlign, column.className || '', this.isCellHidden(cellIndex, this.columns) ? 'is-hidden' : '', !column.children ? 'is-leaf' : '', column.labelClassName] }>
64-
<div class={ ['cell', column.labelClassName] }>
65-
{
66-
this.summaryMethod ? this.summaryMethod({ columns: this.columns, data: this.store.states.data })[cellIndex] : sums[cellIndex]
67-
}
68-
</div>
69-
</td>
70-
)
71-
}
72-
{
73-
this.hasGutter
74-
? <td class="gutter" style={{ width: this.layout.scrollY ? this.layout.gutterWidth + 'px' : '0' }}></td>
75-
: ''
76-
}
58+
{
59+
this._l(this.columns, (column, cellIndex) =>
60+
<td
61+
colspan={ column.colSpan }
62+
rowspan={ column.rowSpan }
63+
class={ [column.id, column.headerAlign, column.className || '', this.isCellHidden(cellIndex, this.columns) ? 'is-hidden' : '', !column.children ? 'is-leaf' : '', column.labelClassName] }>
64+
<div class={ ['cell', column.labelClassName] }>
65+
{
66+
this.summaryMethod ? this.summaryMethod({ columns: this.columns, data: this.store.states.data })[cellIndex] : sums[cellIndex]
67+
}
68+
</div>
69+
</td>
70+
)
71+
}
72+
{
73+
this.hasGutter
74+
? <td class="gutter" style={{ width: this.layout.scrollY ? this.layout.gutterWidth + 'px' : '0' }}></td>
75+
: ''
76+
}
7777
</tr>
7878
</tbody>
7979
</table>

0 commit comments

Comments
 (0)