Skip to content

Commit 58b5956

Browse files
committed
fixed linting rules and ci steps
1 parent 3fb7edb commit 58b5956

28 files changed

+13439
-26586
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Onlineshop backend
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
backend:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
- name: Setup node
12+
uses: actions/setup-node@v3
13+
with:
14+
node-version: 20.11.x
15+
cache: yarn
16+
cache-dependency-path: ./onlineshop/source/server/yarn.lock
17+
- name: Lint backend
18+
run: |
19+
cd ./onlineshop/source/server/
20+
yarn install --immutable --immutable-cache --check-cache
21+
yarn run lint
22+
- name: Test server
23+
run: |
24+
cd ./onlineshop/source/server/
25+
yarn install --immutable --immutable-cache --check-cache
26+
yarn run test
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
name: onlineshop frontend
3+
4+
on: [push, pull_request]
5+
6+
jobs:
7+
frontend:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
- name: Setup node
13+
uses: actions/setup-node@v3
14+
with:
15+
node-version: 20.11.x
16+
cache: yarn
17+
cache-dependency-path: ./onlineshop/source/client/yarn.lock
18+
- name: Lint frontend
19+
run: |
20+
cd ./onlineshop/source/client/
21+
yarn install --immutable --immutable-cache --check-cache
22+
yarn run lint
23+
- name: Test client
24+
run: |
25+
cd ./onlineshop/source/client/
26+
yarn install --immutable --immutable-cache --check-cache
27+
yarn run test

.github/workflows/rpgsaga.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
name: rpg saga
3+
on: [push, pull_request]
4+
5+
jobs:
6+
saga-ci:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
- name: Setup node
12+
uses: actions/setup-node@v3
13+
with:
14+
node-version: 20.11.x
15+
cache: yarn
16+
cache-dependency-path: ./rpgsaga/saga/yarn.lock
17+
- name: Lint Saga
18+
run: |
19+
cd ./rpgsaga/saga
20+
yarn install --immutable --immutable-cache --check-cache
21+
yarn run lint
22+
- name: Test Saga
23+
run: |
24+
cd ./rpgsaga/saga
25+
yarn install --immutable --immutable-cache --check-cache
26+
yarn run test

onlineshop/source/client/.eslintrc.js

Lines changed: 0 additions & 152 deletions
This file was deleted.
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
2+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
3+
import prettier from "eslint-plugin-prettier";
4+
import _import from "eslint-plugin-import";
5+
import globals from "globals";
6+
import tsParser from "@typescript-eslint/parser";
7+
import path from "node:path";
8+
import { fileURLToPath } from "node:url";
9+
import js from "@eslint/js";
10+
import { FlatCompat } from "@eslint/eslintrc";
11+
12+
const __filename = fileURLToPath(import.meta.url);
13+
const __dirname = path.dirname(__filename);
14+
const compat = new FlatCompat({
15+
baseDirectory: __dirname,
16+
recommendedConfig: js.configs.recommended,
17+
allConfig: js.configs.all
18+
});
19+
20+
export default [{
21+
ignores: ["**/.eslintrc.js", "**/react-app-env.d.ts"],
22+
}, ...fixupConfigRules(compat.extends(
23+
"eslint:recommended",
24+
"plugin:@typescript-eslint/recommended",
25+
"plugin:import/errors",
26+
"plugin:import/warnings",
27+
"plugin:import/typescript",
28+
"plugin:prettier/recommended",
29+
)), {
30+
plugins: {
31+
"@typescript-eslint": fixupPluginRules(typescriptEslint),
32+
prettier: fixupPluginRules(prettier),
33+
import: fixupPluginRules(_import),
34+
},
35+
36+
languageOptions: {
37+
globals: {
38+
...globals.browser,
39+
},
40+
41+
parser: tsParser,
42+
ecmaVersion: 12,
43+
sourceType: "module",
44+
45+
parserOptions: {
46+
ecmaFeatures: {
47+
jsx: true,
48+
},
49+
},
50+
},
51+
52+
settings: {
53+
"import/resolver": {
54+
node: {
55+
extensions: [".js", ".jsx", ".ts", ".tsx"],
56+
moduleDirectory: ["node_modules", "."],
57+
},
58+
},
59+
},
60+
61+
rules: {
62+
"no-param-reassign": ["error"],
63+
64+
"prettier/prettier": ["error", {
65+
endOfLine: "auto",
66+
}],
67+
68+
"linebreak-style": 0,
69+
70+
"arrow-body-style": ["error", "as-needed", {
71+
requireReturnForObjectLiteral: false,
72+
}],
73+
74+
curly: ["error", "all"],
75+
"no-implicit-coercion": ["error"],
76+
"spaced-comment": ["error", "always"],
77+
eqeqeq: ["error", "always"],
78+
"prefer-template": "error",
79+
"no-useless-concat": "error",
80+
81+
"prefer-destructuring": ["error", {
82+
VariableDeclarator: {
83+
array: false,
84+
object: true,
85+
},
86+
87+
AssignmentExpression: {
88+
array: false,
89+
object: true,
90+
},
91+
}, {
92+
enforceForRenamedProperties: false,
93+
}],
94+
95+
"import/extensions": ["error", "ignorePackages", {
96+
ts: "never",
97+
tsx: "never",
98+
}],
99+
100+
"import/no-extraneous-dependencies": ["error", {
101+
devDependencies: true,
102+
}],
103+
104+
"import/order": ["error", {
105+
"newlines-between": "always",
106+
groups: ["builtin", "external", "parent", "sibling", "index"],
107+
108+
pathGroups: [{
109+
pattern: "src/**",
110+
group: "parent",
111+
position: "after",
112+
}],
113+
}],
114+
115+
"import/newline-after-import": "error",
116+
"@typescript-eslint/no-explicit-any": "error",
117+
"@typescript-eslint/explicit-function-return-type": "off",
118+
"@typescript-eslint/explicit-module-boundary-types": "off",
119+
"@typescript-eslint/no-empty-object-type": ["error"],
120+
"@typescript-eslint/no-unsafe-function-type": ["error"],
121+
"@typescript-eslint/no-wrapper-object-types": ["error"],
122+
"@typescript-eslint/no-shadow": ["error"],
123+
124+
"@typescript-eslint/naming-convention": ["error", {
125+
selector: "default",
126+
format: ["camelCase"],
127+
}, {
128+
selector: ["memberLike"],
129+
modifiers: ["private"],
130+
format: ["camelCase"],
131+
leadingUnderscore: "allow",
132+
}, {
133+
selector: ["enumMember", "variable"],
134+
format: ["camelCase", "PascalCase", "UPPER_CASE"],
135+
}, {
136+
selector: "parameter",
137+
format: ["camelCase"],
138+
leadingUnderscore: "allow",
139+
modifiers: ["unused"],
140+
}, {
141+
selector: "objectLiteralProperty",
142+
143+
filter: {
144+
regex: "^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$",
145+
match: true,
146+
},
147+
148+
format: null,
149+
}, {
150+
selector: "typeLike",
151+
format: ["PascalCase"],
152+
}, {
153+
selector: "typeProperty",
154+
format: ["snake_case", "camelCase"],
155+
}],
156+
},
157+
}];

0 commit comments

Comments
 (0)