Skip to content

Design Meeting Notes, 1/25/2023 #52469

Closed
Closed
@DanielRosenwasser

Description

@DanielRosenwasser

ignoreDeprecations in TS 4.9

#51909

  • importsNotUsedAsValues and preserveValueImports are deprecated in favor of verbatimModuleSyntax
  • You're supposed to use the ignoreDeprecations flag to temporarily disable this as you migrate off the flags.
  • Can't make a tsconfig.json that works for both 4.9 and 5.0.
  • Nice to be able to let a team move over incrementally.
  • Want to bring ignoreDeprecations back to 4.9
    • Helps with editor scenarios too while VS Code still ships 4.9.

Moving from barrel imports in our codebase

#51455
#51590

  • In our migration to modules, we use barrel imports to keep things simple-ish, keep initialization order.
  • Big task, but @a-tarasyuk took it on.
  • Had to resolve issues with cycles, seems like it's fine.
    • Gives some benefits that now some tools can analyze our codebase to detect cycles.
  • Makes moving code around harder.
    • But that is an empathy gap between us an our users.
    • We should think about editor features to help here in 5.1
    • Also, would be nice if we could detect cycles in some way.
  • Some instances where we still use (ts as any).Yadda for preserved const enums.
  • By explicitly declaring what the parser imports from, other tools can more-easily tree shake from us.
  • Also Use ESM for our executables (tsc, tsserver, typingsInstaller) #51440
    • Previously, these attempts ran into crashes due to circularities.
    • Fixing the cycles would allow many of these to operate correctly.
  • So Convert debug namespace into a module, direct import #51455
    • Seems uncontroversial.
  • Use ESM for our executables (tsc, tsserver, typingsInstaller) #51440
    • Something to be said about flat files.
    • Would be nice to ship an ESM version
  • Moving to direct imports?
    • Seems okay.

Import Sorting

#52090

  • ESLint doesn't tie-break sorting well - i.e. if you import hasDecorators and HasDecorators, the two might flip.
    • So it's not a stable sort!?
    • No.
  • We made more internationally-sensitive changes in Add option for organize imports case sensitivity #51733.
    • Compatible with what? ESLint doesn't give deterministic (or is it stable?) sorting, we do.
    • Based on eslint/sort-imports.
      • They used toUppercase, we did toLowercase for case insensitivity.
      • Noticeable for ASCII characters in between - namely the underscore (_)
  • Organize imports collation #52115
    • Uses Intl.Collator to do sorting if desired.
    • Compatible with eslint-plugin-simple-import-sort.
  • Does Prettier do import sorting?
    • No.
    • Thankfully. Don't need 30 tools fighting with each other. 😅
  • dprint does if you want, and it's compatible!
  • Sounds like we have good-enough coverage to say "we support all of them."
  • So okay with changing our repo to new linter options?
    • Seems fine.
  • Aside: need to copy settings over for auto-imports(?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design NotesNotes from our design meetings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions