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

Commit29f1826

Browse files
authored
Update linting, testing and building dependencies (#556)
* update linting and building dependencies* drop support for node 8
1 parent95e9255 commit29f1826

32 files changed

+3830
-3438
lines changed

‎.travis.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ language: node_js
33
node_js:
44
-"12"
55
-"10"
6-
-"8"
76

87
script:
98
-npm run lint

‎package-lock.json‎

Lines changed: 3614 additions & 3224 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,41 +57,41 @@
5757
"@babel/plugin-transform-runtime":"^7.11.0",
5858
"@babel/preset-env":"^7.11.0",
5959
"@babel/register":"^7.10.5",
60-
"@types/jsdoc-to-markdown":"^4.0.0",
60+
"@types/jsdoc-to-markdown":"^6.0.0",
6161
"babel-core":"^7.0.0-bridge.0",
6262
"babel-eslint":"^10.1.0",
63-
"babel-jest":"^24.9.0",
63+
"babel-jest":"^26.2.2",
6464
"babel-loader":"^8.1.0",
6565
"babel-plugin-lodash":"^3.3.4",
66-
"codecov":"^3.6.1",
67-
"cross-env":"^6.0.3",
66+
"codecov":"^3.7.2",
67+
"cross-env":"^7.0.2",
6868
"deep-freeze":"0.0.1",
69-
"eslint":"^6.8.0",
70-
"eslint-config-airbnb-base":"^14.0.0",
71-
"eslint-config-prettier":"^6.9.0",
72-
"eslint-plugin-import":"^2.20.0",
73-
"eslint-plugin-jest":"^23.6.0",
74-
"eslint-plugin-prettier":"^3.1.2",
69+
"eslint":"^7.6.0",
70+
"eslint-config-airbnb-base":"^14.2.0",
71+
"eslint-config-prettier":"^6.11.0",
72+
"eslint-plugin-import":"^2.22.0",
73+
"eslint-plugin-jest":"^23.20.0",
74+
"eslint-plugin-prettier":"^3.1.4",
7575
"gulp":"^4.0.2",
7676
"gulp-clean":"^0.4.0",
77-
"jest":"^24.9.0",
78-
"jest-cli":"^24.9.0",
79-
"jsdoc":"^3.6.3",
80-
"jsdoc-to-markdown":"^5.0.3",
77+
"jest":"^26.2.2",
78+
"jest-cli":"^26.2.2",
79+
"jsdoc":"^3.6.5",
80+
"jsdoc-to-markdown":"^6.0.1",
8181
"lodash-webpack-plugin":"^0.11.5",
82-
"prettier":"^1.19.1",
82+
"prettier":"^2.0.5",
8383
"redux":"^4.0.5",
8484
"redux-persist":"^6.0.0",
85-
"rimraf":"^3.0.0",
86-
"webpack":"^4.41.5",
87-
"webpack-cli":"^3.3.10",
88-
"webpack-merge":"^4.2.2"
85+
"rimraf":"^3.0.2",
86+
"webpack":"^4.44.1",
87+
"webpack-cli":"^3.3.12",
88+
"webpack-merge":"^5.1.1"
8989
},
9090
"dependencies": {
9191
"@babel/runtime":"^7.11.2",
9292
"immutable-ops":"^0.7.0",
93-
"lodash":"^4.17.15",
94-
"re-reselect":"^3.4.0",
93+
"lodash":"^4.17.19",
94+
"re-reselect":"^4.0.0",
9595
"reselect":"^3.0.1"
9696
}
9797
}

‎src/Model.js‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const Model = class Model {
7171
constpropsObj=Object(props);
7272
this._fields={ ...propsObj};
7373

74-
Object.keys(propsObj).forEach(fieldName=>{
74+
Object.keys(propsObj).forEach((fieldName)=>{
7575
// In this case, we got a prop that wasn't defined as a field.
7676
// Assuming it's an arbitrary data field, making an instance-specific
7777
// descriptor for it.
@@ -80,7 +80,7 @@ const Model = class Model {
8080
if(!(fieldNameinthis)){
8181
Object.defineProperty(this,fieldName,{
8282
get:()=>this._fields[fieldName],
83-
set:value=>this.set(fieldName,value),
83+
set:(value)=>this.set(fieldName,value),
8484
configurable:true,
8585
enumerable:true,
8686
});
@@ -292,7 +292,7 @@ const Model = class Model {
292292
constdeclaredFieldNames=Object.keys(this.fields);
293293
constdeclaredVirtualFieldNames=Object.keys(this.virtualFields);
294294

295-
declaredFieldNames.forEach(key=>{
295+
declaredFieldNames.forEach((key)=>{
296296
constfield=this.fields[key];
297297
constvaluePassed=userProps.hasOwnProperty(key);
298298
if(!(fieldinstanceofManyToMany)){
@@ -320,7 +320,7 @@ const Model = class Model {
320320
});
321321

322322
// add backward many-many if required
323-
declaredVirtualFieldNames.forEach(key=>{
323+
declaredVirtualFieldNames.forEach((key)=>{
324324
if(!m2mRelations.hasOwnProperty(key)){
325325
constfield=this.virtualFields[key];
326326
if(
@@ -527,12 +527,12 @@ const Model = class Model {
527527
constclassName=ThisModel.modelName;
528528
constfieldNames=Object.keys(ThisModel.fields);
529529
constfields=fieldNames
530-
.map(fieldName=>{
530+
.map((fieldName)=>{
531531
constfield=ThisModel.fields[fieldName];
532532
if(fieldinstanceofManyToMany){
533533
constids=this[fieldName]
534534
.toModelArray()
535-
.map(model=>model.getId());
535+
.map((model)=>model.getId());
536536
return`${fieldName}: [${ids.join(", ")}]`;
537537
}
538538
constval=this._fields[fieldName];
@@ -697,7 +697,7 @@ const Model = class Model {
697697
constThisModel=this.getClass();
698698
const{ fields, virtualFields, modelName}=ThisModel;
699699

700-
Object.keys(relations).forEach(name=>{
700+
Object.keys(relations).forEach((name)=>{
701701
constreverse=!fields.hasOwnProperty(name);
702702
constfield=virtualFields[name];
703703
constvalues=relations[name];
@@ -731,10 +731,10 @@ const Model = class Model {
731731
}
732732

733733
constcurrentIds=ThroughModel.filter(
734-
through=>through[fromField]===this[ThisModel.idAttribute]
734+
(through)=>through[fromField]===this[ThisModel.idAttribute]
735735
)
736736
.toRefArray()
737-
.map(ref=>ref[toField]);
737+
.map((ref)=>ref[toField]);
738738

739739
constdiffActions=arrayDiffActions(currentIds,normalizedNewIds);
740740

‎src/ORM.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const ORM_DEFAULTS = {
2222
};
2323

2424
constRESERVED_TABLE_OPTIONS=["indexes","meta"];
25-
constisReservedTableOption=word=>RESERVED_TABLE_OPTIONS.includes(word);
25+
constisReservedTableOption=(word)=>RESERVED_TABLE_OPTIONS.includes(word);
2626

2727
/**
2828
* ORM - the Object Relational Mapper.
@@ -68,7 +68,7 @@ class ORM {
6868
*@return {undefined}
6969
*/
7070
register(...models){
71-
models.forEach(model=>{
71+
models.forEach((model)=>{
7272
if(model.modelName===undefined){
7373
thrownewError(
7474
"A model was passed that doesn't have a modelName set"
@@ -163,7 +163,7 @@ class ORM {
163163
get(modelName){
164164
constallModels=this.registry.concat(this.implicitThroughModels);
165165
constfound=Object.values(allModels).find(
166-
model=>model.modelName===modelName
166+
(model)=>model.modelName===modelName
167167
);
168168

169169
if(typeoffound==="undefined"){
@@ -185,7 +185,7 @@ class ORM {
185185
consttableSpec=modelClass.tableOptions();
186186
Object.keys(tableSpec)
187187
.filter(isReservedTableOption)
188-
.forEach(key=>{
188+
.forEach((key)=>{
189189
thrownewError(
190190
`Reserved keyword \`${key}\` used in${tableName}.options.`
191191
);
@@ -239,8 +239,8 @@ class ORM {
239239
*/
240240
_setupModelPrototypes(models){
241241
models
242-
.filter(model=>!model.isSetUp)
243-
.forEach(model=>{
242+
.filter((model)=>!model.isSetUp)
243+
.forEach((model)=>{
244244
const{ fields, modelName, querySetClass}=model;
245245
Object.entries(fields).forEach(([fieldName,field])=>{
246246
if(!(fieldinstanceofField)){

‎src/QuerySet.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const QuerySet = class QuerySet {
7575
*/
7676
toModelArray(){
7777
const{modelClass:ModelClass}=this;
78-
returnthis._evaluate().map(props=>newModelClass(props));
78+
returnthis._evaluate().map((props)=>newModelClass(props));
7979
}
8080

8181
/**
@@ -287,7 +287,7 @@ const QuerySet = class QuerySet {
287287
const{ session,modelName:table}=this.modelClass;
288288

289289
this.toModelArray().forEach(
290-
model=>model._onDelete()// eslint-disable-line no-underscore-dangle
290+
(model)=>model._onDelete()// eslint-disable-line no-underscore-dangle
291291
);
292292

293293
session.applyUpdate({

‎src/Session.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const Session = class Session {
2626

2727
this.models=schema.getModelClasses();
2828

29-
this.sessionBoundModels=this.models.map(modelClass=>{
29+
this.sessionBoundModels=this.models.map((modelClass)=>{
3030
functionSessionBoundModel(){
3131
returnReflect.construct(
3232
modelClass,
@@ -65,7 +65,7 @@ const Session = class Session {
6565
if(!data.accessedInstances){
6666
data.accessedInstances={};
6767
}
68-
modelIds.forEach(id=>{
68+
modelIds.forEach((id)=>{
6969
data.accessedInstances[id]=true;
7070
});
7171
}
@@ -170,9 +170,9 @@ const Session = class Session {
170170
const{ rows}=result;
171171

172172
const{ idAttribute}=this[table];
173-
constaccessedIds=newSet(rows.map(row=>row[idAttribute]));
173+
constaccessedIds=newSet(rows.map((row)=>row[idAttribute]));
174174

175-
constanyClauseFilteredByPk=clauses.some(clause=>{
175+
constanyClauseFilteredByPk=clauses.some((clause)=>{
176176
if(!clauseFiltersByAttribute(clause,idAttribute)){
177177
returnfalse;
178178
}
@@ -186,8 +186,8 @@ const Session = class Session {
186186

187187
constaccessedIndexes=[];
188188
const{ indexes}=this.state[table];
189-
clauses.forEach(clause=>{
190-
Object.keys(indexes).forEach(attr=>{
189+
clauses.forEach((clause)=>{
190+
Object.keys(indexes).forEach((attr)=>{
191191
if(!clauseFiltersByAttribute(clause,attr)){
192192
return;
193193
}

‎src/db/Database.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export function createDatabase(schemaSpec) {
105105
query:query.bind(null,tables),
106106
update:update.bind(null,tables),
107107
// Used to inspect the schema.
108-
describe:tableName=>tables[tableName],
108+
describe:(tableName)=>tables[tableName],
109109
};
110110
}
111111

‎src/db/Table.js‎

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function normalizeOrders(orders) {
6363
if(orders===undefined){
6464
returnundefined;
6565
}
66-
constconvert=order=>{
66+
constconvert=(order)=>{
6767
if(["desc",false].includes(order)){
6868
return"desc";
6969
}
@@ -107,7 +107,7 @@ export class Table {
107107

108108
accessIds(branch,ids){
109109
constmap=branch[this.mapName];
110-
returnids.map(id=>map[id]);
110+
returnids.map((id)=>map[id]);
111111
}
112112

113113
idExists(branch,id){
@@ -144,8 +144,8 @@ export class Table {
144144
[this.mapName]:{},
145145
};
146146
constattrIndexes=Object.keys(this.fields)
147-
.filter(attr=>attr!==this.idAttribute)
148-
.filter(attr=>this.fields[attr].index)
147+
.filter((attr)=>attr!==this.idAttribute)
148+
.filter((attr)=>this.fields[attr].index)
149149
.reduce(
150150
(indexes,attr)=>({
151151
...indexes,
@@ -181,7 +181,7 @@ export class Table {
181181

182182
const{ idAttribute}=this;
183183

184-
constoptimallyOrderedClauses=sortBy(clauses,clause=>{
184+
constoptimallyOrderedClauses=sortBy(clauses,(clause)=>{
185185
if(clauseFiltersByAttribute(clause,idAttribute)){
186186
return1;
187187
}
@@ -344,9 +344,10 @@ export class Table {
344344

345345
constindexesToAppendTo=Object.keys(workingState.indexes)
346346
.filter(
347-
fkAttr=>entry.hasOwnProperty(fkAttr)&&entry[fkAttr]!==null
347+
(fkAttr)=>
348+
entry.hasOwnProperty(fkAttr)&&entry[fkAttr]!==null
348349
)
349-
.map(fkAttr=>[fkAttr,entry[fkAttr]]);
350+
.map((fkAttr)=>[fkAttr,entry[fkAttr]]);
350351

351352
if(withMutations){
352353
ops.mutable.push(id,workingState[this.arrName]);
@@ -427,7 +428,7 @@ export class Table {
427428
update(tx,branch,rows,mergeObj){
428429
const{ batchToken, withMutations}=tx;
429430

430-
constmergeObjInto=row=>{
431+
constmergeObjInto=(row)=>{
431432
constmerge=withMutations
432433
?ops.mutable.merge
433434
:ops.batch.merge(batchToken);
@@ -436,7 +437,7 @@ export class Table {
436437

437438
constset=withMutations ?ops.mutable.set :ops.batch.set(batchToken);
438439

439-
constindexedAttrs=Object.keys(branch.indexes).filter(attr=>
440+
constindexedAttrs=Object.keys(branch.indexes).filter((attr)=>
440441
mergeObj.hasOwnProperty(attr)
441442
);
442443
constindexIdsToAdd=[];
@@ -460,7 +461,7 @@ export class Table {
460461
);
461462
constid=result[this.idAttribute];
462463
constnextRow=set(id,result,map);
463-
indexedAttrs.forEach(attr=>{
464+
indexedAttrs.forEach((attr)=>{
464465
const{[attr]:prevValue}=prevAttrValues;
465466
const{[attr]:nextValue}=nextAttrValues;
466467
if(prevValue===nextValue){
@@ -523,7 +524,7 @@ export class Table {
523524
{
524525
[value]:ops.batch.filter(
525526
batchToken,
526-
rowId=>rowId!==id,
527+
(rowId)=>rowId!==id,
527528
indexMap[attr][value]
528529
),
529530
},
@@ -561,17 +562,17 @@ export class Table {
561562
const{ arrName, mapName}=this;
562563
constarr=branch[arrName];
563564

564-
constidsToDelete=rows.map(row=>row[this.idAttribute]);
565+
constidsToDelete=rows.map((row)=>row[this.idAttribute]);
565566
if(withMutations){
566-
idsToDelete.forEach(id=>{
567+
idsToDelete.forEach((id)=>{
567568
constidx=arr.indexOf(id);
568569
ops.mutable.splice(idx,1,[],arr);
569570
ops.mutable.omit(id,branch[mapName]);
570571
});
571572
// delete ids from all indexes
572-
Object.values(branch.indexes).forEach(attrIndex=>
573-
Object.values(attrIndex).forEach(valueIndex=>
574-
idsToDelete.forEach(id=>{
573+
Object.values(branch.indexes).forEach((attrIndex)=>
574+
Object.values(attrIndex).forEach((valueIndex)=>
575+
idsToDelete.forEach((id)=>{
575576
constidx=valueIndex.indexOf(id);
576577
if(idx!==-1){
577578
ops.mutable.splice(idx,1,[],valueIndex);
@@ -592,7 +593,7 @@ export class Table {
592593
(attrIndexMap,[value,valueIndex])=>{
593594
attrIndexMap[value]=ops.batch.filter(
594595
batchToken,
595-
id=>!idsToDelete.includes(id),
596+
(id)=>!idsToDelete.includes(id),
596597
valueIndex
597598
);
598599
returnattrIndexMap;
@@ -613,7 +614,7 @@ export class Table {
613614
{
614615
[arrName]:ops.batch.filter(
615616
batchToken,
616-
id=>!idsToDelete.includes(id),
617+
(id)=>!idsToDelete.includes(id),
617618
branch[arrName]
618619
),
619620
[mapName]:ops.batch.omit(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp