•  
      request #19300 Enforce @typescript-eslint/consistent-type-imports
    Infos
    #19300
    Joris MASSON (jmasson)
    2021-02-12 16:11
    2021-02-12 12:30
    20871
    Details
    Enforce @typescript-eslint/consistent-type-imports

    Starting from TypeScript 3.8, new syntax import type and export type have been added. TypeScript analyses types for "the whole project" at once, but other tools such as Babel work on a single file at a time. When regular structures such as const, function, class are imported at the same time as types, those tools cannot distinguish between them, and so they might report an error because we are importing something that does not exist at runtime (a type). From time to time there are already warnings raised when running npm run watch in various parts of Tuleap.

    There is an eslint rule that enforces separating types from other imports. import type can always be ignored by tools that do not care about typings such as minifiers and transpilers. See the rule documentation: @typescript-eslint/consistent-type-imports

    Fortunately, this rule is also auto-fixable (run make eslint-fix)

    [0] https://www.typescriptlang.org/docs/handbook/modules.html#importing-types

    Dev tools
    Empty
    Empty
    • [ ] enhancement
    • [x] internal improvement
    Empty
    Stage
    Joris MASSON (jmasson)
    Closed
    2021-02-12
    Attachments
    Empty
    References

    Follow-ups

    User avatar
    Thomas Gerbet (tgerbet)2021-02-12 13:09
    Both contributions have been merged (Tuleap 12.5.99.78).

    • Status changed from Under review to Closed
    • Connected artifacts
    • Close date set to 2021-02-12
    User avatar
    Joris MASSON (jmasson)2021-02-12 12:31
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes
    User avatar
    Joris MASSON (jmasson)2021-02-12 12:30
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes