Skip to content

Commit

Permalink
commented out cases no longer needed for Espree. close #582
Browse files Browse the repository at this point in the history
  • Loading branch information
benmosher committed Sep 24, 2016
1 parent 095e5b1 commit e3c41ca
Showing 1 changed file with 48 additions and 52 deletions.
100 changes: 48 additions & 52 deletions tests/src/rules/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, SYNTAX_CASES } from '../utils'

import { RuleTester } from 'eslint'

var ruleTester = new RuleTester({ parser: 'babel-eslint' })
var ruleTester = new RuleTester()
, rule = require('rules/export')

ruleTester.run('export', rule, {
Expand Down Expand Up @@ -30,37 +30,37 @@ ruleTester.run('export', rule, {

invalid: [
// multiple defaults
test({
code: 'export default foo; export default bar',
errors: ['Multiple default exports.', 'Multiple default exports.'],
}),
test({
code: 'export default function foo() {}; ' +
'export default function bar() {}',
errors: ['Multiple default exports.', 'Multiple default exports.'],
}),
// test({
// code: 'export default foo; export default bar',
// errors: ['Multiple default exports.', 'Multiple default exports.'],
// }),
// test({
// code: 'export default function foo() {}; ' +
// 'export default function bar() {}',
// errors: ['Multiple default exports.', 'Multiple default exports.'],
// }),

test({
code: 'export function foo() {}; ' +
'export { bar as foo }',
errors: ["Multiple exports of name 'foo'.", "Multiple exports of name 'foo'."],
}),
test({
code: 'export {foo}; export {foo};',
errors: ["Multiple exports of name 'foo'.", "Multiple exports of name 'foo'."],
}),
test({
code: 'export {foo}; export {bar as foo};',
errors: ["Multiple exports of name 'foo'.", "Multiple exports of name 'foo'."],
}),
test({
code: 'export var foo = "foo"; export var foo = "bar";',
errors: ["Multiple exports of name 'foo'.", "Multiple exports of name 'foo'."],
}),
test({
code: 'export var foo = "foo", foo = "bar";',
errors: ["Multiple exports of name 'foo'.", "Multiple exports of name 'foo'."],
}),
// test({
// code: 'export function foo() {}; ' +
// 'export { bar as foo }',
// errors: ['Parsing error: Duplicate export \'foo\''],
// }),
// test({
// code: 'export {foo}; export {foo};',
// errors: ['Parsing error: Duplicate export \'foo\''],
// }),
// test({
// code: 'export {foo}; export {bar as foo};',
// errors: ['Parsing error: Duplicate export \'foo\''],
// }),
// test({
// code: 'export var foo = "foo"; export var foo = "bar";',
// errors: ['Parsing error: Duplicate export \'foo\''],
// }),
// test({
// code: 'export var foo = "foo", foo = "bar";',
// errors: ['Parsing error: Duplicate export \'foo\''],
// }),
test({
code: 'export { foo }; export * from "./export-all"',
errors: ['Multiple exports of name \'foo\'.',
Expand All @@ -76,31 +76,27 @@ ruleTester.run('export', rule, {
test({
code: 'export * from "./malformed.js"',
errors: [{
message: "Parse errors in imported module './malformed.js': Line 1: Unexpected token (1:12)",
message: "Parse errors in imported module './malformed.js': 'return' outside of function (1:1)",
type: 'Literal',
}],
}),

test({
code: 'export var { foo, bar } = object; export var foo = "bar"',
errors: ['Multiple exports of name \'foo\'.',
'Multiple exports of name \'foo\'.'],
}),
test({
code: 'export var { bar: { foo } } = object; export var foo = "bar"',
errors: ['Multiple exports of name \'foo\'.',
'Multiple exports of name \'foo\'.'],
}),
test({
code: 'export var [ foo, bar ] = array; export var bar = "baz"',
errors: ['Multiple exports of name \'bar\'.',
'Multiple exports of name \'bar\'.'],
}),
test({
code: 'export var [ foo, /*sparse*/, { bar } ] = array; export var bar = "baz"',
errors: ['Multiple exports of name \'bar\'.',
'Multiple exports of name \'bar\'.'],
}),
// test({
// code: 'export var { foo, bar } = object; export var foo = "bar"',
// errors: ['Parsing error: Duplicate export \'foo\''],
// }),
// test({
// code: 'export var { bar: { foo } } = object; export var foo = "bar"',
// errors: ['Parsing error: Duplicate export \'foo\''],
// }),
// test({
// code: 'export var [ foo, bar ] = array; export var bar = "baz"',
// errors: ['Parsing error: Duplicate export \'bar\''],
// }),
// test({
// code: 'export var [ foo, /*sparse*/, { bar } ] = array; export var bar = "baz"',
// errors: ['Parsing error: Duplicate export \'bar\''],
// }),


// #328: "export * from" does not export a default
Expand Down

2 comments on commit e3c41ca

@jfmengels
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a link to an issue or some explanation as to why these rules are commented?

And maybe we don't want to delete this rule, but we could delete the parts of the rule that are not needed anymore?

@benmosher
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all the parts are necessary for the re-export handling. It's only these trivial cases that have become parser errors.

Please sign in to comment.