Skip to content

Commit 4a02d48

Browse files
Merge pull request #527 from Proxyfil/fix/frontend-format-lint
2 parents 48dda62 + 4b428f7 commit 4a02d48

File tree

6 files changed

+269
-57
lines changed

6 files changed

+269
-57
lines changed

.github/workflows/frontend_lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ jobs:
2424
with:
2525
fetch-depth: 1
2626

27-
- uses: pnpm/action-setup@v2.2.4
27+
- uses: pnpm/action-setup@v5.0.0
2828
with:
29-
version: 8.14.0
29+
version: 10.24.0
3030
working-directory: ./frontend
3131

3232
- name: Install dependencies

frontend/.eslintrc.cjs

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

frontend/.prettierignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
2+
#
3+
# SPDX-License-Identifier: MPL-2.0
4+
5+
.gitignore
6+
src/lib/i18n/locales/*.json
7+
pnpm-lock.yaml
8+
src/app.html

frontend/eslint.config.cjs

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
2+
//
3+
// SPDX-License-Identifier: MPL-2.0
4+
5+
const { defineConfig, globalIgnores } = require('eslint/config');
6+
7+
const tsParser = require('@typescript-eslint/parser');
8+
const typescriptEslint = require('@typescript-eslint/eslint-plugin');
9+
const globals = require('globals');
10+
const js = require('@eslint/js');
11+
const svelte = require('eslint-plugin-svelte');
12+
13+
module.exports = defineConfig([
14+
js.configs.recommended,
15+
svelte.configs.recommended,
16+
globalIgnores(['**/*.cjs', 'src/app.html']),
17+
{
18+
languageOptions: {
19+
sourceType: 'module',
20+
ecmaVersion: 2020,
21+
22+
globals: {
23+
...globals.browser,
24+
...globals.node
25+
}
26+
}
27+
},
28+
{
29+
files: ['**/*.{ts,js}'],
30+
languageOptions: {
31+
parser: tsParser
32+
},
33+
34+
plugins: {
35+
'@typescript-eslint': typescriptEslint
36+
},
37+
38+
rules: {
39+
'no-unused-vars': [
40+
'error',
41+
{
42+
argsIgnorePattern: '^_.*'
43+
}
44+
],
45+
46+
'@typescript-eslint/no-unused-vars': [
47+
'error',
48+
{
49+
argsIgnorePattern: '^_.*'
50+
}
51+
]
52+
}
53+
},
54+
{
55+
files: ['**/*.svelte'],
56+
languageOptions: {
57+
parserOptions: {
58+
parser: tsParser,
59+
extraFileExtensions: ['.svelte']
60+
}
61+
}
62+
},
63+
{
64+
files: ['**/*.svelte', '**/*.ts', '**/*.js'],
65+
66+
rules: {
67+
'a11y-click-events-have-key-events': 'off',
68+
'no-unused-vars': [
69+
'error',
70+
{
71+
argsIgnorePattern: '^_.*'
72+
}
73+
],
74+
'@typescript-eslint/no-unused-vars': [
75+
'error',
76+
{
77+
argsIgnorePattern: '^_.*'
78+
}
79+
],
80+
'svelte/no-at-html-tags': 'warn',
81+
'svelte/require-each-key': 'warn'
82+
},
83+
84+
plugins: {
85+
'@typescript-eslint': typescriptEslint
86+
}
87+
}
88+
]);

frontend/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"preview": "vite preview",
99
"check": "svelte-check --tsconfig ./tsconfig.json",
1010
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
11-
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . '!src/lib/i18n/locales/*.json' '!pnpm-lock.yaml' '!src/app.html' && eslint --ignore-path .gitignore .",
12-
"lint-without-format-checking": "eslint --ignore-path .gitignore .",
13-
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. . '!src/lib/i18n/locales/*.json'",
11+
"lint": "prettier --check --plugin-search-dir=. . '!src/lib/i18n/locales/*.json' '!pnpm-lock.yaml' '!src/app.html' && eslint .",
12+
"lint-without-format-checking": "eslint .",
13+
"format": "prettier --write --plugin-search-dir=. . '!src/lib/i18n/locales/*.json'",
1414
"run:prod": "node index.js",
1515
"translations-scan": "i18next-scanner --config i18next-scanner.config.engine.cjs src/**/*.svelte"
1616
},
@@ -58,6 +58,7 @@
5858
"dompurify": "^3.3.0",
5959
"eslint": "^9.38.0",
6060
"eslint-config-prettier": "^10.1.8",
61+
"eslint-plugin-svelte": "^3.17.0",
6162
"felte": "^1.3.0",
6263
"fuse.js": "^7.1.0",
6364
"highlight.js": "^11.11.1",
@@ -82,6 +83,7 @@
8283
"socket.io-client": "^4.8.1",
8384
"svelte": "^5.42.2",
8485
"svelte-check": "^4.3.3",
86+
"svelte-eslint-parser": "^1.6.0",
8587
"svelte-preprocess": "^6.0.3",
8688
"svelte-range-slider-pips": "^4.1.0",
8789
"svelte-tippy": "^1.3.2",

0 commit comments

Comments
 (0)