diff --git a/tests/src/core/importType.js b/tests/src/core/importType.js index abf9b9522..28c3c4ff7 100644 --- a/tests/src/core/importType.js +++ b/tests/src/core/importType.js @@ -90,16 +90,16 @@ describe('importType(name)', function () { }) it("should return 'external' for module from 'node_modules' with default config", function() { - expect(importType('builtin-modules', context)).to.equal('external') + expect(importType('resolve', context)).to.equal('external') }) it("should return 'internal' for module from 'node_modules' if 'node_modules' missed in 'external-module-folders'", function() { const foldersContext = testContext({ 'import/external-module-folders': [] }) - expect(importType('builtin-modules', foldersContext)).to.equal('internal') + expect(importType('resolve', foldersContext)).to.equal('internal') }) it("should return 'external' for module from 'node_modules' if 'node_modules' contained in 'external-module-folders'", function() { const foldersContext = testContext({ 'import/external-module-folders': ['node_modules'] }) - expect(importType('builtin-modules', foldersContext)).to.equal('external') + expect(importType('resolve', foldersContext)).to.equal('external') }) }) diff --git a/tests/src/rules/export.js b/tests/src/rules/export.js index 84598677d..33f012123 100644 --- a/tests/src/rules/export.js +++ b/tests/src/rules/export.js @@ -17,8 +17,8 @@ ruleTester.run('export', rule, { test({ code: 'export var [ foo, bar ] = array;' }), test({ code: 'export var { foo, bar } = object;' }), test({ code: 'export var [ foo, bar ] = array;' }), - test({ code: 'export { foo, foo as bar }' }), - test({ code: 'export { bar }; export * from "./export-all"' }), + test({ code: 'let foo; export { foo, foo as bar }' }), + test({ code: 'let bar; export { bar }; export * from "./export-all"' }), test({ code: 'export * from "./export-all"' }), test({ code: 'export * from "./does-not-exist"' }), @@ -62,7 +62,7 @@ ruleTester.run('export', rule, { // errors: ['Parsing error: Duplicate export \'foo\''], // }), test({ - code: 'export { foo }; export * from "./export-all"', + code: 'let foo; export { foo }; export * from "./export-all"', errors: ['Multiple exports of name \'foo\'.', 'Multiple exports of name \'foo\'.'], }), diff --git a/tests/src/rules/extensions.js b/tests/src/rules/extensions.js index 8b816daa9..d7b97bea0 100644 --- a/tests/src/rules/extensions.js +++ b/tests/src/rules/extensions.js @@ -105,14 +105,14 @@ ruleTester.run('extensions', rule, { test({ code: [ 'export { foo } from "./foo.js"', - 'export { bar }', + 'let bar; export { bar }', ].join('\n'), options: [ 'always' ], }), test({ code: [ 'export { foo } from "./foo"', - 'export { bar }', + 'let bar; export { bar }', ].join('\n'), options: [ 'never' ], }), @@ -334,7 +334,7 @@ ruleTester.run('extensions', rule, { test({ code: [ 'export { foo } from "./foo"', - 'export { bar }', + 'let bar; export { bar }', ].join('\n'), options: [ 'always' ], errors: [ @@ -348,7 +348,7 @@ ruleTester.run('extensions', rule, { test({ code: [ 'export { foo } from "./foo.js"', - 'export { bar }', + 'let bar; export { bar }', ].join('\n'), options: [ 'never' ], errors: [ diff --git a/tests/src/rules/named.js b/tests/src/rules/named.js index 92b3d9163..569f3158a 100644 --- a/tests/src/rules/named.js +++ b/tests/src/rules/named.js @@ -61,7 +61,7 @@ ruleTester.run('named', rule, { }), // regression tests - test({ code: 'export { foo as bar }'}), + test({ code: 'let foo; export { foo as bar }'}), // destructured exports test({ code: 'import { destructuredProp } from "./named-exports"' }), diff --git a/tests/src/rules/no-default-export.js b/tests/src/rules/no-default-export.js index 6440bfa89..5977ef19b 100644 --- a/tests/src/rules/no-default-export.js +++ b/tests/src/rules/no-default-export.js @@ -29,7 +29,7 @@ ruleTester.run('no-default-export', rule, { `, }), test({ - code: `export { foo, bar }`, + code: `let foo, bar; export { foo, bar }`, }), test({ code: `export const { foo, bar } = item;`, @@ -42,6 +42,7 @@ ruleTester.run('no-default-export', rule, { }), test({ code: ` + let item; export const foo = item; export { item }; `, @@ -102,7 +103,7 @@ ruleTester.run('no-default-export', rule, { }], }), test({ - code: 'export { foo as default }', + code: 'let foo; export { foo as default }', errors: [{ ruleId: 'ExportNamedDeclaration', message: 'Do not alias `foo` as `default`. Just export `foo` itself ' + diff --git a/tests/src/rules/no-named-export.js b/tests/src/rules/no-named-export.js index d8748d3f6..c56a13542 100644 --- a/tests/src/rules/no-named-export.js +++ b/tests/src/rules/no-named-export.js @@ -10,7 +10,7 @@ ruleTester.run('no-named-export', rule, { code: 'export default function bar() {};', }), test({ - code: 'export { foo as default }', + code: 'let foo; export { foo as default }', }), test({ code: 'export default from "foo.js"', @@ -82,7 +82,7 @@ ruleTester.run('no-named-export', rule, { }], }), test({ - code: `export { foo, bar }`, + code: `let foo, bar; export { foo, bar }`, errors: [{ ruleId: 'ExportNamedDeclaration', message: 'Named exports are not allowed.', @@ -111,6 +111,7 @@ ruleTester.run('no-named-export', rule, { }), test({ code: ` + let item; export const foo = item; export { item }; `, diff --git a/tests/src/rules/no-unresolved.js b/tests/src/rules/no-unresolved.js index 5b4f6ae53..9db6e1a5c 100644 --- a/tests/src/rules/no-unresolved.js +++ b/tests/src/rules/no-unresolved.js @@ -34,7 +34,7 @@ function runResolverTests(resolver) { rest({ code: 'export { foo } from "./bar"' }), rest({ code: 'export * from "./bar"' }), - rest({ code: 'export { foo }' }), + rest({ code: 'let foo; export { foo }' }), // stage 1 proposal for export symmetry, rest({ code: 'export * as bar from "./bar"' diff --git a/tests/src/rules/prefer-default-export.js b/tests/src/rules/prefer-default-export.js index 3a9145198..3a89c6aa7 100644 --- a/tests/src/rules/prefer-default-export.js +++ b/tests/src/rules/prefer-default-export.js @@ -28,6 +28,7 @@ ruleTester.run('prefer-default-export', rule, { }), test({ code: ` + let foo, bar; export { foo, bar }`, }), test({ @@ -44,11 +45,13 @@ ruleTester.run('prefer-default-export', rule, { }), test({ code: ` + let item; export const foo = item; export { item };`, }), test({ code: ` + let foo; export { foo as default }`, }), test({ diff --git a/tests/src/utils.js b/tests/src/utils.js index fe04d684e..52e2d23cd 100644 --- a/tests/src/utils.js +++ b/tests/src/utils.js @@ -43,8 +43,8 @@ export const SYNTAX_CASES = [ test({ code: 'const { x, y, ...z } = bar', parser: 'babel-eslint' }), // all the exports - test({ code: 'export { x }' }), - test({ code: 'export { x as y }' }), + test({ code: 'let x; export { x }' }), + test({ code: 'let x; export { x as y }' }), // not sure about these since they reference a file // test({ code: 'export { x } from "./y.js"'}),