Closed
Description
ignoreDeprecations
in TS 4.9
importsNotUsedAsValues
andpreserveValueImports
are deprecated in favor ofverbatimModuleSyntax
- 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
- 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
- ESLint doesn't tie-break sorting well - i.e. if you import
hasDecorators
andHasDecorators
, 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 didtoLowercase
for case insensitivity. - Noticeable for ASCII characters in between - namely the underscore (
_
)
- They used
- Organize imports collation #52115
- Uses
Intl.Collator
to do sorting if desired. - Compatible with
eslint-plugin-simple-import-sort
.
- Uses
- 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(?)