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 25, 2018
1 parent f528f60 commit c4dd0a1
Showing 1 changed file with 8 additions and 32 deletions.
40 changes: 8 additions & 32 deletions tests/src/rules/newline-after-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,12 @@ ruleTester.run('newline-after-import', require('rules/newline-after-import'), {
parser: 'babel-eslint',
},
{
code : `// issue 1004
import foo from 'foo';\n
@SomeDecorator(foo)
export default class Test {}
`,
code : `// issue 1004\nimport foo from 'foo';\n\n@SomeDecorator(foo)\nexport default class Test {}`,
parserOptions: { sourceType: 'module' },
parser: 'babel-eslint',
},
{
code : `// issue 1004
const foo = require('foo');\n
@SomeDecorator(foo)
export default class Test {}
`,
code : `// issue 1004\nconst foo = require('foo');\n\n@SomeDecorator(foo)\nexport default class Test {}`,
parserOptions: { sourceType: 'module' },
parser: 'babel-eslint',
},
Expand Down Expand Up @@ -368,38 +360,22 @@ ruleTester.run('newline-after-import', require('rules/newline-after-import'), {
parser: 'babel-eslint',
},
{
code: `// issue 10042
import foo from 'foo';
@SomeDecorator(foo)
export default class Test {}
`,
output: `// issue 10042
import foo from 'foo';\n
@SomeDecorator(foo)
export default class Test {}
`,
code: `// issue 10042\nimport foo from 'foo';\n@SomeDecorator(foo)\nexport default class Test {}`,
output: `// issue 10042\nimport foo from 'foo';\n\n@SomeDecorator(foo)\nexport default class Test {}`,
errors: [ {
line: 2,
column: 9,
column: 1,
message: IMPORT_ERROR_MESSAGE,
} ],
parserOptions: { sourceType: 'module' },
parser: 'babel-eslint',
},
{
code: `// issue 1004
const foo = require('foo');
@SomeDecorator(foo)
export default class Test {}
`,
output: `// issue 1004
const foo = require('foo');\n
@SomeDecorator(foo)
export default class Test {}
`,
code: `// issue 1004\nconst foo = require('foo');\n@SomeDecorator(foo)\nexport default class Test {}`,
output: `// issue 1004\nconst foo = require('foo');\n\n@SomeDecorator(foo)\nexport default class Test {}`,
errors: [ {
line: 2,
column: 9,
column: 1,
message: REQUIRE_ERROR_MESSAGE,
} ],
parserOptions: { sourceType: 'module' },
Expand Down

0 comments on commit c4dd0a1

Please sign in to comment.