sandbox/npm/prettier-config/README.md
Yongmin Hong b495028e8f
npm(prettier-config): double-declare prettier xml plugin
Summary:
Fixes T180. Quick hack, I guess. Following ../eslint-config by using deps not devDeps.

patch version bump for not adding/removing pkgs per se.

Signed-off-by: Yongmin Hong <revi@omglol.email>

Test Plan: land, update prettier pkg and do prettier commands.

Reviewers: O1 revi & automations, revi

Reviewed By: O1 revi & automations, revi

Tags: #npm

Maniphest Tasks: T180

Differential Revision: https://issuetracker.revi.xyz/D480
2024-07-01 14:35:30 +09:00

2.3 KiB

@revi/prettier-config

NPM Version GitHub License

This is @revi's personal prettier config.

Config

const config = {
  bracketSpacing: false,
  bracketSameLine: true,
  proseWrap: 'preserve',
  singleQuote: true,
  trailingComma: 'all',
  plugins: [
    // https://github.com/prettier/plugin-php
    '@prettier/plugin-php',
    // https://github.com/un-ts/prettier/tree/master/packages/sh
    'prettier-plugin-sh',
    // https://github.com/bd82/toml-tools/tree/master/packages/prettier-plugin-toml
    'prettier-plugin-toml',
    // https://github.com/prettier/plugin-xml
    '@prettier/plugin-xml',
  ],
  overrides: [
    // Sort by parser alphabet.
    {
      files: ['.arcconfig', '.arclint', '.arcunit', '.imgbotconfig'],
      options: {parser: 'json'},
    },
    {
      files: [
        '**.hujson',
        '.devcontainer.json',
        '.devcontainer/*/devcontainer.json',
        '.devcontainer/devcontainer.json',
        '.vscode/*.json',
        '**/jsconfig.json',
        '**/jsconfig.*.json',
        '**/tsconfig.json',
        '**/tsconfig.*.json',
        'jsconfig.json',
        'jsconfig.*.json',
        'tsconfig.json',
        'tsconfig.*.json',
      ],
      options: {parser: 'jsonc', trailingComma: 'none'},
    },
    {
      files: '*.php',
      options: {
        parser: 'php',
        phpVersion: '8.1',
        useTabs: true,
        tabWidth: 4,
        braceStyle: '1tbs',
      },
    },
    {
      files: [
        '.editorconfig',
        '.gitattributes',
        '.gitignore',
        '.prettierignore',
      ],
      options: {parser: 'sh', keepPadding: true, minify: false},
    },
    {
      files: ['*.svg', '*.xml'],
      options: {
        parser: 'xml',
        singleAttributePerLine: false,
        xmlQuoteAttributes: 'preserve',
        xmlSelfClosingSpace: true,
        xmlSortAttributesByKey: false,
        xmlWhitespaceSensitivity: 'strict',
      },
    },
    {
      files: '.yamllint',
      options: {parser: 'yaml'},
    },
  ],
};

export default config;