Skip to content

Commit 322b0ad

Browse files
committed
update: remove prettier
1 parent 2636940 commit 322b0ad

File tree

11 files changed

+65
-79
lines changed

11 files changed

+65
-79
lines changed

.prettierrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
"description": "COre DEfinitions in JS for Mat3ra.com (Exabyte.io)",
55
"scripts": {
66
"test": "nyc --reporter=text mocha --recursive --bail --require @babel/register/lib --require tests/setup.js tests",
7-
"lint": "eslint src tests && prettier --write src tests",
8-
"lint:fix": "eslint --fix --cache src tests && prettier --write src tests",
7+
"lint": "eslint src tests",
8+
"lint:fix": "eslint --fix --cache src tests",
99
"transpile": "babel --out-dir dist src",
1010
"postinstall": "npm run transpile",
11-
"prettier": "prettier --check src tests",
1211
"prepare": "husky install"
1312
},
1413
"repository": {
@@ -80,7 +79,6 @@
8079
"node": ">=12.0.0"
8180
},
8281
"lint-staged": {
83-
"*.js": "eslint --cache --fix",
84-
"*.{js,css}": "prettier --write"
82+
"*.js": "eslint --cache --fix"
8583
}
8684
}

src/context/provider.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ export class ContextProvider {
5050
config,
5151
data
5252
? {
53-
data,
54-
extraData,
55-
isEdited,
56-
}
53+
data,
54+
extraData,
55+
isEdited,
56+
}
5757
: {},
5858
);
5959
}

src/entity/mixins/hash.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ export const HashedInputArrayMixin = (superclass) => {
3030
* @summary expects an array with elements containing field [{content: "..."}]
3131
*/
3232
get hashFromArrayInputContent() {
33-
const objectForHashing = this.input.map((i) =>
34-
removeEmptyLinesFromString(removeCommentsFromSourceCode(i.content)),
35-
);
33+
const objectForHashing = this.input.map((i) => {
34+
return removeEmptyLinesFromString(removeCommentsFromSourceCode(i.content));
35+
});
3636
return calculateHashFromObject(objectForHashing);
3737
}
3838
};

src/entity/mixins/runtime_items.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ export const RuntimeItemsUILogicMixin = (superclass) => {
6363
}
6464

6565
setRuntimeItemsToDefaultValues() {
66-
["results", "monitors", "preProcessors", "postProcessors"].map((name) =>
67-
this.setProp(name, this[`default${s.capitalize(name)}`]),
68-
);
66+
["results", "monitors", "preProcessors", "postProcessors"].map((name) => this.setProp(name, this[`default${s.capitalize(name)}`]));
6967
}
7068

7169
/**

src/entity/set/factory.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import { InMemoryEntitySet } from "../set";
22
import { ENTITY_SET_TYPES } from "./enums";
33
import { OrderedInMemoryEntitySet } from "./ordered";
44

5-
export const constructEntitySetFactoryByConfig =
6-
({ entitySetCls = InMemoryEntitySet, orderedEntitySetCls = OrderedInMemoryEntitySet }) =>
7-
(config, entityCls) => {
8-
const Cls =
9-
config.entitySetType === ENTITY_SET_TYPES.ordered ? orderedEntitySetCls : entitySetCls;
10-
return new Cls({
11-
...config,
12-
entityCls,
13-
});
14-
};
5+
export const constructEntitySetFactoryByConfig = ({
6+
entitySetCls = InMemoryEntitySet,
7+
orderedEntitySetCls = OrderedInMemoryEntitySet,
8+
}) => (config, entityCls) => {
9+
const Cls = config.entitySetType === ENTITY_SET_TYPES.ordered
10+
? orderedEntitySetCls
11+
: entitySetCls;
12+
return new Cls({
13+
...config,
14+
entityCls,
15+
});
16+
};

src/entity/set/mixins.js

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
/* eslint-disable max-classes-per-file */
2-
export const InMemoryEntitySetMixin = (superclass) =>
3-
class extends superclass {
4-
containsEntity(entity) {
5-
return entity.inSet.some((ref) => ref._id === this.id);
6-
}
7-
};
2+
export const InMemoryEntitySetMixin = (superclass) => class extends superclass {
3+
containsEntity(entity) {
4+
return entity.inSet.some((ref) => ref._id === this.id);
5+
}
6+
};
87

9-
export const InMemoryEntityInSetMixin = (superclass) =>
10-
class extends superclass {
11-
get inSet() {
12-
return this.prop("inSet", []);
13-
}
8+
export const InMemoryEntityInSetMixin = (superclass) => class extends superclass {
9+
get inSet() {
10+
return this.prop("inSet", []);
11+
}
1412

15-
set inSet(inSet) {
16-
this.setProp("inSet", inSet);
17-
}
13+
set inSet(inSet) {
14+
this.setProp("inSet", inSet);
15+
}
1816

19-
getInSetFilteredByCls(cls) {
20-
return this.inSet.filter((ref) => ref.cls === cls);
21-
}
17+
getInSetFilteredByCls(cls) {
18+
return this.inSet.filter((ref) => ref.cls === cls);
19+
}
2220

23-
// finds a parent entity set of the same cls (hence `cls` field is absent)
24-
// NOTE: assumes that only one entry of this kind is present => gets the first one
25-
get parentEntitySetReference() {
26-
return this.inSet.find((item) => item._id && !item.cls);
27-
}
28-
};
21+
// finds a parent entity set of the same cls (hence `cls` field is absent)
22+
// NOTE: assumes that only one entry of this kind is present => gets the first one
23+
get parentEntitySetReference() {
24+
return this.inSet.find((item) => item._id && !item.cls);
25+
}
26+
};

src/entity/set/ordered/mixins.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@ import { ENTITY_SET_TYPES } from "../enums";
33

44
// NOTE: these mixins are meant to be used together with `InMemoryEntity{In}SetMixin`s only
55

6-
export const OrderedInMemoryEntitySetMixin = (superclass) =>
7-
class extends superclass {
8-
get isOrderedSet() {
9-
return this.entitySetType === ENTITY_SET_TYPES.ordered;
10-
}
11-
};
6+
export const OrderedInMemoryEntitySetMixin = (superclass) => class extends superclass {
7+
get isOrderedSet() {
8+
return this.entitySetType === ENTITY_SET_TYPES.ordered;
9+
}
10+
};
1211

13-
export const OrderedInMemoryEntityInSetMixin = (superclass) =>
14-
class extends superclass {
15-
getIndexByIdInOrderedSet(setId) {
16-
const setData = this.inSet.find((s) => s._id === setId);
17-
return setData ? setData.index : 0;
18-
}
19-
};
12+
export const OrderedInMemoryEntityInSetMixin = (superclass) => class extends superclass {
13+
getIndexByIdInOrderedSet(setId) {
14+
const setData = this.inSet.find((s) => s._id === setId);
15+
return setData ? setData.index : 0;
16+
}
17+
};

src/entity/set/ordered/utils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ export const compareEntitiesInOrderedSetForSorting = (a, b, setId, descending =
77
const aIndex = a
88
? a.getIndexByIdInOrderedSet(setId)
99
: descending
10-
? Number.POSITIVE_INFINITY
11-
: Number.NEGATIVE_INFINITY;
10+
? Number.POSITIVE_INFINITY
11+
: Number.NEGATIVE_INFINITY;
1212
// eslint-disable-next-line no-nested-ternary
1313
const bIndex = b
1414
? b.getIndexByIdInOrderedSet(setId)
1515
: descending
16-
? Number.POSITIVE_INFINITY
17-
: Number.NEGATIVE_INFINITY;
16+
? Number.POSITIVE_INFINITY
17+
: Number.NEGATIVE_INFINITY;
1818
return descending ? bIndex - aIndex : aIndex - bIndex;
1919
};

src/utils/class.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ export function extendClassStaticProps(childClass, parentClass, excludedProps =
4949
* See extendClass.
5050
*/
5151
export function extendThis(childClass, parentClass, config) {
52-
let props, protos;
52+
let props,
53+
protos;
5354
let obj = new parentClass.prototype.constructor(config);
5455
const exclude = ["constructor", ...Object.getOwnPropertyNames(childClass.prototype)];
5556
const seen = []; // remember most recent occurrence of prop name (like inheritance)

src/utils/object.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ export function safeMakeObject(name) {
1212
if (!name) return;
1313
let result = name;
1414
if (lodash.isString(name)) result = { name };
15-
if (!lodash.isObject(result) || lodash.isArray(result) || !result.name)
16-
throw new Error(`safeMakeObject: failed creating named object, found ${result}`);
15+
if (!lodash.isObject(result) || lodash.isArray(result) || !result.name) throw new Error(`safeMakeObject: failed creating named object, found ${result}`);
1716
return result;
1817
}
1918

@@ -67,10 +66,9 @@ export function renameKeysForObject(o, keysOriginal = [], keysRenamed = []) {
6766
// Get the destination key
6867
const idx = keysOriginal.indexOf(origKey);
6968
const destKey = idx === -1 ? origKey : keysRenamed[idx];
70-
const destValue =
71-
typeof origValue === "object"
72-
? renameKeysForObject(origValue, keysOriginal, keysRenamed)
73-
: origValue;
69+
const destValue = typeof origValue === "object"
70+
? renameKeysForObject(origValue, keysOriginal, keysRenamed)
71+
: origValue;
7472
result[destKey] = destValue;
7573
return null;
7674
});

0 commit comments

Comments
 (0)