Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Correct + add test for suspense and teleport
  • Loading branch information
jesusgn90 committed May 9, 2020
commit 68db54ad1115b6b2ee0667b08b08c9169b981cdb
8 changes: 4 additions & 4 deletions lib/rules/no-unregistered-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ const casing = require('eslint-plugin-vue/lib/utils/casing')
* @returns {boolean} `true` if the node is a built-in component.
*/
const isBuiltInComponent = (node) => {
const rawName = node && node.rawName.toLowerCase()
return utils.isHtmlElementNode(node) &&
!utils.isHtmlWellKnownElementName(node.rawName) &&
node &&
(node.rawName === 'component' ||
node.rawName === 'suspense' ||
node.rawName === 'teleport')
(rawName === 'component' ||
rawName === 'suspense' ||
rawName === 'teleport')
}

// ------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "lib/index.js",
"scripts": {
"start": "npm run test:base -- --watch --growl",
"test:base": "mocha \"tests/lib/**/*.js\" --reporter dot",
"test:base": "mocha \"tests/lib/**/no-unregistered-components.js\" --reporter dot",
"test": "nyc npm run test:base -- \"tests/integrations/*.js\" --timeout 60000",
"debug": "mocha --inspect-brk \"tests/lib/**/*.js\" --reporter dot --timeout 60000",
"cover:report": "nyc report --reporter=html",
Expand Down
17 changes: 17 additions & 0 deletions tests/lib/rules/no-unregistered-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,23 @@ tester.run('no-unregistered-components', rule, {
}
</script>
`
},
{
filename: 'test.vue',
code: `
<template>
<teleport />
<suspense />
<suspense>
<div>Text</div>
</suspense>
<Teleport />
<Suspense />
<Suspense>
<div>Text</div>
</Suspense>
</template>
`
}
],
invalid: [
Expand Down