Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd0e57f0

Browse files
authored
Merge pull request#1477 from alubbe/linter
Run linter with prettier 2
2 parents25a21f0 +25babc7 commitd0e57f0

File tree

103 files changed

+1074
-629
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1074
-629
lines changed

‎.eslintrc‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
"node": true
1414
},
1515
"rules": {
16+
"arrow-parens": ["error", "as-needed"],
1617
"class-methods-use-this": ["off"],
1718
"comma-dangle": ["error", {"arrays": "always-multiline", "objects": "always-multiline", "imports": "always-multiline", "exports": "always-multiline", "functions": "never"}],
1819
"default-case": ["off"],
1920
"func-names": ["off", "never"],
2021
"global-require": ["off"],
21-
"max-len": ["error", {"code":160, "ignoreComments": true, "ignoreStrings": true}],
22+
"max-len": ["error", {"code":100, "ignoreComments": true, "ignoreStrings": true}],
2223
"no-console": ["error", { "allow": ["warn"] }],
2324
"no-continue": ["off"],
2425
"no-mixed-operators": ["error", {"allowSamePrecedence": true}],

‎.prettier‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"bracketSpacing": false,
3-
"printWidth":160,
3+
"printWidth":100,
44
"trailingComma": "all",
5-
"bracketSpacing": false
5+
"bracketSpacing": false,
6+
"arrowParens": "avoid"
67
}

‎benchmark.js‎

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ const runs = 3;
88
awaitrunProfiling('huge xlsx file streams',()=>{
99
returnnewPromise((resolve,reject)=>{
1010
// Data taken from http://eforexcel.com/wp/downloads-18-sample-csv-files-data-sets-for-testing-sales/
11-
constworkbookReader=newExcelJS.stream.xlsx.WorkbookReader('./spec/integration/data/huge.xlsx');
11+
constworkbookReader=newExcelJS.stream.xlsx.WorkbookReader(
12+
'./spec/integration/data/huge.xlsx'
13+
);
1214
workbookReader.read();
1315

1416
letworksheetCount=0;
@@ -32,7 +34,9 @@ const runs = 3;
3234

3335
awaitrunProfiling('huge xlsx file async iteration',async()=>{
3436
// Data taken from http://eforexcel.com/wp/downloads-18-sample-csv-files-data-sets-for-testing-sales/
35-
constworkbookReader=newExcelJS.stream.xlsx.WorkbookReader('spec/integration/data/huge.xlsx');
37+
constworkbookReader=newExcelJS.stream.xlsx.WorkbookReader(
38+
'spec/integration/data/huge.xlsx'
39+
);
3640
letworksheetCount=0;
3741
letrowCount=0;
3842
forawait(constworksheetReaderofworkbookReader){
@@ -55,13 +59,21 @@ const runs = 3;
5559
asyncfunctionrunProfiling(name,run){
5660
console.log('');
5761
console.log('####################################################');
58-
console.log(`WARMUP: Current memory usage:${currentMemoryUsage({runGarbageCollector:true})} MB`);
62+
console.log(
63+
`WARMUP: Current memory usage:${currentMemoryUsage({runGarbageCollector:true})} MB`
64+
);
5965
console.log(`WARMUP:${name} profiling started`);
6066
constwarmupStartTime=Date.now();
6167
awaitrun();
6268
console.log(`WARMUP:${name} profiling finished in${Date.now()-warmupStartTime}ms`);
63-
console.log(`WARMUP: Current memory usage (before GC):${currentMemoryUsage({runGarbageCollector:false})} MB`);
64-
console.log(`WARMUP: Current memory usage (after GC):${currentMemoryUsage({runGarbageCollector:true})} MB`);
69+
console.log(
70+
`WARMUP: Current memory usage (before GC):${currentMemoryUsage({
71+
runGarbageCollector:false,
72+
})} MB`
73+
);
74+
console.log(
75+
`WARMUP: Current memory usage (after GC):${currentMemoryUsage({runGarbageCollector:true})} MB`
76+
);
6577

6678
for(leti=1;i<=runs;i+=1){
6779
console.log('');
@@ -70,8 +82,16 @@ async function runProfiling(name, run) {
7082
conststartTime=Date.now();
7183
awaitrun();// eslint-disable-line no-await-in-loop
7284
console.log(`RUN${i}:${name} profiling finished in${Date.now()-startTime}ms`);
73-
console.log(`RUN${i}: Current memory usage (before GC):${currentMemoryUsage({runGarbageCollector:false})} MB`);
74-
console.log(`RUN${i}: Current memory usage (after GC):${currentMemoryUsage({runGarbageCollector:true})} MB`);
85+
console.log(
86+
`RUN${i}: Current memory usage (before GC):${currentMemoryUsage({
87+
runGarbageCollector:false,
88+
})} MB`
89+
);
90+
console.log(
91+
`RUN${i}: Current memory usage (after GC):${currentMemoryUsage({
92+
runGarbageCollector:true,
93+
})} MB`
94+
);
7595
}
7696
}
7797

‎excel.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
*/
66

77
if(parseInt(process.versions.node.split('.')[0],10)<10){
8-
thrownewError('For node versions older than 10, please use the ES5 Import: https://github.com/exceljs/exceljs#es5-imports');
8+
thrownewError(
9+
'For node versions older than 10, please use the ES5 Import: https://github.com/exceljs/exceljs#es5-imports'
10+
);
911
}
1012

1113
module.exports=require('./lib/exceljs.nodejs.js');

‎lib/csv/csv.js‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ const fs = require('fs');
22
constfastCsv=require('fast-csv');
33
constcustomParseFormat=require('dayjs/plugin/customParseFormat');
44
constutc=require('dayjs/plugin/utc');
5-
constdayjs=require('dayjs')
6-
.extend(customParseFormat)
7-
.extend(utc);
5+
constdayjs=require('dayjs').extend(customParseFormat).extend(utc);
86
constStreamBuf=require('../utils/stream-buf');
97

108
const{
@@ -48,7 +46,12 @@ class CSV {
4846
returnnewPromise((resolve,reject)=>{
4947
constworksheet=this.workbook.addWorksheet(options.sheetName);
5048

51-
constdateFormats=options.dateFormats||['YYYY-MM-DD[T]HH:mm:ssZ','YYYY-MM-DD[T]HH:mm:ss','MM-DD-YYYY','YYYY-MM-DD'];
49+
constdateFormats=options.dateFormats||[
50+
'YYYY-MM-DD[T]HH:mm:ssZ',
51+
'YYYY-MM-DD[T]HH:mm:ss',
52+
'MM-DD-YYYY',
53+
'YYYY-MM-DD',
54+
];
5255
constmap=
5356
options.map||
5457
function(datum){
@@ -132,7 +135,9 @@ class CSV {
132135
}
133136
if(valueinstanceofDate){
134137
if(dateFormat){
135-
returndateUTC ?dayjs.utc(value).format(dateFormat) :dayjs(value).format(dateFormat);
138+
returndateUTC
139+
?dayjs.utc(value).format(dateFormat)
140+
:dayjs(value).format(dateFormat);
136141
}
137142
returndateUTC ?dayjs.utc(value).format() :dayjs(value).format();
138143
}

‎lib/csv/stream-converter.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ class StreamConverter {
8080
this.writeStarted=true;
8181
}
8282

83-
this.inner.write(this.convertInwards(data),encoding ?this.innerEncoding :undefined,callback);
83+
this.inner.write(
84+
this.convertInwards(data),
85+
encoding ?this.innerEncoding :undefined,
86+
callback
87+
);
8488
}
8589

8690
read(){

‎lib/doc/anchor.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,17 @@ class Anchor {
5656
}
5757

5858
getcolWidth(){
59-
returnthis.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth
59+
returnthis.worksheet&&
60+
this.worksheet.getColumn(this.nativeCol+1)&&
61+
this.worksheet.getColumn(this.nativeCol+1).isCustomWidth
6062
?Math.floor(this.worksheet.getColumn(this.nativeCol+1).width*10000)
6163
:640000;
6264
}
6365

6466
getrowHeight(){
65-
returnthis.worksheet&&this.worksheet.getRow(this.nativeRow+1)&&this.worksheet.getRow(this.nativeRow+1).height
67+
returnthis.worksheet&&
68+
this.worksheet.getRow(this.nativeRow+1)&&
69+
this.worksheet.getRow(this.nativeRow+1).height
6670
?Math.floor(this.worksheet.getRow(this.nativeRow+1).height*10000)
6771
:180000;
6872
}

‎lib/doc/cell.js‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,9 @@ class FormulaValue {
787787
getdependencies(){
788788
// find all the ranges and cells mentioned in the formula
789789
constranges=this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g);
790-
constcells=this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,'').match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g);
790+
constcells=this.formula
791+
.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,'')
792+
.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g);
791793
return{
792794
ranges,
793795
cells,
@@ -860,7 +862,8 @@ class FormulaValue {
860862
if(!this._translatedFormula&&this.model.sharedFormula){
861863
const{worksheet}=this.cell;
862864
constmaster=worksheet.findCell(this.model.sharedFormula);
863-
this._translatedFormula=master&&slideFormula(master.formula,master.address,this.model.address);
865+
this._translatedFormula=
866+
master&&slideFormula(master.formula,master.address,this.model.address);
864867
}
865868
returnthis._translatedFormula;
866869
}

‎lib/doc/column.js‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ class Column {
122122
}
123123

124124
getcollapsed(){
125-
return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol);
125+
return!!(
126+
this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol
127+
);
126128
}
127129

128130
toString(){
@@ -134,7 +136,12 @@ class Column {
134136
}
135137

136138
equivalentTo(other){
137-
returnthis.width===other.width&&this.hidden===other.hidden&&this.outlineLevel===other.outlineLevel&&_.isEqual(this.style,other.style);
139+
return(
140+
this.width===other.width&&
141+
this.hidden===other.hidden&&
142+
this.outlineLevel===other.outlineLevel&&
143+
_.isEqual(this.style,other.style)
144+
);
138145
}
139146

140147
getisDefault(){

‎lib/doc/defined-names.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ class DefinedNames {
7373
}
7474

7575
getNamesEx(address){
76-
return_.map(this.matrixMap,(matrix,name)=>matrix.findCellEx(address)&&name).filter(Boolean);
76+
return_.map(this.matrixMap,(matrix,name)=>matrix.findCellEx(address)&&name).filter(
77+
Boolean
78+
);
7779
}
7880

7981
_explore(matrix,cell){
@@ -172,7 +174,9 @@ class DefinedNames {
172174

173175
getmodel(){
174176
// To get names per cell - just iterate over all names finding cells if they exist
175-
return_.map(this.matrixMap,(matrix,name)=>this.getRanges(name,matrix)).filter(definedName=>definedName.ranges.length);
177+
return_.map(this.matrixMap,(matrix,name)=>this.getRanges(name,matrix)).filter(
178+
definedName=>definedName.ranges.length
179+
);
176180
}
177181

178182
setmodel(value){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp