|
| 1 | +import tseslintPlugin from '@typescript-eslint/eslint-plugin'; |
| 2 | +import { defineConfig } from 'eslint/config'; |
| 3 | +import globals from 'globals'; |
| 4 | + |
| 5 | +const backendLanguageOptions = { |
| 6 | + globals: { |
| 7 | + // Current, intentionally supported globals |
| 8 | + extension: 'readonly', |
| 9 | + config: 'readonly', |
| 10 | + global_config: 'readonly', |
| 11 | + |
| 12 | + // Older not entirely ideal globals |
| 13 | + use: 'readonly', // <-- older import mechanism |
| 14 | + def: 'readonly', // <-- older import mechanism |
| 15 | + kv: 'readonly', // <-- should be passed/imported |
| 16 | + ll: 'readonly', // <-- questionable |
| 17 | + |
| 18 | + // Language/environment globals |
| 19 | + ...globals.node, |
| 20 | + }, |
| 21 | +}; |
| 22 | + |
| 23 | +export default defineConfig([ |
| 24 | + { |
| 25 | + ignores: [ |
| 26 | + 'src/backend/src/modules/apps/AppInformationService.js', // TEMPORARY - SHOULD BE FIXED! |
| 27 | + 'src/backend/src/services/worker/WorkerService.js', // TEMPORARY - SHOULD BE FIXED! |
| 28 | + 'src/backend/src/public/**/*', // We may be able to delete this! I don't think it's used |
| 29 | + |
| 30 | + // These files run in the worker environment, so these rules don't apply |
| 31 | + 'src/backend/src/services/worker/dist/**/*.{js,cjs,mjs}', |
| 32 | + 'src/backend/src/services/worker/src/**/*.{js,cjs,mjs}', |
| 33 | + 'src/backend/src/services/worker/template/puter-portable.js', |
| 34 | + ], |
| 35 | + }, |
| 36 | + { |
| 37 | + plugins: { |
| 38 | + '@typescript-eslint': tseslintPlugin, |
| 39 | + }, |
| 40 | + }, |
| 41 | + { |
| 42 | + files: [ |
| 43 | + 'src/backend/**/*.{js,mjc,cjs}', |
| 44 | + 'extensions/**/*.{js,mjc,cjs}', |
| 45 | + 'src/backend-core-0/**/*.{js,mjc,cjs}', |
| 46 | + ], |
| 47 | + ignores: [ |
| 48 | + 'src/backend/src/services/database/sqlite_setup/**/*.js', |
| 49 | + ], |
| 50 | + rules: { |
| 51 | + 'no-undef': 'error', |
| 52 | + }, |
| 53 | + languageOptions: { |
| 54 | + ...backendLanguageOptions, |
| 55 | + }, |
| 56 | + }, |
| 57 | + { |
| 58 | + files: [ |
| 59 | + 'src/backend/src/services/database/sqlite_setup/**/*.js', |
| 60 | + ], |
| 61 | + rules: { |
| 62 | + 'no-undef': 'error', |
| 63 | + }, |
| 64 | + languageOptions: { |
| 65 | + globals: { |
| 66 | + read: 'readonly', |
| 67 | + write: 'readonly', |
| 68 | + log: 'readonly', |
| 69 | + ...globals.node, |
| 70 | + }, |
| 71 | + }, |
| 72 | + }, |
| 73 | + { |
| 74 | + files: [ |
| 75 | + 'src/backend/**/*.{ts}', |
| 76 | + 'extensions/**/*.{ts}', |
| 77 | + 'src/backend-core-0/**/*.{ts}', |
| 78 | + ], |
| 79 | + rules: { |
| 80 | + 'no-undef': 'error', |
| 81 | + }, |
| 82 | + languageOptions: { |
| 83 | + ...backendLanguageOptions, |
| 84 | + }, |
| 85 | + }, |
| 86 | +]); |
0 commit comments