Skip to content

Commit

Permalink
added (passing) tests with correct parser options for #416
Browse files Browse the repository at this point in the history
  • Loading branch information
benmosher committed Jul 5, 2016
1 parent 49b3531 commit babfb9f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"gulp-mocha": "^2.2.0",
"istanbul": "^0.4.0",
"mocha": "^2.2.1",
"react-mdl": "1.6.0",
"redux": "^3.0.4",
"rimraf": "2.5.2"
},
Expand Down
17 changes: 17 additions & 0 deletions tests/src/rules/named.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ ruleTester.run('named', rule, {
settings: { 'import/ignore': ['common'] },
}),

// issue #416
test({
code: `
import {
Navigation,
Drawer,
Layout,
Content,
Header,
} from 'react-mdl'`,
parserOptions: {
sourceType: 'module',
ecmaVersion: 6,
ecmaFeatures: { experimentalObjectRestSpread: true, jsx: true },
},
}),

...SYNTAX_CASES,
],

Expand Down
28 changes: 28 additions & 0 deletions tests/src/rules/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,38 @@ const valid = [
parser: 'babel-eslint',
}),

// issue #416.
test({
code: `
import * as ReactMDL from 'react-mdl';
let Navigation = ReactMDL.Navigation;
let Drawer = ReactMDL.Drawer;
let Layout = ReactMDL.Layout;
let Content = ReactMDL.Content;
let Header = ReactMDL.Content;`,
parserOptions: {
sourceType: 'module',
ecmaVersion: 6,
ecmaFeatures: { experimentalObjectRestSpread: true, jsx: true },
},
}),

...SYNTAX_CASES,
]

const invalid = [

// issue #416: todo: proper parse error
// test({
// code: `
// import * as ReactMDL from 'react-mdl';
// let Navigation = ReactMDL.Navigation;
// let Drawer = ReactMDL.Drawer;
// let Layout = ReactMDL.Layout;
// let Content = ReactMDL.Content;
// let Header = ReactMDL.Content;`,
// }),

test({code: "import * as foo from './common';",
errors: ["No exported names found in module './common'."]}),

Expand Down

0 comments on commit babfb9f

Please sign in to comment.