Skip to content

Commit 9065b2f

Browse files
authored
Merge pull request #37 from Exabyte-io/feat/SOF-6398-1
SOF-6398-1: prettier reformat
2 parents 8bcac68 + 7ff392e commit 9065b2f

File tree

10 files changed

+69
-113
lines changed

10 files changed

+69
-113
lines changed

.eslintrc.json

+1-56
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,4 @@
11
{
2-
"extends": ["airbnb", "prettier", "eslint:recommended"],
3-
"settings": {
4-
"import/resolver": {
5-
"node": {
6-
"paths": ["src"]
7-
}
8-
}
9-
},
10-
"parser": "@babel/eslint-parser",
11-
"env": {
12-
"browser": true,
13-
"node": true,
14-
"mocha": true
15-
},
16-
"plugins": ["prettier", "simple-import-sort", "jsdoc"],
17-
"rules": {
18-
"prettier/prettier": "error",
19-
"comma-dangle": ["error", "always-multiline"],
20-
"array-element-newline": ["error", "consistent"],
21-
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
22-
"one-var": ["error", { "uninitialized": "always", "initialized": "never" }],
23-
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
24-
"prefer-template": "off",
25-
"camelcase": "off",
26-
"max-len": "off",
27-
"no-console": "off",
28-
"no-unused-expressions": "warn",
29-
"no-confusing-arrow": "off",
30-
"no-underscore-dangle": "off",
31-
"no-return-assign": "off",
32-
"consistent-return": "off",
33-
"arrow-body-style": "off",
34-
"import/prefer-default-export": "off",
35-
"import/no-named-as-default-member": "warn",
36-
"no-param-reassign": ["warn", { "props": false }],
37-
"max-classes-per-file": "warn",
38-
"simple-import-sort/imports": [
39-
"warn",
40-
{
41-
"groups": [
42-
// Side effect imports.
43-
["^\\u0000"],
44-
// Packages.
45-
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
46-
["^@?\\w"],
47-
// Absolute imports
48-
[
49-
"^(components|configs|constants|containers|domain|enhancers|hocs|libs|pages|reducers|services|store|modules|dictionaries)(/.*|$)"
50-
],
51-
// Relative imports.
52-
// Anything that starts with a dot.
53-
["^\\."]
54-
]
55-
}
56-
]
57-
}
2+
"extends": ["@exabyte-io/eslint-config"]
583
}
594

package-lock.json

+22-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@
5959
"uuid": "8.3.2"
6060
},
6161
"devDependencies": {
62+
"@exabyte-io/eslint-config": "^2022.11.17-0",
6263
"chai": "^4.3.4",
6364
"eslint": "7.32.0",
6465
"eslint-config-airbnb": "19.0.2",
65-
"eslint-config-prettier": "8.3.0",
66+
"eslint-config-prettier": "^8.3.0",
6667
"eslint-plugin-import": "2.25.3",
6768
"eslint-plugin-jsdoc": "37.1.0",
6869
"eslint-plugin-jsx-a11y": "6.5.1",
69-
"eslint-plugin-prettier": "4.2.1",
70+
"eslint-plugin-prettier": "^4.2.1",
7071
"eslint-plugin-react": "7.30.0",
7172
"eslint-plugin-simple-import-sort": "7.0.0",
7273
"husky": "^7.0.4",

src/context/mixins.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ export const ApplicationContextMixin = (superclass) =>
77
class extends superclass {
88
constructor(config) {
99
super(config);
10-
if (!this.constructor.Application)
10+
if (!this.constructor.Application) {
1111
throw Error("ApplicationContextMixin: Application is undefined");
12+
}
1213
this._application =
1314
(config.context && config.context.application) ||
1415
this.constructor.Application.createDefault();
@@ -69,11 +70,9 @@ export const MaterialsSetContextMixin = (superclass) =>
6970

7071
sortMaterialsByIndexInSet(materials = []) {
7172
// DO NOT SORT IN PLACE AS IT CHANGES THE ORDER IN `this.materials` AND HAS SIDE EFFECTS (MaterialViewer).
72-
return materials
73-
.concat()
74-
.sort((a, b) =>
75-
compareEntitiesInOrderedSetForSorting(a, b, this.materialsSet?._id, false),
76-
);
73+
return materials.concat().sort((a, b) => {
74+
return compareEntitiesInOrderedSetForSorting(a, b, this.materialsSet._id, false);
75+
});
7776
}
7877
};
7978

src/entity/mixins/hash.js

+3-3
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/other.js

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export class NamedDefaultableRepetitionContextAndRenderInMemoryEntity extends mi
3131
InMemoryEntity,
3232
).with(DefaultableMixin, NamedEntityMixin, HasRepetitionMixin, ContextAndRenderFieldsMixin) {}
3333

34+
// eslint-disable-next-line max-len
3435
export class NamedDefaultableRepetitionRuntimeItemsImportantSettingsContextAndRenderHashedInMemoryEntity extends mix(
3536
InMemoryEntity,
3637
).with(

src/utils/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ import {
2020
} from "./object";
2121
import { getSearchQuerySelector } from "./selector";
2222
import {
23+
convertArabicToRoman,
2324
randomAlphanumeric,
2425
removeCommentsFromSourceCode,
2526
removeEmptyLinesFromString,
2627
removeNewLinesAndExtraSpaces,
2728
toFixedLocale,
28-
convertArabicToRoman
2929
} from "./str";
3030
import { containsEncodedComponents } from "./url";
3131
import { getUUID } from "./uuid";

src/utils/str.js

+31-29
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,35 @@ export function removeEmptyLinesFromString(string) {
5656
}
5757

5858
/**
59-
* converts simple number to roman.
60-
* @param {Number} num
61-
* @returns {String} - string
62-
*/
59+
* converts simple number to roman.
60+
* @param {Number} num
61+
* @returns {String} - string
62+
*/
6363
export function convertArabicToRoman(num) {
64-
var roman = {
65-
M: 1000,
66-
CM: 900,
67-
D: 500,
68-
CD: 400,
69-
C: 100,
70-
XC: 90,
71-
L: 50,
72-
XL: 40,
73-
X: 10,
74-
IX: 9,
75-
V: 5,
76-
IV: 4,
77-
I: 1
78-
};
79-
let str = '';
80-
81-
for (const i of Object.keys(roman)) {
82-
const q = Math.floor(num / roman[i]);
83-
num -= q * roman[i];
84-
str += i.repeat(q);
85-
}
86-
87-
return str;
88-
}
64+
const roman = {
65+
M: 1000,
66+
CM: 900,
67+
D: 500,
68+
CD: 400,
69+
C: 100,
70+
XC: 90,
71+
L: 50,
72+
XL: 40,
73+
X: 10,
74+
IX: 9,
75+
V: 5,
76+
IV: 4,
77+
I: 1,
78+
};
79+
let str = "";
80+
81+
// eslint-disable-next-line no-restricted-syntax
82+
for (const i of Object.keys(roman)) {
83+
const q = Math.floor(num / roman[i]);
84+
// eslint-disable-next-line no-param-reassign
85+
num -= q * roman[i];
86+
str += i.repeat(q);
87+
}
88+
89+
return str;
90+
}

tests/context.tests.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable max-classes-per-file */
12
import { expect } from "chai";
23
import { mix } from "mixwith";
34

tests/utils.tests.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-unused-expressions */
12
import { expect } from "chai";
23

34
import { deepClone } from "../src/utils/clone";

0 commit comments

Comments
 (0)