{"record":{"id":"0cd671cff0a56ecb","repo":"oxc-project/oxc","slug":"ts5081","errorCode":"TS5081","errorMessage":"Cannot find a tsconfig.json file at the current directory: {}.","messagePattern":"Cannot find a tsconfig\\.json file at the current directory: (.+?)\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/oxc_type_checker/src/execute/tsc.rs","lineNumber":86,"sourceCode":"/// - `Ok(Some(path))` — a resolved config file to load,\n/// - `Ok(None)` — source files were given with no config file (compile them directly),\n/// - `Err(_)` — one of `tsc`'s command-line errors, ready to print.\nfn resolve_config_file(command: &TypeCheckCommand, cwd: &Path) -> Result<Option<PathBuf>> {\n    if let Some(project) = &command.project {\n        // TS5042\n        if !command.files.is_empty() {\n            bail!(\"Option 'project' cannot be mixed with source files on a command line.\");\n        }\n\n        let file_or_directory = to_path(cwd, project);\n        if file_or_directory.is_dir() {\n            // A directory: look for `tsconfig.json` inside it.\n            let config_file = file_or_directory.join(\"tsconfig.json\");\n            if config_file.is_file() {\n                Ok(Some(config_file))\n            } else {\n                // TS5081\n                bail!(\n                    \"Cannot find a tsconfig.json file at the current directory: {}.\",\n                    config_file.display()\n                );\n            }\n        } else if file_or_directory.exists() {\n            // An explicit config file (need not be named `tsconfig.json`).\n            Ok(Some(file_or_directory))\n        } else {\n            // TS5058\n            bail!(\"The specified path does not exist: '{}'.\", file_or_directory.display());\n        }\n    } else if let Some(config_file) = find_config_file(cwd) {\n        if command.files.is_empty() {\n            Ok(Some(config_file))\n        } else {\n            // TS5112: a tsconfig.json is present but source files were also specified.\n            bail!(\n                \"tsconfig.json is present but will not be loaded if files are specified on \\","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_type_checker/src/execute/tsc.rs#L68-L104","documentation":"Diagnostic from oxlint's vue/valid-define-emits rule (crates/oxc_linter/src/rules/vue/valid_define_emits.rs). It fires when custom events are declared twice: via `defineEmits(...)` that actually defines events in `<script setup>`, and again via an `emits` option on the `export default {}` in the sibling plain `<script>` block. The two lists diverge easily and the options-block emits duplicate or override the macro's, so the rule asks you to remove the `export default` declaration.","triggerScenarios":"An SFC with both `<script>export default { emits: [...] }</script>` (non-empty emits) and `<script setup>defineEmits({ submit: null })</script>`; type-only `defineEmits<{...}>()` plus options emits is also flagged. A bare `defineEmits()` next to options `emits` is allowed (single source of truth).","commonSituations":"Partial migration from Options API to `<script setup>` leaving the old options block behind; codemods adding script setup without stripping emits; mixed-style SFCs during gradual upgrades.","solutions":["Delete `emits` (or the whole `export default {}`) from the plain `<script>` block and keep events solely in `defineEmits`.","Merge any options-declared events into the defineEmits call first so none are lost.","Keep exactly one source of truth for events per component."],"exampleFix":"// before\n<script>\nexport default { emits: ['notify'] }\n</script>\n<script setup>\ndefineEmits({ submit: null })\n</script>\n\n// after\n<script setup>\ndefineEmits({ notify: null, submit: null })\n</script>","handlingStrategy":"validation","validationCode":"// events must not be declared in both defineEmits and options emits\nconst m = setupSource.match(/defineEmits\\s*(<[^>]*>)?\\s*\\(([^)]*)\\)/);\nconst definesEvents = Boolean(m) && (Boolean(m[1]) || m[2].trim().length > 0);\nif (definesEvents && optionsBlockHasEmits) {\n  throw new Error('events defined in both defineEmits and export default {}; remove one');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep exactly one source of truth for events per component.","When migrating to <script setup>, delete the options block's emits in the same change.","During partial migrations, audit mixed SFCs (both script blocks) for duplicated declarations."],"tags":["vue","oxlint","lint","script-setup","defineemits","compiler-macro","options-api"],"backgroundTag":"vue-define-emits-misuse","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}