Skip to content

Commit 880e1fc

Browse files
committed
chore: add formatter and github workflow for format check
- Added prettier and updated eslint config - Formatted all files and resolved conflicts - Added format check github workflow on push and PR refs: #243
1 parent e5df692 commit 880e1fc

122 files changed

Lines changed: 26552 additions & 21557 deletions

File tree

Some content is hidden

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

.eslintrc.json

Lines changed: 61 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,64 @@
11
{
2-
"root": true,
3-
"env": {
4-
"es2021": true
5-
},
6-
"ignorePatterns": ["src/public/**/*"],
7-
// "extends": "eslint:recommended",
8-
"parser": "@babel/eslint-parser",
9-
"parserOptions": {
10-
"sourceType": "module",
11-
"ecmaVersion": 12,
12-
"ecmaFeatures": {
13-
"impliedStrict": true
14-
}
15-
},
16-
// (first parameter of a rule) 0: off, 1: warning, 2: error
17-
"rules": {
18-
"indent": [2, 2, { "SwitchCase": 1 }],
19-
"linebreak-style": [2, "unix"],
20-
"quotes": [2, "single", { "allowTemplateLiterals": true }],
21-
"semi": [2, "never"],
22-
23-
"array-bracket-spacing": [2, "never"],
24-
"arrow-spacing": 2,
25-
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
26-
"block-spacing": 2,
27-
"comma-spacing": 2,
28-
"computed-property-spacing": [2, "never"],
29-
"func-call-spacing": 2,
30-
"keyword-spacing": 2,
31-
"key-spacing": [2, { "mode": "minimum" }],
32-
"object-curly-spacing": [2, "always"],
33-
"no-irregular-whitespace": 2,
34-
"no-multi-spaces": [2, {
35-
"exceptions": {
36-
"ImportDeclaration": true
37-
}
38-
}],
39-
"no-multiple-empty-lines": [2, { "max": 1 }],
40-
"no-spaced-func": 2,
41-
"rest-spread-spacing": [2, "never"],
42-
"semi-spacing": [2, {"before": false, "after": true}],
43-
"space-before-blocks": 2,
44-
"space-before-function-paren": [0, { "asyncArrow": "always" }],
45-
"space-in-parens": 2,
46-
"space-infix-ops": 2,
47-
"space-unary-ops": 2,
48-
"spaced-comment": [2, "always", {
49-
"block": {
50-
"balanced": true
51-
}
52-
}],
53-
"template-curly-spacing": [2, "never"],
54-
"template-tag-spacing": [2, "always"]
2+
"root": true,
3+
"env": {
4+
"es2021": true
5+
},
6+
"ignorePatterns": ["src/public/**/*"],
7+
// "extends": "eslint:recommended",
8+
"parser": "@babel/eslint-parser",
9+
"parserOptions": {
10+
"sourceType": "module",
11+
"ecmaVersion": 12,
12+
"ecmaFeatures": {
13+
"impliedStrict": true
5514
}
15+
},
16+
"plugins": ["prettier"],
17+
// (first parameter of a rule) 0: off, 1: warning, 2: error
18+
"rules": {
19+
"indent": [2, 2, { "SwitchCase": 1 }],
20+
"linebreak-style": [2, "unix"],
21+
"quotes": [2, "single", { "allowTemplateLiterals": true }],
22+
"semi": [2, "always"],
23+
24+
"array-bracket-spacing": [2, "never"],
25+
"arrow-spacing": 2,
26+
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
27+
"block-spacing": 2,
28+
"comma-spacing": 2,
29+
"computed-property-spacing": [2, "never"],
30+
"func-call-spacing": 2,
31+
"keyword-spacing": 2,
32+
"key-spacing": [2, { "mode": "minimum" }],
33+
"object-curly-spacing": [2, "always"],
34+
"no-irregular-whitespace": 2,
35+
"no-multi-spaces": [
36+
2,
37+
{
38+
"exceptions": {
39+
"ImportDeclaration": true
40+
}
41+
}
42+
],
43+
"no-multiple-empty-lines": [2, { "max": 1 }],
44+
"no-spaced-func": 2,
45+
"rest-spread-spacing": [2, "never"],
46+
"semi-spacing": [2, { "before": false, "after": true }],
47+
"space-before-blocks": 2,
48+
"space-before-function-paren": [0, { "asyncArrow": "always" }],
49+
"space-in-parens": 2,
50+
"space-infix-ops": 2,
51+
"space-unary-ops": 2,
52+
"spaced-comment": [
53+
2,
54+
"always",
55+
{
56+
"block": {
57+
"balanced": true
58+
}
59+
}
60+
],
61+
"template-curly-spacing": [2, "never"],
62+
"template-tag-spacing": [2, "always"]
63+
}
5664
}

.github/workflows/format-check.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Format Check
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
format-check:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v3
12+
13+
- name: Set up Node.js
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version: '18'
17+
18+
- name: Install dependencies
19+
run: npm install
20+
21+
- name: Run Prettier format check
22+
run: npm run format:check

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"semi": true,
3+
"tabWidth": 2,
4+
"printWidth": 100,
5+
"singleQuote": true,
6+
"trailingComma": "es5",
7+
"bracketSpacing": true
8+
}

0 commit comments

Comments
 (0)