1import _import from 'eslint-plugin-import'; 2import { fixupPluginRules } from '@eslint/compat'; 3import globals from 'globals'; 4import path from 'node:path'; 5import { fileURLToPath } from 'node:url'; 6import js from '@eslint/js'; 7import { FlatCompat } from '@eslint/eslintrc'; 8 9const __filename = fileURLToPath(import.meta.url); 10const __dirname = path.dirname(__filename); 11const compat = new FlatCompat({ 12 baseDirectory: __dirname, 13 recommendedConfig: js.configs.recommended, 14 allConfig: js.configs.all, 15}); 16 17export default [ 18 { 19 ignores: [ 20 '**/krill-parser.js', 21 '**/krill.pegjs', 22 '**/.eslintrc.json', 23 '**/server.js', 24 '**/tidal-sniffer.js', 25 '**/*.jsx', 26 '**/tunejs.js', 27 'out/**/*', 28 '**/postcss.config.js', 29 '**/postcss.config.cjs', 30 '**/tailwind.config.js', 31 '**/tailwind.config.cjs', 32 '**/vite.config.js', 33 '**/dist/**/*', 34 '!**/*.mjs', 35 '**/*.tsx', 36 '**/*.ts', 37 '**/*.json', 38 '**/dev-dist', 39 '**/dist', 40 'src-tauri/target/**/*', 41 '**/reverbGen.mjs', 42 '**/hydra.mjs', 43 '**/jsdoc-synonyms.js', 44 'packages/hs2js/src/hs2js.mjs', 45 'packages/supradough/dough-export.mjs', 46 '**/samples', 47 ], 48 }, 49 ...compat.extends('eslint:recommended').map((config) => ({ 50 ...config, 51 files: ['**/*.mjs', '**/*.js'], 52 })), 53 { 54 files: ['**/*.mjs', '**/*.js'], 55 56 plugins: { 57 import: fixupPluginRules(_import), 58 }, 59 60 languageOptions: { 61 globals: { 62 ...globals.node, 63 ...globals.browser, 64 }, 65 66 ecmaVersion: 'latest', 67 sourceType: 'module', 68 }, 69 70 rules: { 71 'no-unused-vars': [ 72 'warn', 73 { 74 destructuredArrayIgnorePattern: '.', 75 ignoreRestSiblings: false, 76 }, 77 ], 78 79 'import/no-extraneous-dependencies': [ 80 'error', 81 { 82 devDependencies: true, 83 }, 84 ], 85 }, 86 }, 87 { 88 // Properties provided by AudioWorkletGlobalScope 89 files: ['packages/superdough/worklets.mjs'], 90 languageOptions: { 91 globals: { 92 currentTime: 'readonly', 93 sampleRate: 'readonly', 94 }, 95 }, 96 }, 97];