diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 5f97971..0000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -dist -node_modules -examples \ No newline at end of file diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index c915d1e..0000000 --- a/.eslintrc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "root": true, - "env": { - "es2022": true, - "node": true - }, - "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], - "parser": "@typescript-eslint/parser", - "plugins": ["@typescript-eslint"], - "rules": { - "@typescript-eslint/no-explicit-any": 0, - "@typescript-eslint/no-non-null-assertion": 0, - "@typescript-eslint/ban-ts-comment": 0, - "no-mixed-spaces-and-tabs": 0 - } -} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35977c9..c3c7052 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,3 +34,6 @@ jobs: - name: Lint run: pnpm lint + + - name: Typecheck + run: pnpm typecheck diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..db4c6d9 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +dist +node_modules \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..3f4a615 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,10 @@ +{ + "printWidth": 80, + "tabWidth": 2, + "useTabs": false, + "semi": true, + "singleQuote": true, + "trailingComma": "all", + "bracketSpacing": true, + "arrowParens": "always" +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 5cc1fb1..97bef4c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,3 @@ { - "typescript.tsdk": "node_modules/typescript/lib", - "prettier.enable": false + "typescript.tsdk": "./node_modules/typescript/lib" } diff --git a/README.md b/README.md index d02ef31..1884570 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # unplugin-vue-source +[![CI](https://github.com/zjxxxxxxxxx/unplugin-vue-source/actions/workflows/ci.yml/badge.svg)](https://github.com/zjxxxxxxxxx/unplugin-vue-source/actions/workflows/ci.yml) +[![NPM version](https://img.shields.io/npm/v/unplugin-vue-source?color=)](https://www.npmjs.com/package/unplugin-vue-source) +[![MIT](https://img.shields.io/github/license/zjxxxxxxxxx/unplugin-vue-source)](https://opensource.org/licenses/MIT) + Add a \_\_source prop to all Elements. - 🌈 Supports `Vue2` and `Vue3`. @@ -34,7 +38,7 @@ with jsx without ```tsx -// src/App.vue +// src/App.tsx export default function App() { return
hello word
} @@ -43,9 +47,9 @@ export default function App() { with ```tsx -// src/App.vue +// src/App.tsx export default function App() { - return
hello word
+ return
hello word
} ``` diff --git a/examples/rollup/package.json b/examples/rollup/package.json index 166c236..fade07c 100644 --- a/examples/rollup/package.json +++ b/examples/rollup/package.json @@ -22,7 +22,7 @@ "rollup-plugin-svg": "^2.0.0", "typescript": "^2.2.0", "unplugin-vue-jsx": "^0.2.2", - "unplugin-vue-source": "workspace:*", + "unplugin-vue-source": "latest", "unplugin-vue2": "^0.1.1" } } diff --git a/examples/rollup/src/App.vue b/examples/rollup/src/App.vue index 546cd87..4793c97 100644 --- a/examples/rollup/src/App.vue +++ b/examples/rollup/src/App.vue @@ -1,12 +1,11 @@ diff --git a/examples/rollup/src/components/HelloWorld.tsx b/examples/rollup/src/components/HelloWorld.tsx index 15a7bea..a45ffa4 100644 --- a/examples/rollup/src/components/HelloWorld.tsx +++ b/examples/rollup/src/components/HelloWorld.tsx @@ -1,4 +1,4 @@ -import { defineComponent } from "vue"; +import { defineComponent } from 'vue'; export default defineComponent({ props: { msg: String }, @@ -7,11 +7,14 @@ export default defineComponent({

{this.msg}

- + Github

); }, -}) \ No newline at end of file +}); diff --git a/examples/rollup/src/main.ts b/examples/rollup/src/main.ts index cdee1f2..92f0811 100644 --- a/examples/rollup/src/main.ts +++ b/examples/rollup/src/main.ts @@ -1,11 +1,11 @@ -import Vue from "vue"; -import VueSource from "unplugin-vue-source/vue"; -import "./style.css"; -import App from "./App.vue"; +import Vue from 'vue'; +import VueSource from 'unplugin-vue-source/vue'; +import './style.css'; +import App from './App.vue'; Vue.use(VueSource); new Vue({ - el: "#root", + el: '#root', render: (h) => h(App), }); diff --git a/examples/vite/package.json b/examples/vite/package.json index 75a66c2..1fa976f 100644 --- a/examples/vite/package.json +++ b/examples/vite/package.json @@ -14,7 +14,7 @@ "@vitejs/plugin-vue": "^4.2.3", "typescript": "^5.0.2", "unplugin-vue-jsx": "^0.2.2", - "unplugin-vue-source": "workspace:*", + "unplugin-vue-source": "latest", "vite": "^4.4.5" } } diff --git a/examples/vite/src/App.vue b/examples/vite/src/App.vue index e408a33..f0b7ce2 100644 --- a/examples/vite/src/App.vue +++ b/examples/vite/src/App.vue @@ -1,5 +1,5 @@