chore: add prettier to format definitions/svelte files

This commit is contained in:
Eric Liu 2020-08-11 06:21:06 -07:00
commit 25e437b746
11 changed files with 38 additions and 23 deletions

View file

@ -10,6 +10,7 @@
"scripts": {
"start": "start-storybook -p 9090",
"build": "build-storybook",
"prettier": "prettier --write './**/*.svelte'",
"prepack": "rollup -c"
},
"sideEffects": false,
@ -29,6 +30,8 @@
"@tsconfig/svelte": "^1.0.8",
"babel-loader": "^8.0.6",
"comment-parser": "^0.7.5",
"prettier": "^2.0.5",
"prettier-plugin-svelte": "^1.1.0",
"rollup": "^2.22.1",
"rollup-plugin-svelte": "^5.2.3",
"rollup-plugin-terser": "^6.1.0",

View file

@ -5,6 +5,7 @@ const svelte = require("rollup-plugin-svelte");
const resolve = require("@rollup/plugin-node-resolve").default;
const commonjs = require("@rollup/plugin-commonjs");
const path = require("path");
const prettier = require("prettier");
const { parseComponent } = require("./parse-component");
async function generateDocs() {
@ -43,10 +44,7 @@ class CarbonSvelteBase {
const moduleName = name.replace(/\./g, "");
if (ext === ".svelte" && components.has(moduleName)) {
const group = dir
.split("src/")
.pop()
.split("/")[0];
const group = dir.split("src/").pop().split("/")[0];
if (groups.has(group)) {
groups.set(group, [...groups.get(group), moduleName]);
@ -126,7 +124,11 @@ class CarbonSvelteBase {
}
}
fs.writeFileSync(pkg.types, definitions);
const formatted_definitions = prettier.format(definitions, {
parser: "typescript",
});
fs.writeFileSync(pkg.types, formatted_definitions);
}
generateDocs();

View file

@ -9,14 +9,14 @@
indeterminate,
disabled,
hideLabel,
wrapperClassName
wrapperClassName,
} = $$props;
const checkboxProps = {
labelText,
indeterminate,
disabled,
hideLabel,
wrapperClassName
wrapperClassName,
};
let checked = true;

View file

@ -7,6 +7,6 @@
on:click={() => {
console.log('click');
}}
on:animationend={e => {
on:animationend={(e) => {
console.log('animation end', e.animationName);
}} />

View file

@ -18,7 +18,7 @@
port: 3000,
rule: "Round robin",
attached_groups: "Kevins VM Groups",
status: "Disabled"
status: "Disabled",
},
{
id: "b",
@ -27,7 +27,7 @@
port: 443,
rule: "Round robin",
attached_groups: "Maureens VM Groups",
status: "Starting"
status: "Starting",
},
{
id: "c",
@ -36,7 +36,7 @@
port: 80,
rule: "DNS delegation",
attached_groups: "Andrews VM Groups",
status: "Active"
status: "Active",
},
{
id: "d",
@ -45,7 +45,7 @@
port: 3000,
rule: "Round robin",
attached_groups: "Marcs VM Groups",
status: "Disabled"
status: "Disabled",
},
{
id: "e",
@ -54,7 +54,7 @@
port: 443,
rule: "Round robin",
attached_groups: "Mels VM Groups",
status: "Starting"
status: "Starting",
},
{
id: "f",
@ -63,8 +63,8 @@
port: 80,
rule: "DNS delegation",
attached_groups: "Ronjas VM Groups",
status: "Active"
}
status: "Active",
},
];
const headers = [
{ key: "name", value: "Name" },
@ -72,7 +72,7 @@
{ key: "port", value: "Port" },
{ key: "rule", value: "Rule" },
{ key: "attached_groups", value: "Attached Groups" },
{ key: "status", value: "Status" }
{ key: "status", value: "Status" },
];
$: sortable = true;
</script>

View file

@ -9,7 +9,7 @@
{ id: "option-0", text: "Option 1" },
{ id: "option-1", text: "Option 2" },
{ id: "option-2", text: "Option 3" },
{ id: "option-3", text: "Option 4" }
{ id: "option-3", text: "Option 4" },
];
$: selectedIndex = -1;
</script>

View file

@ -15,7 +15,7 @@
</script>
<Form
on:submit={event => {
on:submit={(event) => {
console.log('on:submit', event);
}}>
<FormGroup {...$$props}>

View file

@ -12,8 +12,8 @@
{
id: "option-4",
text:
"An example option that is really long to show what should be done to handle long text"
}
"An example option that is really long to show what should be done to handle long text",
},
];
</script>

View file

@ -25,9 +25,9 @@
setContext("StructuredListWrapper", {
selectedValue,
update: value => {
update: (value) => {
selectedValue.set(value);
}
},
});
$: selected = $selectedValue;

View file

@ -11,7 +11,7 @@
const radioTiles = [
{ value: "standard", id: "tile-1", labelText: "Selectable Tile" },
{ value: "default-selected", id: "tile-2", labelText: "Selectable Tile" },
{ value: "selected", id: "tile-3", labelText: "Selectable Tile" }
{ value: "selected", id: "tile-3", labelText: "Selectable Tile" },
];
$: selected = radioTiles[1].value;

View file

@ -8039,11 +8039,21 @@ prepend-http@^2.0.0:
resolved "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=
prettier-plugin-svelte@^1.1.0:
version "1.1.0"
resolved "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-1.1.0.tgz#e6ec282d8457598b0c02164083b11ad8cb8ab304"
integrity sha512-wmIggG/ryV0wcmE9D5p+k5TwKDpS2SGKJpF6IV1aYHK7dkBJD+di1w47Ci00DRsI4RrXZRC2Ef37DSyrTb6Zqg==
prettier@^1.16.4:
version "1.19.1"
resolved "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
prettier@^2.0.5:
version "2.0.5"
resolved "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4"
integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==
pretty-error@^2.1.1:
version "2.1.1"
resolved "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"