Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/files/typescript-export-assign-object/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const someObj = {
FooBar: 12,
};

export = someObj;
5 changes: 5 additions & 0 deletions tests/files/typescript-export-assign-object/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"esModuleInterop": true
}
}
37 changes: 36 additions & 1 deletion tests/src/rules/named.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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({
Expand All @@ -400,6 +410,31 @@ 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',
}],
}),
test({
// `export =` syntax creates a default export only
code: `import { FooBar } from './typescript-export-assign-object'`,
parser,
parserOptions: {
tsconfigRootDir: path.resolve(__dirname, '../../files/typescript-export-assign-object/'),
},
settings,
errors: [{
message: `FooBar not found in './typescript-export-assign-object'`,
type: 'Identifier',
}],
}),
];

[
Expand Down