-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2e68d0
commit 5293ec4
Showing
13 changed files
with
468 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { PrettierOptions } from '../types'; | ||
import { preprocessor } from './preprocessor'; | ||
|
||
export function defaultPreprocessor(code: string, options: PrettierOptions) { | ||
if (options.filepath?.endsWith('.vue')) return code; | ||
return preprocessor(code, options); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { parse } from '@vue/compiler-sfc'; | ||
|
||
import { PrettierOptions } from '../types'; | ||
import { preprocessor } from './preprocessor'; | ||
|
||
export function vuePreprocessor(code: string, options: PrettierOptions) { | ||
const { descriptor } = parse(code); | ||
const content = | ||
(descriptor.script ?? descriptor.scriptSetup)?.content ?? code; | ||
|
||
return code.replace(content, `\n${preprocessor(content, options)}\n`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,229 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`setup.vue - vue-verify: setup.vue 1`] = ` | ||
<script setup> | ||
// I am top level comment in this file. | ||
import z from 'z'; | ||
import threeLevelRelativePath from "../../../threeLevelRelativePath"; | ||
import sameLevelRelativePath from "./sameLevelRelativePath"; | ||
import thirdParty from "third-party"; | ||
import oneLevelRelativePath from "../oneLevelRelativePath"; | ||
import otherthing from "@core/otherthing"; | ||
import abc from "@core/abc"; | ||
import twoLevelRelativePath from "../../twoLevelRelativePath"; | ||
import component from "@ui/hello"; | ||
import fourLevelRelativePath from "../../../../fourLevelRelativePath"; | ||
import something from "@server/something"; | ||
import xyz from "@ui/xyz"; | ||
import { defineComponent } from 'vue' | ||
function add(a,b) { | ||
return a + b; | ||
} | ||
</script> | ||
<template> | ||
<div></div> | ||
</template> | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
<script setup> | ||
// I am top level comment in this file. | ||
import thirdParty from "third-party"; | ||
import { defineComponent } from "vue"; | ||
import z from "z"; | ||
import abc from "@core/abc"; | ||
import otherthing from "@core/otherthing"; | ||
import something from "@server/something"; | ||
import component from "@ui/hello"; | ||
import xyz from "@ui/xyz"; | ||
import fourLevelRelativePath from "../../../../fourLevelRelativePath"; | ||
import threeLevelRelativePath from "../../../threeLevelRelativePath"; | ||
import twoLevelRelativePath from "../../twoLevelRelativePath"; | ||
import oneLevelRelativePath from "../oneLevelRelativePath"; | ||
import sameLevelRelativePath from "./sameLevelRelativePath"; | ||
function add(a, b) { | ||
return a + b; | ||
} | ||
</script> | ||
<template> | ||
<div></div> | ||
</template> | ||
`; | ||
|
||
exports[`sfc.vue - vue-verify: sfc.vue 1`] = ` | ||
<script> | ||
// I am top level comment in this file. | ||
import z from 'z'; | ||
import threeLevelRelativePath from "../../../threeLevelRelativePath"; | ||
import sameLevelRelativePath from "./sameLevelRelativePath"; | ||
import thirdParty from "third-party"; | ||
import oneLevelRelativePath from "../oneLevelRelativePath"; | ||
import otherthing from "@core/otherthing"; | ||
import abc from "@core/abc"; | ||
import twoLevelRelativePath from "../../twoLevelRelativePath"; | ||
import component from "@ui/hello"; | ||
import fourLevelRelativePath from "../../../../fourLevelRelativePath"; | ||
import something from "@server/something"; | ||
import xyz from "@ui/xyz"; | ||
import { defineComponent } from 'vue'; | ||
function add(a,b) { | ||
return a + b; | ||
} | ||
export default defineComponent({ | ||
}) | ||
</script> | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
<script> | ||
// I am top level comment in this file. | ||
import thirdParty from "third-party"; | ||
import { defineComponent } from "vue"; | ||
import z from "z"; | ||
import abc from "@core/abc"; | ||
import otherthing from "@core/otherthing"; | ||
import something from "@server/something"; | ||
import component from "@ui/hello"; | ||
import xyz from "@ui/xyz"; | ||
import fourLevelRelativePath from "../../../../fourLevelRelativePath"; | ||
import threeLevelRelativePath from "../../../threeLevelRelativePath"; | ||
import twoLevelRelativePath from "../../twoLevelRelativePath"; | ||
import oneLevelRelativePath from "../oneLevelRelativePath"; | ||
import sameLevelRelativePath from "./sameLevelRelativePath"; | ||
function add(a, b) { | ||
return a + b; | ||
} | ||
export default defineComponent({}); | ||
</script> | ||
`; | ||
|
||
exports[`ts.vue - vue-verify: ts.vue 1`] = ` | ||
<script lang="ts"> | ||
// I am top level comment in this file. | ||
import z from 'z'; | ||
import threeLevelRelativePath from "../../../threeLevelRelativePath"; | ||
import sameLevelRelativePath from "./sameLevelRelativePath"; | ||
import thirdParty from "third-party"; | ||
import oneLevelRelativePath from "../oneLevelRelativePath"; | ||
import otherthing from "@core/otherthing"; | ||
import abc from "@core/abc"; | ||
import twoLevelRelativePath from "../../twoLevelRelativePath"; | ||
import component from "@ui/hello"; | ||
import fourLevelRelativePath from "../../../../fourLevelRelativePath"; | ||
import something from "@server/something"; | ||
import xyz from "@ui/xyz"; | ||
import { defineComponent } from 'vue'; | ||
function add(a,b) { | ||
return a + b; | ||
} | ||
export default defineComponent({ | ||
}) | ||
</script> | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
<script lang="ts"> | ||
// I am top level comment in this file. | ||
import thirdParty from "third-party"; | ||
import { defineComponent } from "vue"; | ||
import z from "z"; | ||
import abc from "@core/abc"; | ||
import otherthing from "@core/otherthing"; | ||
import something from "@server/something"; | ||
import component from "@ui/hello"; | ||
import xyz from "@ui/xyz"; | ||
import fourLevelRelativePath from "../../../../fourLevelRelativePath"; | ||
import threeLevelRelativePath from "../../../threeLevelRelativePath"; | ||
import twoLevelRelativePath from "../../twoLevelRelativePath"; | ||
import oneLevelRelativePath from "../oneLevelRelativePath"; | ||
import sameLevelRelativePath from "./sameLevelRelativePath"; | ||
function add(a, b) { | ||
return a + b; | ||
} | ||
export default defineComponent({}); | ||
</script> | ||
`; | ||
|
||
exports[`tsx.vue - vue-verify: tsx.vue 1`] = ` | ||
<script lang="tsx"> | ||
// I am top level comment in this file. | ||
import z from 'z'; | ||
import threeLevelRelativePath from "../../../threeLevelRelativePath"; | ||
import sameLevelRelativePath from "./sameLevelRelativePath"; | ||
import thirdParty from "third-party"; | ||
import oneLevelRelativePath from "../oneLevelRelativePath"; | ||
import otherthing from "@core/otherthing"; | ||
import abc from "@core/abc"; | ||
import twoLevelRelativePath from "../../twoLevelRelativePath"; | ||
import component from "@ui/hello"; | ||
import fourLevelRelativePath from "../../../../fourLevelRelativePath"; | ||
import something from "@server/something"; | ||
import xyz from "@ui/xyz"; | ||
import { defineComponent } from 'vue'; | ||
function add(a,b) { | ||
return a + b; | ||
} | ||
export default defineComponent({ | ||
render() { | ||
return <div /> | ||
} | ||
}) | ||
</script> | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
<script lang="tsx"> | ||
// I am top level comment in this file. | ||
import thirdParty from "third-party"; | ||
import { defineComponent } from "vue"; | ||
import z from "z"; | ||
import abc from "@core/abc"; | ||
import otherthing from "@core/otherthing"; | ||
import something from "@server/something"; | ||
import component from "@ui/hello"; | ||
import xyz from "@ui/xyz"; | ||
import fourLevelRelativePath from "../../../../fourLevelRelativePath"; | ||
import threeLevelRelativePath from "../../../threeLevelRelativePath"; | ||
import twoLevelRelativePath from "../../twoLevelRelativePath"; | ||
import oneLevelRelativePath from "../oneLevelRelativePath"; | ||
import sameLevelRelativePath from "./sameLevelRelativePath"; | ||
function add(a, b) { | ||
return a + b; | ||
} | ||
export default defineComponent({ | ||
render() { | ||
return <div />; | ||
}, | ||
}); | ||
</script> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
run_spec(__dirname, ["vue"], { | ||
importOrder: ['^@core/(.*)$', '^@server/(.*)', '^@ui/(.*)$', '^[./]'], | ||
importOrderSeparation: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<script setup> | ||
// I am top level comment in this file. | ||
import z from 'z'; | ||
import threeLevelRelativePath from "../../../threeLevelRelativePath"; | ||
import sameLevelRelativePath from "./sameLevelRelativePath"; | ||
import thirdParty from "third-party"; | ||
import oneLevelRelativePath from "../oneLevelRelativePath"; | ||
import otherthing from "@core/otherthing"; | ||
import abc from "@core/abc"; | ||
import twoLevelRelativePath from "../../twoLevelRelativePath"; | ||
import component from "@ui/hello"; | ||
import fourLevelRelativePath from "../../../../fourLevelRelativePath"; | ||
import something from "@server/something"; | ||
import xyz from "@ui/xyz"; | ||
import { defineComponent } from 'vue' | ||
function add(a,b) { | ||
return a + b; | ||
} | ||
</script> | ||
|
||
<template> | ||
<div></div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<script> | ||
// I am top level comment in this file. | ||
import z from 'z'; | ||
import threeLevelRelativePath from "../../../threeLevelRelativePath"; | ||
import sameLevelRelativePath from "./sameLevelRelativePath"; | ||
import thirdParty from "third-party"; | ||
import oneLevelRelativePath from "../oneLevelRelativePath"; | ||
import otherthing from "@core/otherthing"; | ||
import abc from "@core/abc"; | ||
import twoLevelRelativePath from "../../twoLevelRelativePath"; | ||
import component from "@ui/hello"; | ||
import fourLevelRelativePath from "../../../../fourLevelRelativePath"; | ||
import something from "@server/something"; | ||
import xyz from "@ui/xyz"; | ||
import { defineComponent } from 'vue'; | ||
function add(a,b) { | ||
return a + b; | ||
} | ||
export default defineComponent({ | ||
}) | ||
</script> |
Oops, something went wrong.