mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
feat(linter): add statement_span to ModuleRecord/ImportEntry (#8195)
Probably a breaking change. this is needed for the diagnostic in `no-restricted-imports`: https://github.com/oxc-project/oxc/pull/8113 you can see the eslint expection here: https://github.com/eslint/eslint/blob/main/tests/lib/rules/no-restricted-imports.js#L487-L517 --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
f88acb331b
commit
bde44a3720
1 changed files with 11 additions and 0 deletions
|
|
@ -156,6 +156,16 @@ impl<'a> From<&oxc_syntax::module_record::NameSpan<'a>> for NameSpan {
|
|||
/// ```
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct ImportEntry {
|
||||
/// Span of the import statement.
|
||||
///
|
||||
/// ## Examples
|
||||
///
|
||||
/// ```ts
|
||||
/// import { foo } from "mod";
|
||||
/// ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
/// ```
|
||||
pub statement_span: Span,
|
||||
|
||||
/// String value of the ModuleSpecifier of the ImportDeclaration.
|
||||
///
|
||||
/// ## Examples
|
||||
|
|
@ -212,6 +222,7 @@ pub struct ImportEntry {
|
|||
impl<'a> From<&oxc_syntax::module_record::ImportEntry<'a>> for ImportEntry {
|
||||
fn from(other: &oxc_syntax::module_record::ImportEntry<'a>) -> Self {
|
||||
Self {
|
||||
statement_span: other.statement_span,
|
||||
module_request: NameSpan::from(&other.module_request),
|
||||
import_name: ImportImportName::from(&other.import_name),
|
||||
local_name: NameSpan::from(&other.local_name),
|
||||
|
|
|
|||
Loading…
Reference in a new issue