Skip to content

Instantly share code, notes, and snippets.

@tjbenton
Forked from caridy/export-syntax.js
Created October 12, 2015 18:59
Show Gist options
  • Select an option

  • Save tjbenton/d8802395b41ef0b8d73d to your computer and use it in GitHub Desktop.

Select an option

Save tjbenton/d8802395b41ef0b8d73d to your computer and use it in GitHub Desktop.

Revisions

  1. @caridy caridy revised this gist Sep 27, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion invalid-syntax.js
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@ export *;
    import {default as foo};
    // Missing from after import

    // import * from "foo";
    import * from "foo";
    // Missing as after import *'

    export default = 42;
  2. @caridy caridy revised this gist Sep 27, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion import-syntax.js
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ import {bar, baz} from "foo";
    import {bar as baz} from "foo";
    import {bar as baz, xyz} from "foo";

    // binding imports
    // glob imports
    import * as foo from "foo";

    // mixing imports
  3. @caridy caridy revised this gist Sep 27, 2014. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion invalid-syntax.js
    Original file line number Diff line number Diff line change
    @@ -38,4 +38,7 @@ import {default as foo};
    // Missing as after import *'

    export default = 42;
    // Unexpected token =
    // Unexpected token =

    import {bar as default} from "foo";
    // Unexpected token default
  4. @caridy caridy revised this gist Sep 27, 2014. 1 changed file with 28 additions and 1 deletion.
    29 changes: 28 additions & 1 deletion invalid-syntax.js
    Original file line number Diff line number Diff line change
    @@ -10,5 +10,32 @@ export function () {}
    export function default () {}
    // Unexpected token default

    import foo;
    // Missing from after import

    import { foo, bar };
    // Missing from after import

    import foo from bar;
    // Invalid module specifier

    import default from "foo";
    // Unexpected token default

    export default from "foo";
    // Unexpected token from

    export {default};
    // Missing FromClause
    // Missing from after export

    export *;
    // Missing from after export

    import {default as foo};
    // Missing from after import

    // import * from "foo";
    // Missing as after import *'

    export default = 42;
    // Unexpected token =
  5. @caridy caridy revised this gist Sep 27, 2014. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions invalid-syntax.js
    Original file line number Diff line number Diff line change
    @@ -2,13 +2,13 @@ export const bar;
    // const variables must have an initializer

    export foo;
    // Unexpected token identifier
    // Unexpected token identifier, invalid named export syntax

    export function () {}
    // Unexpected token (
    // Unexpected token (, use a function declaration instead

    export function default () {}
    // Unexpected token default

    export {default};
    // Unexpected token default
    // Missing FromClause
  6. @caridy caridy revised this gist Sep 27, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion export-syntax.js
    Original file line number Diff line number Diff line change
    @@ -32,4 +32,5 @@ export {foo, bar} from "foo";
    export {foo as bar} from "foo";
    export {foo as default} from "foo";
    export {foo as default, bar} from "foo";
    export {default} from "foo";
    export {default} from "foo";
    export {default as foo} from "foo";
  7. @caridy caridy revised this gist Sep 27, 2014. 3 changed files with 9 additions and 9 deletions.
    7 changes: 5 additions & 2 deletions export-syntax.js
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,12 @@
    // default exports
    export default 42;
    export default function () {}
    export default class {}
    export default {};
    export default [];
    export default foo;
    export default function () {}
    export default class {}
    export default function foo () {}
    export default class foo {}

    // variables exports
    export var foo = 1;
    7 changes: 4 additions & 3 deletions import-syntax.js
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,7 @@ import {bar as baz, xyz} from "foo";
    // binding imports
    import * as foo from "foo";

    // this module imports
    import {name} from this module;
    import * as m from this module;
    // mixing imports
    import foo, {baz as xyz} from "foo";
    import * as bar, {baz as xyz} from "foo";
    import foo, * as bar, {baz as xyz} from "foo";
    4 changes: 0 additions & 4 deletions invalid-syntax.js
    Original file line number Diff line number Diff line change
    @@ -7,10 +7,6 @@ export foo;
    export function () {}
    // Unexpected token (


    import foo from this module;
    // <no default export on this module>

    export function default () {}
    // Unexpected token default

  8. @caridy caridy revised this gist Sep 24, 2014. 2 changed files with 10 additions and 2 deletions.
    4 changes: 3 additions & 1 deletion export-syntax.js
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,7 @@ export default foo;

    // variables exports
    export var foo = 1;
    export var foo = function () {};
    export var bar; // lazy initialization
    export let foo = 2;
    export let bar; // lazy initialization
    @@ -27,4 +28,5 @@ export {foo} from "foo";
    export {foo, bar} from "foo";
    export {foo as bar} from "foo";
    export {foo as default} from "foo";
    export {foo as default, bar} from "foo";
    export {foo as default, bar} from "foo";
    export {default} from "foo";
    8 changes: 7 additions & 1 deletion invalid-syntax.js
    Original file line number Diff line number Diff line change
    @@ -9,4 +9,10 @@ export function () {}


    import foo from this module;
    // <no default export on this module>
    // <no default export on this module>

    export function default () {}
    // Unexpected token default

    export {default};
    // Unexpected token default
  9. @caridy caridy revised this gist Sep 24, 2014. 2 changed files with 10 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion export-syntax.js
    Original file line number Diff line number Diff line change
    @@ -19,4 +19,12 @@ export {foo};
    export {foo, bar};
    export {foo as bar};
    export {foo as default};
    export {foo as default, bar};
    export {foo as default, bar};

    // exports from
    export * from "foo";
    export {foo} from "foo";
    export {foo, bar} from "foo";
    export {foo as bar} from "foo";
    export {foo as default} from "foo";
    export {foo as default, bar} from "foo";
    1 change: 1 addition & 0 deletions import-syntax.js
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,7 @@ import {default as foo} from "foo";
    import {bar} from "foo";
    import {bar, baz} from "foo";
    import {bar as baz} from "foo";
    import {bar as baz, xyz} from "foo";

    // binding imports
    import * as foo from "foo";
  10. @caridy caridy revised this gist Sep 24, 2014. 3 changed files with 24 additions and 11 deletions.
    18 changes: 10 additions & 8 deletions export-syntax.js
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,22 @@
    // default exports
    export default 42;
    export default function () {}
    export default class {}
    export default {};
    export default foo;

    // variables exports
    export var foo = 1;
    export var bar; // lazy initialization
    export let foo = 2;
    export let bar; // lazy initialization
    export const foo = 3;

    export function foo () {}
    export class foo {}

    export default 42;
    export default function () {}
    export default class {}
    export default {};
    export default foo;

    // named exports
    export {foo};
    export {foo, bar};
    export {foo as bar};
    export {foo as default};
    export {foo as default, bar};
    export {foo as default, bar};
    11 changes: 9 additions & 2 deletions import-syntax.js
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,15 @@
    // default imports
    import foo from "foo";
    import {default as foo} from "foo";

    // named imports
    import {bar} from "foo";
    import {bar, baz} from "foo";
    import * as foo from "foo";
    import {bar as baz} from "foo";
    import name from this module;

    // binding imports
    import * as foo from "foo";

    // this module imports
    import {name} from this module;
    import * as m from this module;
    6 changes: 5 additions & 1 deletion invalid-syntax.js
    Original file line number Diff line number Diff line change
    @@ -5,4 +5,8 @@ export foo;
    // Unexpected token identifier

    export function () {}
    // Unexpected token (
    // Unexpected token (


    import foo from this module;
    // <no default export on this module>
  11. @caridy caridy revised this gist Sep 24, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion import-syntax.js
    Original file line number Diff line number Diff line change
    @@ -3,4 +3,6 @@ import {default as foo} from "foo";
    import {bar} from "foo";
    import {bar, baz} from "foo";
    import * as foo from "foo";
    import {bar as baz} from "foo";
    import {bar as baz} from "foo";
    import name from this module;
    import * as m from this module;
  12. @caridy caridy revised this gist Sep 24, 2014. 2 changed files with 6 additions and 1 deletion.
    1 change: 0 additions & 1 deletion export-syntax.js
    Original file line number Diff line number Diff line change
    @@ -18,4 +18,3 @@ export {foo, bar};
    export {foo as bar};
    export {foo as default};
    export {foo as default, bar};

    6 changes: 6 additions & 0 deletions import-syntax.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    import foo from "foo";
    import {default as foo} from "foo";
    import {bar} from "foo";
    import {bar, baz} from "foo";
    import * as foo from "foo";
    import {bar as baz} from "foo";
  13. @caridy caridy created this gist Sep 23, 2014.
    21 changes: 21 additions & 0 deletions export-syntax.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    export var foo = 1;
    export var bar; // lazy initialization
    export let foo = 2;
    export let bar; // lazy initialization
    export const foo = 3;

    export function foo () {}
    export class foo {}

    export default 42;
    export default function () {}
    export default class {}
    export default {};
    export default foo;

    export {foo};
    export {foo, bar};
    export {foo as bar};
    export {foo as default};
    export {foo as default, bar};

    8 changes: 8 additions & 0 deletions invalid-syntax.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    export const bar;
    // const variables must have an initializer

    export foo;
    // Unexpected token identifier

    export function () {}
    // Unexpected token (