Skip to content

Commit

Permalink
feature: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiniarski committed Jul 3, 2024
1 parent 0e6ea56 commit 9cca135
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 1 addition & 5 deletions docs/rules/define-props-declaration.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,13 @@ const props = defineProps({
```json
{
"vue/define-props-declaration": ["error",
"type-based" | "runtime",
{
"autoFixToSeparateInterface": false
}
"type-based" | "runtime"
]
}
```

- `type-based` (default) enforces type-based declaration
- `runtime` enforces runtime declaration
- `autoFixToSeparateInterface` (`boolean`) define `interface Props` used for type-based declaration instead of providing types inline

### `"runtime"`

Expand Down
9 changes: 4 additions & 5 deletions lib/rules/define-props-declaration.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

const utils = require('../utils')

/**
* @typedef {import('../utils').ComponentProp} ComponentProp
*/

const PROPS_SEPARATOR = ', '

/**
Expand Down Expand Up @@ -125,7 +129,6 @@ function optionGetType(node, sourceCode) {
case 'ArrayExpression': {
return node.elements
.map((element) => {
// TODO handle SpreadElement
if (element === null || element.type === 'SpreadElement') {
return sourceCode.getText(node)
}
Expand Down Expand Up @@ -211,10 +214,6 @@ function optionGetDefault(node) {
return undefined
}

/**
* @typedef {import('../utils').ComponentProp} ComponentProp
*/

module.exports = {
meta: {
type: 'suggestion',
Expand Down

0 comments on commit 9cca135

Please sign in to comment.