Repository: eslint/eslint
File: tests/lib/rules/no-restricted-exports.js (JavaScript)

Code before:

        // reports "default" in named export declarations (when configured)
        {
            code: "var a; export { a as default };",
            options: [{ restrictedNamedExports: ["default"] }],
            errors: [{ messageId: "restrictedNamed", data: { name: "default" }, type: "Identifier", column: 22 }]
        },
        {
            code: "export { default } from 'foo';",
            options: [{ restrictedNamedExports: ["default"] }],
            errors: [{ messageId: "restrictedNamed", data: { name: "default" }, type: "Identifier", column: 10 }]
        },

        // restrictDefaultExports.direct option
        {
            code: "export default foo;",
            options: [{ restrictDefaultExports: { direct: true } }],
            errors: [{ messageId: "restrictedDefault", type: "ExportDefaultDeclaration", column: 1 }]
        },
        {
            code: "export default 42;",
            options: [{ restrictDefaultExports: { direct: true } }],
            errors: [{ messageId: "restrictedDefault", type: "ExportDefaultDeclaration", column: 1 }]
        },
        {
            code: "export default function foo() {};",
            options: [{ restrictDefaultExports: { direct: true } }],
            errors: [{ messageId: "restrictedDefault", type: "ExportDefaultDeclaration", column: 1 }]
        },
        {
            code: "export default foo;",
            options: [{ restrictedNamedExports: ["bar"], restrictDefaultExports: { direct: true } }],
            errors: [{ messageId: "restrictedDefault", type: "ExportDefaultDeclaration", column: 1 }]
        },

        // restrictDefaultExports.named option
        {
            code: "const foo = 123;\nexport { foo as default };",
            options: [{ restrictDefaultExports: { named: true } }],
            errors: [{ messageId: "restrictedDefault", type: "Identifier", line: 2, column: 17 }]
        },

        // restrictDefaultExports.defaultFrom option
        {
            code: "export { default } from 'mod';",
            options: [{ restrictDefaultExports: { defaultFrom: true } }],
            errors: [{ messageId: "restrictedDefault", type: "Identifier", line: 1, column: 10 }]
        },
        {
            code: "export { default as default } from 'mod';",
            options: [{ restrictDefaultExports: { defaultFrom: true } }],

Review comment (suggestion):
```suggestion
            code: "export default function foo() {}",
```

Code after:

        // reports "default" in named export declarations (when configured)
        {
            code: "var a; export { a as default };",
            options: [{ restrictedNamedExports: ["default"] }],
            errors: [{ messageId: "restrictedNamed", data: { name: "default" }, type: "Identifier", column: 22 }]
        },
        {
            code: "export { default } from 'foo';",
            options: [{ restrictedNamedExports: ["default"] }],
            errors: [{ messageId: "restrictedNamed", data: { name: "default" }, type: "Identifier", column: 10 }]
        },

        // restrictDefaultExports.direct option
        {
            code: "export default foo;",
            options: [{ restrictDefaultExports: { direct: true } }],
            errors: [{ messageId: "restrictedDefault", type: "ExportDefaultDeclaration", column: 1 }]
        },
        {
            code: "export default 42;",
            options: [{ restrictDefaultExports: { direct: true } }],
            errors: [{ messageId: "restrictedDefault", type: "ExportDefaultDeclaration", column: 1 }]
        },
        {
            code: "export default function foo() {}",
            options: [{ restrictDefaultExports: { direct: true } }],
            errors: [{ messageId: "restrictedDefault", type: "ExportDefaultDeclaration", column: 1 }]
        },
        {
            code: "export default foo;",
            options: [{ restrictedNamedExports: ["bar"], restrictDefaultExports: { direct: true } }],
            errors: [{ messageId: "restrictedDefault", type: "ExportDefaultDeclaration", column: 1 }]
        },

        // restrictDefaultExports.named option
        {
            code: "const foo = 123;\nexport { foo as default };",
            options: [{ restrictDefaultExports: { named: true } }],
            errors: [{ messageId: "restrictedDefault", type: "Identifier", line: 2, column: 17 }]
        },

        // restrictDefaultExports.defaultFrom option
        {
            code: "export { default } from 'mod';",
            options: [{ restrictDefaultExports: { defaultFrom: true } }],
            errors: [{ messageId: "restrictedDefault", type: "Identifier", line: 1, column: 10 }]
        },
        {
            code: "export { default as default } from 'mod';",
            options: [{ restrictDefaultExports: { defaultFrom: true } }],