-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Domain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbolFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
-
var mod = require('mod');=>- if
modis callable thenimport mod from 'mod' - else
modis not callable theimport { a, b } from "mod"and replacemod.aandmod.b - namespace import should ever be used?
- if
-
var mod= require('mod').a;=>import { a } from "mod"; -
const { a } = require('mod');=>import { a } from "mod"; -
if (__DEV__) { var warning = require('warning'); }- disallowed?
- have two actions? one sync and one async?
-
function f() { var warning = require('warning'); }=>async function f() { var warning = await import('warning'); }- maybe do nothing here as well
-
module.exports = EventPlugin;=>export default EventPlugin;
- fix imports in other files
- should we also fix
require("mod")torequire("mod").default?
-
module.exports.blah = 0=>export const blah = 0- should we support this too
var myModule = module.exports = exports = {}; myModule.a = 0; - this is another common pattern in CJS modules that we should consider supporting
- we already have handling for this in the binder in .js files
- should we support this too
-
module.exports = require('mod');=>export * from 'mod'; -
module.exports = {foo: function () { } ... }=>export function foo() {}?- is this even common enough to support?
Metadata
Metadata
Assignees
Labels
Domain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbolFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript