feat: Enhance UserScript structure and functionality

- Updated package.json to include new scripts for development, production builds, linting, formatting, and cleaning.
- Added ESLint and Prettier for code quality and formatting.
- Refactored main application class to extend EventEmitter and manage modules.
- Introduced ExampleModule to demonstrate module structure and functionality.
- Created utility classes for DOM manipulation, event handling, and persistent storage.
- Added TypeScript definitions for UserScript environment.
- Improved TypeScript configuration with stricter checks and path aliases.
- Updated Vite configuration to handle development and production builds more effectively.
- Enhanced user script header generation to support environment-specific configurations.
This commit is contained in:
JonasPfalzgraf 2025-07-11 17:47:22 +02:00
parent 8089771d41
commit 88aeab8f29
17 changed files with 4064 additions and 595 deletions

39
.eslintrc.js Normal file
View file

@ -0,0 +1,39 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: ['eslint:recommended'],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
env: {
browser: true,
es6: true,
node: true,
},
globals: {
// Greasemonkey/Tampermonkey globals
GM_setValue: 'readonly',
GM_getValue: 'readonly',
GM_deleteValue: 'readonly',
GM_listValues: 'readonly',
GM_log: 'readonly',
GM_notification: 'readonly',
GM_openInTab: 'readonly',
GM_registerMenuCommand: 'readonly',
GM_unregisterMenuCommand: 'readonly',
GM_xmlhttpRequest: 'readonly',
GM_info: 'readonly',
unsafeWindow: 'readonly',
},
rules: {
'no-console': 'off',
'no-debugger': 'warn',
'prefer-const': 'error',
'no-var': 'error',
'no-unused-vars': 'off',
'no-undef': 'off',
},
ignorePatterns: ['dist/', 'node_modules/', 'tools/**/*.js'],
};