Skip to content

Commit ba4b9b7

Browse files
feat: convert SFC to normal js file
Was unnecessary because the component is functional. Also provides easier import!
1 parent cd17cdc commit ba4b9b7

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

.eslintrc.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ module.exports = {
1010
},
1111
extends: 'standard',
1212
plugins: [
13-
'jest',
14-
'vue'
13+
'jest'
1514
],
1615
rules: {
1716
// Allow paren-less arrow functions

lib/VueLink.vue lib/index.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
<script>
21
export default {
32
functional: true,
43
render (h, { data, children, props }) {
5-
64
// If no to is set, treat as "external" to remove "link style" and bindings.
75
// Quite useful if you want to bind a link dynamically and don't want to have it clicked and styled when not bound
8-
const isExternal = props => !props.to
9-
|| props.to.startsWith('http')
10-
|| props.external
6+
const isExternal = props => !props.to ||
7+
props.to.startsWith('http') ||
8+
props.external
119

1210
return isExternal(props)
1311
? h('a', {
@@ -21,4 +19,3 @@ export default {
2119
: h('router-link', data, children)
2220
}
2321
}
24-
</script>

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "One component to link them all!",
55
"author": "Alexander Lichter <[email protected]>",
66
"license": "MIT",
7-
"main": "lib/VueLink.vue",
7+
"main": "lib/index.js",
88
"repository": {
99
"type": "git",
1010
"url": "git+https://github.com/Developmint/vue-link"
@@ -77,7 +77,6 @@
7777
"eslint-plugin-node": "^6.0.1",
7878
"eslint-plugin-promise": "^3.7.0",
7979
"eslint-plugin-standard": "^3.1.0",
80-
"eslint-plugin-vue": "latest",
8180
"flush-promises": "^1.0.0",
8281
"husky": "^1.0.0-rc.2",
8382
"jest": "latest",

test/VueLink.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-console */
22
import { createLocalVue, mount, RouterLinkStub } from '@vue/test-utils'
33
import VueRouter from 'vue-router'
4-
import VueLink from '@/VueLink'
4+
import VueLink from '../lib'
55

66
const localVue = createLocalVue()
77
localVue.use(VueRouter)

0 commit comments

Comments
 (0)