Skip to content

Commit 35cfa85

Browse files
committed
Ignore export type * (fixes #12)
1 parent add5efb commit 35cfa85

6 files changed

+70
-165
lines changed

CHANGELOG.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
- Ignore `export type *` (fixes #12)
6+
37
## 0.4.0
48

59
### Add `allowConstantExport` option (fixes #8)
610

7-
This option allow tp don't warn when a constant (string, number, boolean, templateLiteral) is exported aside one or more components.
11+
This option allow to don't warn when a constant (string, number, boolean, templateLiteral) is exported aside one or more components.
812

9-
This should be enabled if the fast refresh implementation correctly handles this case (HMR when the constant doesn't change, propagate update to importers when the constant changes.). Vite supports it, PR welcome if you notice other integrations works well.
13+
This should be enabled if the fast refresh implementation correctly handles this case (HMR when the constant doesn't change, propagate update to importers when the constant changes). Vite supports it, PR welcome if you notice other integrations works well.
1014

1115
### Allow all-uppercase function exports (fixes #11)
1216

bun.lockb

-3.22 KB
Binary file not shown.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"build": "scripts/bundle.ts",
77
"prettier": "bun prettier-ci --write",
88
"prettier-ci": "prettier --ignore-path=.gitignore --check '**/*.{ts,json,md,yml}'",
9-
"test": "src/tests.ts",
109
"ci": "tsc && bun prettier-ci && bun test && bun run build"
1110
},
1211
"prettier": {
@@ -19,6 +18,7 @@
1918
"@nabla/tnode": "^0.9.0",
2019
"@types/eslint": "^8.37.0",
2120
"@types/node": "^18.16.3",
21+
"@typescript-eslint/parser": "^5.59.2",
2222
"@typescript-eslint/utils": "^5.59.1",
2323
"bun-types": "^0.5.8",
2424
"eslint": "^8.39.0",

src/only-export-components.test.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import { RuleTester } from "eslint";
44
import { onlyExportComponents } from "./only-export-components.ts";
55

66
const ruleTester = new RuleTester({
7+
parser: require.resolve("@typescript-eslint/parser"),
78
parserOptions: {
89
sourceType: "module",
9-
ecmaVersion: 2018,
10+
ecmaVersion: 2022,
1011
ecmaFeatures: { jsx: true },
1112
},
1213
});
@@ -76,6 +77,11 @@ const valid = [
7677
name: "Direct export default AF",
7778
code: "export default function foo () {};",
7879
},
80+
{
81+
name: "export type *",
82+
code: "export type * from './module';",
83+
filename: "Test.tsx",
84+
},
7985
{
8086
name: "Mixed export in JS without checkJS",
8187
code: "export const foo = () => {}; export const Bar = () => {};",

src/only-export-components.ts

+1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export const onlyExportComponents: TSESLint.RuleModule<
132132

133133
for (const node of program.body) {
134134
if (node.type === "ExportAllDeclaration") {
135+
if (node.exportKind === "type") continue;
135136
hasExports = true;
136137
context.report({ messageId: "exportAll", node });
137138
} else if (node.type === "ExportDefaultDeclaration") {

0 commit comments

Comments
 (0)