-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify parser errors creation (#15884)
* Simplify parser errors creation * Better type for `code`
- Loading branch information
1 parent
f64b04e
commit 4013c54
Showing
6 changed files
with
77 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { ParseErrorCode } from "../parse-error"; | ||
import type { ParseErrorTemplates } from "../parse-error"; | ||
|
||
const code = "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"; | ||
|
||
export default { | ||
ImportMetaOutsideModule: { | ||
message: `import.meta may appear only with 'sourceType: "module"'`, | ||
code: ParseErrorCode.SourceTypeModuleError, | ||
code, | ||
}, | ||
ImportOutsideModule: { | ||
message: `'import' and 'export' may appear only with 'sourceType: "module"'`, | ||
code: ParseErrorCode.SourceTypeModuleError, | ||
code, | ||
}, | ||
}; | ||
} satisfies ParseErrorTemplates; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters