@@ -175,21 +175,206 @@ sudo dnf install webkit2gtk4.1-devel \
175175 librsvg2-devel
176176```
177177
178- ### Run in Development Mode
178+ ### Getting Started
179179
180+ 1 . ** Clone and install dependencies:**
180181``` bash
182+ git clone https://github.com/vietanhdev/ThinkUtils.git
183+ cd thinkutils
181184npm install
182- npm run tauri dev
183185```
184186
185- ### Build for Production
187+ 2 . ** Run in development mode:**
188+ ``` bash
189+ npm run tauri dev
190+ ```
186191
192+ 3 . ** Build for production:**
187193``` bash
188194npm run tauri build
189195```
190196
191197The built packages will be in ` src-tauri/target/release/bundle/ `
192198
199+ ### Code Quality & Linting
200+
201+ ThinkUtils uses comprehensive linting and formatting tools to maintain code quality:
202+
203+ - ** ESLint** - JavaScript linting
204+ - ** HTMLHint** - HTML validation
205+ - ** Stylelint** - CSS linting
206+ - ** Prettier** - Code formatting
207+ - ** Husky** - Git hooks for pre-commit checks
208+ - ** lint-staged** - Run linters on staged files only
209+
210+ #### Available Commands
211+
212+ ``` bash
213+ # Run all linters
214+ npm run lint
215+
216+ # Auto-fix issues
217+ npm run lint:fix
218+
219+ # Format all files
220+ npm run format
221+
222+ # Full validation (lint + format check)
223+ npm run validate
224+ ```
225+
226+ #### Pre-commit Hooks
227+
228+ Pre-commit hooks are automatically set up when you run ` npm install ` . They will:
229+
230+ 1 . ✅ ** Auto-format** staged files (JavaScript, HTML, CSS, JSON)
231+ 2 . ✅ ** Lint** staged files and fix auto-fixable issues
232+ 3 . ✅ ** Validate** all code before allowing commit
233+ 4 . ❌ ** Block commit** if linting fails
234+
235+ ** What happens on commit:**
236+ ``` bash
237+ git commit -m " Your message"
238+
239+ 🔍 Running pre-commit checks...
240+ 📝 Formatting and linting staged files...
241+ ✓ JavaScript files formatted and linted
242+ ✓ CSS files formatted and linted
243+ ✓ HTML files validated
244+ ✅ All checks passed!
245+ ```
246+
247+ ** If issues are found:**
248+ ``` bash
249+ ❌ Linting failed. Please fix the issues and try again.
250+ ```
251+
252+ The commit will be blocked until you fix the issues. Most issues can be auto-fixed:
253+ ``` bash
254+ npm run lint:fix
255+ git add .
256+ git commit -m " Your message"
257+ ```
258+
259+ #### IDE Integration
260+
261+ ** VS Code** (Recommended):
262+ 1 . Install recommended extensions (popup will appear)
263+ 2 . Reload VS Code
264+ 3 . Files will auto-format on save!
265+
266+ Recommended extensions:
267+ - ESLint
268+ - Prettier
269+ - HTMLHint
270+ - Stylelint
271+
272+ ** Other IDEs:**
273+ See ` LINTING_SETUP.md ` for configuration instructions.
274+
275+ #### Bypassing Pre-commit Hooks
276+
277+ In rare cases where you need to bypass hooks (not recommended):
278+ ``` bash
279+ git commit --no-verify -m " Your message"
280+ ```
281+
282+ ### Project Structure
283+
284+ ```
285+ thinkutils/
286+ ├── src/ # Frontend
287+ │ ├── index.html # Main UI
288+ │ ├── styles.css # Styling
289+ │ └── js/ # Modular JavaScript
290+ │ ├── app.js # Main entry point
291+ │ ├── dom.js # DOM references
292+ │ ├── state.js # State management
293+ │ ├── utils.js # Utilities
294+ │ ├── navigation.js # View switching
295+ │ ├── titlebar.js # Window controls
296+ │ ├── about.js # About dialog
297+ │ └── views/ # Feature modules
298+ │ ├── home.js
299+ │ ├── fan.js
300+ │ ├── battery.js
301+ │ ├── performance.js
302+ │ ├── monitor.js
303+ │ ├── sync.js
304+ │ └── system.js
305+ ├── src-tauri/ # Backend (Rust)
306+ │ ├── src/
307+ │ │ └── lib.rs # Tauri commands
308+ │ └── tauri.conf.json # Configuration
309+ ├── .husky/ # Git hooks
310+ │ └── pre-commit # Pre-commit validation
311+ ├── .eslintrc.json # ESLint config
312+ ├── .prettierrc.json # Prettier config
313+ ├── .stylelintrc.json # Stylelint config
314+ ├── .htmlhintrc # HTMLHint config
315+ └── .lintstagedrc.json # lint-staged config
316+ ```
317+
318+ ### Development Workflow
319+
320+ 1 . ** Create a feature branch:**
321+ ``` bash
322+ git checkout -b feature/your-feature
323+ ```
324+
325+ 2 . ** Make your changes:**
326+ - Edit files in ` src/ ` for frontend
327+ - Edit files in ` src-tauri/src/ ` for backend
328+
329+ 3 . ** Test your changes:**
330+ ``` bash
331+ npm run tauri dev
332+ ```
333+
334+ 4 . ** Validate code quality:**
335+ ``` bash
336+ npm run validate
337+ ```
338+
339+ 5 . ** Commit your changes:**
340+ ``` bash
341+ git add .
342+ git commit -m " feat: add your feature"
343+ ```
344+ - Pre-commit hooks will automatically format and lint
345+ - Commit will be blocked if validation fails
346+
347+ 6 . ** Push and create PR:**
348+ ``` bash
349+ git push origin feature/your-feature
350+ ```
351+
352+ ### Coding Standards
353+
354+ - ** JavaScript** : ES6+ modules, single quotes, semicolons
355+ - ** HTML** : HTML5, lowercase tags, double quotes for attributes
356+ - ** CSS** : Standard CSS, consistent spacing
357+ - ** Formatting** : 2-space indentation, LF line endings
358+ - ** Commits** : Follow [ Conventional Commits] ( https://www.conventionalcommits.org/ )
359+
360+ ### Testing
361+
362+ ``` bash
363+ # Run linters
364+ npm run lint
365+
366+ # Run auto-fix
367+ npm run lint:fix
368+
369+ # Full validation
370+ npm run validate
371+ ```
372+
373+ ### Documentation
374+
375+ - ` src/js/README.md ` - JavaScript module documentation
376+ - ` docs/ ` - Feature documentation
377+
193378## Usage
194379
195380### Running the Application
0 commit comments