Skip to content

Commit 93a8242

Browse files
authored
chore: Update prettier (#49)
1 parent 82154f7 commit 93a8242

File tree

7 files changed

+34
-31
lines changed

7 files changed

+34
-31
lines changed

package-lock.json

+20-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@
4141
},
4242
"devDependencies": {
4343
"@capacitor/cli": "^3.3.3",
44-
"@ionic/prettier-config": "^2.0.0",
44+
"@ionic/prettier-config": "^4.0.0",
4545
"@stencil/core": "^2.11.0",
4646
"@types/github-slugger": "^1.3.0",
4747
"@types/jest": "^26.0.23",
4848
"@types/minimist": "^1.2.2",
4949
"jest": "^26.6.3",
5050
"np": "^7.5.0",
51-
"prettier": "^2.5.1",
51+
"prettier": "^3.3.3",
5252
"rimraf": "^3.0.2"
5353
},
5454
"prettier": "@ionic/prettier-config",

src/cli.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function run(config: { cwd: string; args: string[] }) {
3030
const tsconfigPath = getTsconfigPath(config.cwd, args.project);
3131
if (!tsconfigPath) {
3232
throw new Error(
33-
`Unable to find project's tsconfig.json file. Use the "--project" arg to specify the exact path.`
33+
`Unable to find project's tsconfig.json file. Use the "--project" arg to specify the exact path.`,
3434
);
3535
}
3636

src/output.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export async function outputReadme(readmeFilePath: string, data: DocsData) {
3131
content = await readFile(readmeFilePath, 'utf8');
3232
} catch (e) {
3333
throw new Error(
34-
`Unable to read: "${readmeFilePath}".\n\nIf this is the correct path, please create the file first, then run again.`
34+
`Unable to read: "${readmeFilePath}".\n\nIf this is the correct path, please create the file first, then run again.`,
3535
);
3636
}
3737

@@ -236,7 +236,7 @@ function buildExamples(c: DocsConfigInterface) {
236236
o.push(` "${c.name}": {`);
237237
c.properties.forEach((p, i) => {
238238
o.push(
239-
` "${p.name}": ${p.tags.find((t) => t.name === 'example')?.text}${i === c.properties.length - 1 ? '' : ','}`
239+
` "${p.name}": ${p.tags.find((t) => t.name === 'example')?.text}${i === c.properties.length - 1 ? '' : ','}`,
240240
);
241241
});
242242
o.push(` }`);

src/parse.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function collectInterfaces(
6161
i: DocsInterface,
6262
interfaces: DocsInterface[],
6363
typeAliases: DocsTypeAlias[],
64-
enums: DocsEnum[]
64+
enums: DocsEnum[],
6565
) {
6666
if (i.name !== data.api?.name && !data.interfaces.some((di) => di.name === i.name)) {
6767
data.interfaces.push(i);
@@ -80,7 +80,7 @@ function collectUsed(
8080
complexTypes: string[],
8181
interfaces: DocsInterface[],
8282
typeAliases: DocsTypeAlias[],
83-
enums: DocsEnum[]
83+
enums: DocsEnum[],
8484
) {
8585
complexTypes.forEach((typeName) => {
8686
const fi = interfaces.find((i) => i.name === typeName);
@@ -108,7 +108,7 @@ function parseSourceFile(
108108
interfaces: DocsInterface[],
109109
typeAliases: DocsTypeAlias[],
110110
enums: DocsEnum[],
111-
pluginConfigs: DocsInterface[]
111+
pluginConfigs: DocsInterface[],
112112
) {
113113
const statements = tsSourceFile.statements;
114114
const interfaceDeclarations = statements.filter(ts.isInterfaceDeclaration);
@@ -260,7 +260,7 @@ function getInterfaceMethod(typeChecker: ts.TypeChecker, methodSignature: ts.Met
260260
const returnTypeNode = typeChecker.typeToTypeNode(
261261
returnType,
262262
methodSignature,
263-
ts.NodeBuilderFlags.NoTruncation | ts.NodeBuilderFlags.NoTypeReduction
263+
ts.NodeBuilderFlags.NoTruncation | ts.NodeBuilderFlags.NoTypeReduction,
264264
);
265265
const returnString = typeToString(typeChecker, returnType);
266266
const signatureString = typeChecker.signatureToString(signature, methodSignature, flags, ts.SignatureKind.Call);
@@ -321,7 +321,7 @@ function getInterfaceProperty(typeChecker: ts.TypeChecker, properytSignature: ts
321321
function getPluginsConfig(
322322
typeChecker: ts.TypeChecker,
323323
moduleDeclaration: ts.ModuleDeclaration,
324-
pluginConfigs: DocsConfigInterface[]
324+
pluginConfigs: DocsConfigInterface[],
325325
) {
326326
const body = moduleDeclaration.body as ts.ModuleBlock;
327327
if (!Array.isArray(body.statements)) {
@@ -330,7 +330,7 @@ function getPluginsConfig(
330330

331331
const pluginConfigInterfaces = body.statements.filter(
332332
(s: ts.InterfaceDeclaration) =>
333-
s?.name?.text === 'PluginsConfig' && Array.isArray(s?.members) && s.members.length > 0
333+
s?.name?.text === 'PluginsConfig' && Array.isArray(s?.members) && s.members.length > 0,
334334
) as ts.InterfaceDeclaration[];
335335

336336
pluginConfigInterfaces.forEach((pluginConfigInterface) => {

src/test/formatting.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ describe('formatting', () => {
4747
it('formatDescription', () => {
4848
const r = formatDescription(d, `Hey SomeInterface and SomeInterface.prop and SomeEnum and SomeEnum.Value!`);
4949
expect(r).toEqual(
50-
`Hey <a href=\"#someinterface\">SomeInterface</a> and <a href=\"#someinterface\">SomeInterface.prop</a> and <a href=\"#someenum\">SomeEnum</a> and <a href=\"#someenum\">SomeEnum.Value</a>!`
50+
`Hey <a href=\"#someinterface\">SomeInterface</a> and <a href=\"#someinterface\">SomeInterface.prop</a> and <a href=\"#someenum\">SomeEnum</a> and <a href=\"#someenum\">SomeEnum.Value</a>!`,
5151
);
5252
});
5353

5454
it('formatType interface promise w/ union', () => {
5555
const r = formatType(d, `Promise<SomeInterface | SomeEnum | Promise<void>>`);
5656
expect(r.type).toEqual(`Promise<SomeInterface | SomeEnum | Promise<void>>`);
5757
expect(r.formatted).toEqual(
58-
`<code>Promise&lt;<a href="#someinterface">SomeInterface</a> | <a href=\"#someenum\">SomeEnum</a> | Promise&lt;void&gt;&gt;</code>`
58+
`<code>Promise&lt;<a href="#someinterface">SomeInterface</a> | <a href=\"#someenum\">SomeEnum</a> | Promise&lt;void&gt;&gt;</code>`,
5959
);
6060
});
6161

src/transpile.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function getTsProgram(opts: DocsParseOptions) {
1313
if (configResult.error) {
1414
throw new Error(
1515
`Unable to read tsconfig path: "${opts.tsconfigPath}". ` +
16-
ts.flattenDiagnosticMessageText(configResult.error.messageText, '\n')
16+
ts.flattenDiagnosticMessageText(configResult.error.messageText, '\n'),
1717
);
1818
}
1919
const tsconfigDir = path.dirname(opts.tsconfigPath);

0 commit comments

Comments
 (0)