diff --git a/prettier.config.d.ts b/prettier.config.d.ts index 748dcdc..1792f9c 100644 --- a/prettier.config.d.ts +++ b/prettier.config.d.ts @@ -1,4 +1,4 @@ import prettier from 'prettier' -declare const options: prettier.Options -export default options +declare const config: prettier.Config +export default config diff --git a/prettier.config.js b/prettier.config.js index 63af10f..4204ae0 100644 --- a/prettier.config.js +++ b/prettier.config.js @@ -16,4 +16,10 @@ module.exports = { arrowParens: 'always', proseWrap: 'always', endOfLine: 'lf', + + overrides: [ + // Disable formatting JSONC with trailing commas (discouraged by the format) + // See https://github.com/prettier/prettier/issues/15956#issuecomment-1987146114 + { files: ['*.jsonc'], options: { trailingComma: 'none' } }, + ], } diff --git a/tests/basicFile.ts b/tests/basicFile.ts new file mode 100644 index 0000000..6febc6a --- /dev/null +++ b/tests/basicFile.ts @@ -0,0 +1,5 @@ +interface Foo { + bar: number +} + +export const foo: Foo = { bar: 1 } diff --git a/tests/reactFile.tsx b/tests/reactFile.tsx new file mode 100644 index 0000000..eb7e94d --- /dev/null +++ b/tests/reactFile.tsx @@ -0,0 +1,6 @@ +import React from 'react' + +// This is a Button component +export const Button = () => { + return
Foo Bar
+} diff --git a/tests/tokenFile.jsonc b/tests/tokenFile.jsonc new file mode 100644 index 0000000..81f50a3 --- /dev/null +++ b/tests/tokenFile.jsonc @@ -0,0 +1,4 @@ +{ + // This is foo. + "foo": "bar" +}