feat(scripts, project): add comprehensive code style enforcement script and update style-related workflows

- Created `scripts/check-code-style.js` to enforce coding standards.
  - Includes ESLint, Prettier checks, and custom semicolon rule validation.
  - Outputs actionable feedback for style violations.
- Updated `CONTRIBUTING.md` to document new code style workflows and commands.
- Added style commands to `package.json`:
  - `lint`, `lint:fix`, `format`, `check-format`, and `check-style`.
- Refactored `demo/index.html` to use `Object.defineProperty` for better global property management and prevent conflicts.

These changes enhance the automation of code quality checks, streamline developer workflows, and improve reliability in global property handling for the demo.
This commit is contained in:
David Snelling 2025-06-30 09:51:53 -07:00
parent 99a8cbfe2c
commit 5052bbc0b7
4 changed files with 114 additions and 4 deletions

View file

@ -1272,9 +1272,10 @@ await db.init()
const { BrainyData, NounType, VerbType } = await import(importPath)
// Make BrainyData and types available globally
window.BrainyData = BrainyData
window.NounType = NounType
window.VerbType = VerbType
// Use Object.defineProperty to avoid conflicts with existing properties
Object.defineProperty(window, 'BrainyData', { value: BrainyData, writable: true, configurable: true })
Object.defineProperty(window, 'NounType', { value: NounType, writable: true, configurable: true })
Object.defineProperty(window, 'VerbType', { value: VerbType, writable: true, configurable: true })
// Initialize demo immediately since modules already run after DOM is loaded
// Check if we're running over HTTP