Skip to content

Commit 6542756

Browse files
authored
Merge pull request #15 from Exabyte-io/feat/SOF-6398
SOF-6398: add eslint preset and reformat
2 parents 6d0bbfd + 2c4550a commit 6542756

File tree

14 files changed

+78
-158
lines changed

14 files changed

+78
-158
lines changed

.eslintrc.json

Lines changed: 1 addition & 56 deletions
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

.prettierrc

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

package-lock.json

Lines changed: 6 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
"description": "Application DEfinitions",
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": {
@@ -46,16 +45,15 @@
4645
},
4746
"devDependencies": {
4847
"@exabyte-io/code.js": "2022.11.11-0",
48+
"@exabyte-io/eslint-config": "^2022.11.16-0",
4949
"@exabyte-io/made.js": "2022.6.15-0",
5050
"chai": "^4.3.4",
5151
"eslint": "7.32.0",
5252
"eslint-config-airbnb": "19.0.2",
53-
"eslint-config-prettier": "8.3.0",
54-
"eslint-plugin-react": "7.30.0",
5553
"eslint-plugin-import": "2.25.3",
5654
"eslint-plugin-jsdoc": "37.1.0",
5755
"eslint-plugin-jsx-a11y": "6.5.1",
58-
"eslint-plugin-prettier": "4.2.1",
56+
"eslint-plugin-react": "7.30.0",
5957
"eslint-plugin-simple-import-sort": "7.0.0",
6058
"husky": "^7.0.4",
6159
"lint-staged": "^12.1.2",
@@ -71,7 +69,6 @@
7169
"node": ">=12.0.0"
7270
},
7371
"lint-staged": {
74-
"*.js": "eslint --cache --fix",
75-
"*.{js,css}": "prettier --write"
72+
"*.js": "eslint --cache --fix"
7673
}
7774
}

src/application.js

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
1-
import lodash from "lodash";
2-
import { getAppTree, getAppData, allApplications } from "@exabyte-io/application-flavors.js";
1+
import { allApplications, getAppData, getAppTree } from "@exabyte-io/application-flavors.js";
32
import { NamedDefaultableInMemoryEntity } from "@exabyte-io/code.js/dist/entity";
3+
import lodash from "lodash";
44

55
import { Executable } from "./executable";
66
import { getApplicationConfig, getExecutableConfig } from "./tree";
77

8-
98
export class Application extends NamedDefaultableInMemoryEntity {
109
static Executable = Executable;
1110

1211
constructor(config) {
1312
const staticConfig = getApplicationConfig(config);
14-
super({...staticConfig, ...config});
13+
super({ ...staticConfig, ...config });
1514
}
1615

1716
// TODO: extract this from application-flavors "global" default config for espresso 5.4.0
1817
static get defaultConfig() {
1918
return {
20-
name: 'espresso',
21-
shortName: 'qe',
22-
version: '5.4.0',
23-
summary: 'Quantum Espresso',
24-
build: 'Default',
25-
}
19+
name: "espresso",
20+
shortName: "qe",
21+
version: "5.4.0",
22+
summary: "Quantum Espresso",
23+
build: "Default",
24+
};
2625
}
2726

2827
static create(config) {
2928
return this.createFromNameVersionBuild(config);
3029
}
3130

32-
static createFromNameVersionBuild({name, version = null, build = "Default"}) {
33-
return new Application({name, version, build});
31+
static createFromNameVersionBuild({ name, version = null, build = "Default" }) {
32+
return new Application({ name, version, build });
3433
}
3534

3635
getExecutables() {
@@ -39,15 +38,15 @@ export class Application extends NamedDefaultableInMemoryEntity {
3938

4039
getBuilds() {
4140
const data = getAppData(this.prop("name"));
42-
const {versions} = data;
41+
const { versions } = data;
4342
const builds = ["Default"];
4443
versions.map((v) => v.build && builds.push(v.build));
4544
return lodash.uniq(builds);
4645
}
4746

4847
getVersions() {
4948
const data = getAppData(this.prop("name"));
50-
const {versions} = data;
49+
const { versions } = data;
5150
const these = versions.map((v) => v.version);
5251
return lodash.uniq(these);
5352
}
@@ -61,7 +60,7 @@ export class Application extends NamedDefaultableInMemoryEntity {
6160
getExecutableConfig({
6261
appName: this.prop("name"),
6362
execName: name,
64-
})
63+
}),
6564
);
6665
}
6766

@@ -74,8 +73,9 @@ export class Application extends NamedDefaultableInMemoryEntity {
7473
}
7574

7675
// override upon inheritance
76+
// eslint-disable-next-line class-methods-use-this
7777
get allowedModelTypes() {
78-
return []
78+
return [];
7979
}
8080

8181
get summary() {
@@ -96,11 +96,11 @@ export class Application extends NamedDefaultableInMemoryEntity {
9696

9797
get executables() {
9898
const tree = getAppTree(this.prop("name"));
99-
return Object.keys(tree).map(key => {
99+
return Object.keys(tree).map((key) => {
100100
return new this.constructor.Executable(
101-
Object.assign({}, tree[key], {name: key})
102-
)
103-
})
101+
{ ...tree[key], name: key },
102+
);
103+
});
104104
}
105105

106106
get hasAdvancedComputeOptions() {
@@ -110,5 +110,4 @@ export class Application extends NamedDefaultableInMemoryEntity {
110110
get isLicensed() {
111111
return this.prop("isLicensed");
112112
}
113-
114113
}

src/context.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export { NWChemTotalEnergyContextProvider } from "./context/providers/nwchem/providers";
22
export { QEPWXContextProvider, QENEBContextProvider } from "./context/providers/espresso/providers";
33
export { VASPContextProvider, VASPNEBContextProvider } from "./context/providers/vasp/providers";
4-
export { ExecutableContextProvider } from "./context/providers"
4+
export { ExecutableContextProvider } from "./context/providers";

src/context/providers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export class ExecutableContextProvider extends ContextProvider {
44
constructor(config) {
55
super({
66
...config,
7-
domain: "executable"
7+
domain: "executable",
88
});
99
}
1010
}

src/context/providers/espresso/providers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable max-classes-per-file */
12
import {
23
JobContextMixin,
34
MaterialContextMixin,

src/context/providers/vasp/providers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable max-classes-per-file */
12
import {
23
JobContextMixin,
34
MaterialContextMixin,

src/flavor.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
import { mix } from "mixwith";
21
import { NamedDefaultableInMemoryEntity, RuntimeItemsMixin } from "@exabyte-io/code.js/dist/entity";
2+
import { mix } from "mixwith";
3+
34
import { Template } from "./template";
45

56
export class Flavor extends mix(NamedDefaultableInMemoryEntity).with(RuntimeItemsMixin) {
6-
7-
constructor(config) {
8-
super(config);
9-
}
10-
11-
get input() { return this.prop("input", []) }
7+
get input() { return this.prop("input", []); }
128

139
// TODO : prevent this from running in client
1410
get inputAsTemplates() {
@@ -26,8 +22,11 @@ export class Flavor extends mix(NamedDefaultableInMemoryEntity).with(RuntimeItem
2622
});
2723
}
2824

29-
getInputAsRenderedTemplates(context) {return this.inputAsTemplates.map(t => t.getRenderedJSON(context))}
30-
31-
get disableRenderMaterials() {return this.prop("isMultiMaterial", false)}
25+
getInputAsRenderedTemplates(context) {
26+
return this.inputAsTemplates.map((t) => t.getRenderedJSON(context));
27+
}
3228

29+
get disableRenderMaterials() {
30+
return this.prop("isMultiMaterial", false);
31+
}
3332
}

0 commit comments

Comments
 (0)