Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
max_line_length = 100

[*.vue]
indent_size = 2

[*.{js,ts}]
indent_size = 2

[*.{json,yml,yaml}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
max_line_length = off
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI - Lint and Build

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npm run lint

- name: Check Prettier formatting
run: npx prettier --check "src/**/*.{js,vue,css}"

build:
name: Build Application
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build for production
run: npm run build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 7
58 changes: 58 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: PR Quality Check

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
quality-check:
name: Code Quality Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for better analysis

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run ESLint with annotations
run: npm run lint
continue-on-error: true

- name: Check code formatting
run: npx prettier --check "src/**/*.{js,vue,css}"
continue-on-error: true

- name: Build check
run: npm run build

- name: Check bundle size
run: |
echo "## Bundle Size Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| File | Size |" >> $GITHUB_STEP_SUMMARY
echo "|------|------|" >> $GITHUB_STEP_SUMMARY
find dist -type f -name "*.js" -o -name "*.css" | while read file; do
size=$(du -h "$file" | cut -f1)
echo "| \`${file#dist/}\` | $size |" >> $GITHUB_STEP_SUMMARY
done

- name: Comment PR
uses: actions/github-script@v7
if: github.event_name == 'pull_request'
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '✅ Code quality checks passed! Build successful.'
})
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ dist
dist-ssr
*.local

# env
.env
.env.*

# Editor directories and files
.vscode/*
!.vscode/extensions.json
Expand Down
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
dist
build
.vscode
.git
*.min.js
*.min.css
package-lock.json
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": true,
"trailingComma": "all",
"semi": false,
"arrowParens": "always"
}
8 changes: 6 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"recommendations": ["Vue.volar"]
}
"recommendations": [
"Vue.volar",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
76 changes: 76 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import js from '@eslint/js'
import pluginVue from 'eslint-plugin-vue'
import prettier from 'eslint-plugin-prettier'
import prettierConfig from 'eslint-config-prettier'

export default [
// Base JavaScript recommended rules
js.configs.recommended,

// Vue 3 recommended rules
...pluginVue.configs['flat/recommended'],

// Prettier integration
prettierConfig,

{
files: ['**/*.{js,vue}'],
plugins: {
prettier
},
rules: {
// Prettier as ESLint rule
'prettier/prettier': 'error',

// Vue-specific rules
'vue/multi-word-component-names': 'off', // Allow single-word component names
'vue/require-default-prop': 'error',
'vue/require-prop-types': 'error',
'vue/no-unused-vars': 'error',
'vue/no-v-html': 'warn', // Warn but allow (needed for rich descriptions)

// JavaScript best practices (Senior-level code quality)
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-debugger': 'error',
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'no-var': 'error',
'prefer-const': 'error',
'prefer-arrow-callback': 'error',
'no-implicit-coercion': 'error',
eqeqeq: ['error', 'always'],
curly: ['error', 'all'],
'no-eval': 'error',
'no-implied-eval': 'error',
'no-with': 'error',

// Code quality (adjusted for scenario management complexity)
complexity: ['warn', 15], // Increased for scenario validation logic
'max-depth': ['warn', 4],
'max-lines-per-function': ['warn', { max: 60, skipBlankLines: true, skipComments: true }],
'max-params': ['warn', 4],

// Prevent common mistakes
'no-duplicate-imports': 'off', // Allow for better code organization
'no-unreachable': 'error',
'no-unreachable-loop': 'error',
'require-atomic-updates': 'error'
},
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
// Browser globals
window: 'readonly',
document: 'readonly',
navigator: 'readonly',
localStorage: 'readonly',
console: 'readonly'
}
}
},

// Ignore patterns
{
ignores: ['node_modules/**', 'dist/**', 'build/**', '.vscode/**', '.git/**', '*.min.js']
}
]
Loading