Skip to content

Commit

Permalink
Fix #1004 newline-after-import not recognizing decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
Averin Anton committed Jul 18, 2018
1 parent 950bff3 commit c72c96a
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/src/rules/newline-after-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,24 @@ ruleTester.run('newline-after-import', require('rules/newline-after-import'), {
parserOptions: { sourceType: 'module' },
parser: 'babel-eslint',
},
{
code : `// issue 1004
import foo from 'foo';\n
@SomeDecorator(foo)
export default class Test {}
`,
parserOptions: { sourceType: 'module' },
parser: 'babel-eslint',
},
{
code : `// issue 1004
const foo = require('foo');\n
@SomeDecorator(foo)
export default class Test {}
`,
parserOptions: { sourceType: 'module' },
parser: 'babel-eslint',
},
],

invalid: [
Expand Down Expand Up @@ -349,5 +367,33 @@ ruleTester.run('newline-after-import', require('rules/newline-after-import'), {
parserOptions: { sourceType: 'module' },
parser: 'babel-eslint',
},
{
code : `// issue 10042
import foo from 'foo';
@SomeDecorator(foo)
export default class Test {}
`,
errors: [ {
line: 2,
column: 9,
message: IMPORT_ERROR_MESSAGE,
} ],
parserOptions: { sourceType: 'module' },
parser: 'babel-eslint',
},
{
code : `// issue 1004
const foo = require('foo');
@SomeDecorator(foo)
export default class Test {}
`,
errors: [ {
line: 2,
column: 9,
message: REQUIRE_ERROR_MESSAGE,
} ],
parserOptions: { sourceType: 'module' },
parser: 'babel-eslint',
},
],
})

0 comments on commit c72c96a

Please sign in to comment.