mirror of
https://github.com/denoland/deno.git
synced 2025-09-30 22:21:15 +00:00
upgrade: deno_lint, dprint, swc (#6928)
This commit upgrades: deno_lint 0.1.20 dprint-plugin-typescript 0.25.0 swc_ecmascript 0.1.0 SWC is no longer reexported from dprint nor deno_lint.
This commit is contained in:
parent
4afb4b6e46
commit
b718e6ff53
22 changed files with 290 additions and 326 deletions
|
@ -1,5 +1,4 @@
|
|||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||
use crate::swc_ecma_ast;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::ts_type::ts_type_ann_to_def;
|
||||
|
@ -9,23 +8,23 @@ use super::ts_type::TsTypeDef;
|
|||
#[serde(rename_all = "camelCase")]
|
||||
pub struct VariableDef {
|
||||
pub ts_type: Option<TsTypeDef>,
|
||||
pub kind: swc_ecma_ast::VarDeclKind,
|
||||
pub kind: swc_ecmascript::ast::VarDeclKind,
|
||||
}
|
||||
|
||||
// TODO: change this function to return Vec<(String, VariableDef)> as single
|
||||
// var declaration can have multiple declarators
|
||||
pub fn get_doc_for_var_decl(
|
||||
var_decl: &swc_ecma_ast::VarDecl,
|
||||
var_decl: &swc_ecmascript::ast::VarDecl,
|
||||
) -> (String, VariableDef) {
|
||||
assert!(!var_decl.decls.is_empty());
|
||||
let var_declarator = var_decl.decls.get(0).unwrap();
|
||||
let var_name = match &var_declarator.name {
|
||||
swc_ecma_ast::Pat::Ident(ident) => ident.sym.to_string(),
|
||||
swc_ecmascript::ast::Pat::Ident(ident) => ident.sym.to_string(),
|
||||
_ => "<TODO>".to_string(),
|
||||
};
|
||||
|
||||
let maybe_ts_type = match &var_declarator.name {
|
||||
swc_ecma_ast::Pat::Ident(ident) => {
|
||||
swc_ecmascript::ast::Pat::Ident(ident) => {
|
||||
ident.type_ann.as_ref().map(|rt| ts_type_ann_to_def(rt))
|
||||
}
|
||||
_ => None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue