Skip to content

Commit d327c35

Browse files
committed
Ignore type exports (ex. export type foo = string;) (fixes #47) [publish]
1 parent 7101b09 commit d327c35

4 files changed

+17
-1
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.4.11
4+
5+
- Ignore type exports (ex. `export type foo = string;`) (fixes #47)
6+
37
## 0.4.10
48

59
- Support `function Foo() {}; export default React.memo(Foo)` (#46) (thanks @SukkaW!)

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"name": "eslint-plugin-react-refresh",
3-
"version": "0.4.10",
3+
"version": "0.4.11",
44
"type": "module",
55
"license": "MIT",
66
"scripts": {
77
"build": "scripts/bundle.ts",
8+
"test": "bun test",
89
"lint": "bun lint-ci --fix --cache",
910
"lint-ci": "eslint ./ --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
1011
"prettier": "bun prettier-ci --write",

src/only-export-components.test.ts

+10
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ const valid = [
114114
code: "export type * from './module';",
115115
filename: "Test.tsx",
116116
},
117+
{
118+
name: "export type { foo }",
119+
code: "type foo = string; export const Foo = () => null; export type { foo };",
120+
filename: "Test.tsx",
121+
},
122+
{
123+
name: "export type foo",
124+
code: "export type foo = string; export const Foo = () => null;",
125+
filename: "Test.tsx",
126+
},
117127
{
118128
name: "Mixed export in JS without checkJS",
119129
code: "export const foo = () => {}; export const Bar = () => {};",

src/only-export-components.ts

+1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ export const onlyExportComponents: TSESLint.RuleModule<
214214
context.report({ messageId: "anonymousExport", node });
215215
}
216216
} else if (node.type === "ExportNamedDeclaration") {
217+
if (node.exportKind === "type") continue;
217218
hasExports = true;
218219
if (node.declaration) handleExportDeclaration(node.declaration);
219220
for (const specifier of node.specifiers) {

0 commit comments

Comments
 (0)