diff --git a/tests/files/typescript-export-assign-object/index.ts b/tests/files/typescript-export-assign-object/index.ts new file mode 100644 index 0000000000..8899e3fbad --- /dev/null +++ b/tests/files/typescript-export-assign-object/index.ts @@ -0,0 +1,5 @@ +const someObj = { + FooBar: 12, +}; + +export = someObj; diff --git a/tests/files/typescript-export-assign-object/tsconfig.json b/tests/files/typescript-export-assign-object/tsconfig.json new file mode 100644 index 0000000000..ffe4e79f70 --- /dev/null +++ b/tests/files/typescript-export-assign-object/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "esModuleInterop": true + } +} \ No newline at end of file diff --git a/tests/src/rules/named.js b/tests/src/rules/named.js index 0361983979..aaa1e9c987 100644 --- a/tests/src/rules/named.js +++ b/tests/src/rules/named.js @@ -1,5 +1,6 @@ import { test, SYNTAX_CASES, getTSParsers, testFilePath, testVersion, parsers } from '../utils'; import { RuleTester } from 'eslint'; +import path from 'path'; import { CASE_SENSITIVE_FS } from 'eslint-module-utils/resolve'; @@ -388,7 +389,16 @@ context('TypeScript', function () { 'import/resolver': { 'eslint-import-resolver-typescript': true }, }; - let valid = []; + let valid = [ + test({ + code: `import x from './typescript-export-assign-object'`, + parser, + parserOptions: { + tsconfigRootDir: path.resolve(__dirname, '../../files/typescript-export-assign-object/'), + }, + settings, + }), + ]; const invalid = [ // TODO: uncomment this test // test({ @@ -400,6 +410,18 @@ context('TypeScript', function () { // { message: 'a not found in ./export-star-3/b' }, // ], // }), + test({ + code: `import { NotExported } from './typescript-export-assign-object'`, + parser, + parserOptions: { + tsconfigRootDir: path.resolve(__dirname, '../../files/typescript-export-assign-object/'), + }, + settings, + errors: [{ + message: `NotExported not found in './typescript-export-assign-object'`, + type: 'Identifier', + }], + }), ]; [