Skip to content

Commit

Permalink
feat: update prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
ModyQyW committed May 7, 2023
1 parent 5ddff0f commit 48afb4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
2 changes: 2 additions & 0 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ export const enableTailwindCssIcons =
export const enableUnoCss = isPackageExists('unocss') || Boolean(process.env.ENABLE_UNO_CSS);

export const enablePrettier = isPackageExists('prettier') || Boolean(process.env.ENABLE_PRETTIER);

export const enablePrettierPluginTailwindCss = enableTailwindCss && !enableTailwindCssIcons;
19 changes: 3 additions & 16 deletions src/prettier.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
/* eslint-disable unicorn/prefer-module */
import type { Config } from 'prettier';
import getDebug from 'debug';
import { enableTailwindCss, enableTailwindCssIcons } from './helpers';
import { enablePrettierPluginTailwindCss } from './helpers';

const debug = getDebug('@modyqyw/fabric/prettier');

debug('JSDoc plugin enabled.');
debug('PackageJson Plugin enabled.');
debug(
`TailwindCSS plugin ${enableTailwindCss && !enableTailwindCssIcons ? 'enabled' : 'disabled'}.`,
);
debug(`TailwindCSS plugin ${enablePrettierPluginTailwindCss ? 'enabled' : 'disabled'}.`);

const config: Config & { [key: string]: any } = {
printWidth: 100,
Expand All @@ -21,19 +19,8 @@ const config: Config & { [key: string]: any } = {
plugins: [
require.resolve('prettier-plugin-jsdoc'),
require.resolve('prettier-plugin-packagejson'),
enableTailwindCss && !enableTailwindCssIcons
? require.resolve('prettier-plugin-tailwindcss')
: null,
enablePrettierPluginTailwindCss ? require.resolve('prettier-plugin-tailwindcss') : null,
].filter((item) => !!item) as string[],
overrides: [
{
files: ['*.json5'],
options: {
singleQuote: false,
quoteProps: 'preserve',
},
},
],
};

export default config;
Expand Down

0 comments on commit 48afb4e

Please sign in to comment.