Skip to content

Commit 5eb7dd9

Browse files
committed
Add Prettier config and update ESLint
1 parent 2c004de commit 5eb7dd9

88 files changed

Lines changed: 2506 additions & 3492 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.

.github/workflows/nodelint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ESLint
1+
name: Lint & Format (ESLint + Prettier)
22

33
on: [push]
44

client/.prettierignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build outputs
5+
dist/
6+
../server/static/
7+
8+
# Test outputs
9+
coverage/
10+
junit/
11+
12+
# Backups
13+
*.backup
14+
15+
# Generated files
16+
src/docs/

client/eslint.config.mjs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import js from '@eslint/js';
22
import pluginVue from 'eslint-plugin-vue';
33
import globals from 'globals';
44
import babelParser from '@babel/eslint-parser';
5+
import prettierConfig from 'eslint-config-prettier';
6+
import prettierPlugin from 'eslint-plugin-prettier';
57

68
export default [
79
{
@@ -11,12 +13,16 @@ export default [
1113
'../server/static/**',
1214
'junit/**',
1315
'*.backup',
16+
'src/docs/**',
1417
],
1518
},
1619
js.configs.recommended,
1720
...pluginVue.configs['flat/vue2-recommended'],
1821
{
1922
files: ['**/*.{js,vue}'],
23+
plugins: {
24+
prettier: prettierPlugin,
25+
},
2026
languageOptions: {
2127
ecmaVersion: 2021,
2228
sourceType: 'module',
@@ -37,27 +43,24 @@ export default [
3743
},
3844
},
3945
rules: {
46+
// Prettier integration - runs Prettier as an ESLint rule
47+
'prettier/prettier': 'error',
48+
49+
// Disable formatting rules that conflict with Prettier
50+
...prettierConfig.rules,
51+
52+
// Let Prettier handle line length (via printWidth config)
53+
'max-len': 'off',
54+
55+
// Custom linting rules (non-formatting)
4056
'no-unused-vars': 'off',
4157
'vue/no-unused-vars': 'off',
4258
'no-plusplus': 'off',
43-
'no-param-reassign': ['error', {
44-
props: true,
45-
ignorePropertyModificationsFor: [
46-
'state',
47-
'acc',
48-
'e',
49-
],
50-
}],
51-
'max-len': [
59+
'no-param-reassign': [
5260
'error',
53-
150,
54-
2,
5561
{
56-
ignoreUrls: true,
57-
ignoreComments: false,
58-
ignoreRegExpLiterals: true,
59-
ignoreStrings: true,
60-
ignoreTemplateLiterals: true,
62+
props: true,
63+
ignorePropertyModificationsFor: ['state', 'acc', 'e'],
6164
},
6265
],
6366
},

client/package-lock.json

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

client/package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66
"prebuild": "scripts/copy-docs.sh && node scripts/generate-doc-manifest.js",
77
"build": "vite build",
88
"build:analyze": "vite build --mode analyze",
9-
"lint": "eslint 'src/**/*.{js,vue}' --fix",
10-
"ci-lint": "eslint 'src/**/*.{js,vue}'",
9+
"lint": "npm run format && npm run lint:eslint",
10+
"lint:eslint": "eslint 'src/**/*.{js,vue}' --fix",
11+
"ci-lint": "npm run format:check && npm run lint:eslint-check",
12+
"lint:eslint-check": "eslint 'src/**/*.{js,vue}'",
1113
"lint:filter": "./scripts/eslint-filter.sh",
14+
"format": "prettier --write 'src/**/*.{js,vue,json,css,scss}'",
15+
"format:check": "prettier --check 'src/**/*.{js,vue,json,css,scss}'",
1216
"test": "vitest",
1317
"test:ui": "vitest --ui",
1418
"test:run": "vitest run",
@@ -54,9 +58,12 @@
5458
"@vitest/ui": "^4.0.16",
5559
"@vue/test-utils": "^2.4.6",
5660
"eslint": "^9.39.2",
61+
"eslint-config-prettier": "^10.1.8",
62+
"eslint-plugin-prettier": "^5.5.4",
5763
"eslint-plugin-vue": "^9.33.0",
5864
"globals": "^15.14.0",
5965
"jsdom": "^27.4.0",
66+
"prettier": "^3.7.4",
6067
"sass": "1.97.2",
6168
"vite": "^7.3.1",
6269
"vitest": "^4.0.16"

client/prettier.config.mjs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Prettier configuration for DigiScript frontend
3+
* Based on Vue.js community recommendations
4+
* @see https://prettier.io/docs/en/configuration.html
5+
* @see https://vuejs.org/style-guide/
6+
*/
7+
export default {
8+
// Standard Prettier defaults with Vue community preferences
9+
printWidth: 100,
10+
tabWidth: 2,
11+
useTabs: false,
12+
semi: true,
13+
singleQuote: true,
14+
quoteProps: 'as-needed',
15+
trailingComma: 'es5',
16+
bracketSpacing: true,
17+
bracketSameLine: false,
18+
arrowParens: 'always',
19+
endOfLine: 'lf',
20+
21+
// Vue-specific options
22+
vueIndentScriptAndStyle: false, // Don't indent <script> and <style> tags
23+
singleAttributePerLine: false, // Allow multiple attributes per line (Vue default)
24+
25+
// File-specific overrides
26+
overrides: [
27+
{
28+
files: '*.vue',
29+
options: {
30+
parser: 'vue',
31+
},
32+
},
33+
{
34+
files: ['*.json', '.prettierrc'],
35+
options: {
36+
printWidth: 80,
37+
},
38+
},
39+
],
40+
};

0 commit comments

Comments
 (0)