Skip to content

Commit cf3709e

Browse files
committed
refactor!: default to pascal case
1 parent aaa15af commit cf3709e

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ module.exports = {
8181

8282
## Usage
8383

84+
Use pascal case named exports in Vue SFC.
85+
8486
```ts
85-
import { myComponent } from './MyComponent.vue'
86-
import { myCard } from './my-card.vue'
87-
import { myFooter } from './my_footer.vue'
87+
import { MyComponent } from './MyComponent.vue'
88+
import { MyCard } from './my-card.vue'
89+
import { MyFooter } from './my_footer.vue'
8890
```
8991

9092
### Volar

src/core/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'node:path'
2-
import { camelCase } from 'change-case'
2+
import { pascalCase } from 'change-case'
33

44
export function resolveName(id: string) {
5-
return camelCase(path.basename(id, 'vue'))
5+
return pascalCase(path.basename(id, 'vue'))
66
}

tests/__snapshots__/basic.test.ts.snap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
1616
}
1717
});
1818
19-
const elCard = /* @__PURE__ */ _export_sfc(_sfc_main, [__FILE__]);
19+
const ElCard = /* @__PURE__ */ _export_sfc(_sfc_main, [__FILE__]);
2020
21-
export { elCard };
21+
export { ElCard };
2222
"
2323
`;
2424

@@ -35,9 +35,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
3535
}
3636
});
3737
38-
const upperCase = /* @__PURE__ */ _export_sfc(_sfc_main, [__FILE__]);
38+
const UpperCase = /* @__PURE__ */ _export_sfc(_sfc_main, [__FILE__]);
3939
40-
export { upperCase };
40+
export { UpperCase };
4141
"
4242
`;
4343

@@ -57,9 +57,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
5757
}
5858
});
5959
60-
const basic = /* @__PURE__ */ _export_sfc(_sfc_main, [__FILE__]);
60+
const Basic = /* @__PURE__ */ _export_sfc(_sfc_main, [__FILE__]);
6161
62-
export { basic };
62+
export { Basic };
6363
"
6464
`;
6565

@@ -79,9 +79,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
7979
}
8080
});
8181
82-
const elButton = /* @__PURE__ */ _export_sfc(_sfc_main, [__FILE__]);
82+
const ElButton = /* @__PURE__ */ _export_sfc(_sfc_main, [__FILE__]);
8383
84-
export { elButton };
84+
export { ElButton };
8585
"
8686
`;
8787

@@ -101,8 +101,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
101101
}
102102
});
103103
104-
const myButton = /* @__PURE__ */ _export_sfc(_sfc_main, [__FILE__]);
104+
const MyButton = /* @__PURE__ */ _export_sfc(_sfc_main, [__FILE__]);
105105
106-
export { myButton };
106+
export { MyButton };
107107
"
108108
`;

tests/fixtures/main.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export { basic } from './basic.vue'
2-
export { elCard } from './ElCard.vue'
3-
export { elButton } from './el-button.vue'
4-
export { myButton } from './my_button.vue'
5-
export { upperCase } from './UPPER-CASE.vue'
1+
export { Basic } from './basic.vue'
2+
export { ElCard } from './ElCard.vue'
3+
export { ElButton } from './el-button.vue'
4+
export { MyButton } from './my_button.vue'
5+
export { UpperCase } from './UPPER-CASE.vue'

0 commit comments

Comments
 (0)