{"id":31364478,"url":"https://github.com/kekyo/prettier-max","last_synced_at":"2025-09-27T07:53:41.727Z","repository":{"id":312009566,"uuid":"1045324903","full_name":"kekyo/prettier-max","owner":"kekyo","description":"Minimalist automatic Prettier formatting plugin for Vite","archived":false,"fork":false,"pushed_at":"2025-09-16T02:37:53.000Z","size":8763,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-18T09:03:35.870Z","etag":null,"topics":["plugin","prettier","typescript","vite"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kekyo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-27T01:49:03.000Z","updated_at":"2025-09-16T02:37:47.000Z","dependencies_parsed_at":"2025-08-28T08:59:02.155Z","dependency_job_id":null,"html_url":"https://github.com/kekyo/prettier-max","commit_stats":null,"previous_names":["kekyo/prettier-max"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kekyo/prettier-max","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kekyo%2Fprettier-max","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kekyo%2Fprettier-max/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kekyo%2Fprettier-max/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kekyo%2Fprettier-max/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kekyo","download_url":"https://codeload.github.com/kekyo/prettier-max/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kekyo%2Fprettier-max/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277200295,"owners_count":25778129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-27T02:00:08.978Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["plugin","prettier","typescript","vite"],"created_at":"2025-09-27T07:53:38.461Z","updated_at":"2025-09-27T07:53:41.715Z","avatar_url":"https://github.com/kekyo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prettier-max\n\nMinimalist automatic Prettier formatting plugin for Vite\n\n![prettier-max](images/prettier-max-120.png)\n\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![npm version](https://img.shields.io/npm/v/prettier-max.svg)](https://www.npmjs.com/package/prettier-max)\n\n---\n\n[(日本語はこちら)](./README_ja.md)\n\n## What is this?\n\nprettier-max is a very simple Vite plugin that automatically formats your code with [Prettier](https://prettier.io/) during the build process.\nIt also includes TypeScript validation to ensure your code is type-safe before building.\n\nESLint is complex and often throws its own configuration errors.\nFor those who find basic auto-formatting and TypeScript type checking sufficient, this simple plugin may be useful.\n\nKey features:\n\n- Automatic Prettier formatting on build start\n- When using TypeScript, post-formatting TypeScript type checking. Additionally, JSDoc deprecation (`@deprecated`) can also be checked.\n- All fine-tuning is specified in `.prettierrc`, `.prettierignore` and `tsconfig.json`, ensuring consistency\n- This is not doing anything unnecessary\n\n---\n\n## Installation\n\nInstall in `devDepencencies`:\n\n```bash\nnpm install -D prettier-max\n```\n\nAdd the plugin to your `vite.config.ts`:\n\n```typescript\nimport { defineConfig } from 'vite';\nimport prettierMax from 'prettier-max';\n\nexport default defineConfig({\n  plugins: [\n    prettierMax(), // Use default settings\n  ],\n});\n```\n\nIf the default behavior is fine, you're all set!\n\nThe build works as follows:\n\n1. On build start, the plugin formats all target files\n2. If formatting succeeds and TypeScript is enabled (by default), it runs type checking and detecting deprecation\n3. Errors are reported to the console with file paths and line numbers\n4. If `failOnError` is `true` (by default), the build stops on any errors\n\n### Prettier resolution\n\n- The plugin always prefers the Prettier installation that lives closest to your Vite project root (monorepo hoists are respected).\n- If no project-level copy is available, it falls back to the `prettier` dependency bundled with prettier-max.\n- This lets workspace owners pin Prettier versions explicitly, while still keeping a reliable fallback for standalone usage.\n\n### TypeScript availability\n\n- TypeScript validation runs only when TypeScript is available in your project.\n- If TypeScript is not installed, the validation step is skipped and a warning is logged.\n- You can also explicitly disable it with the `typescript: false` option.\n\n## Usage\n\n### Configuration options\n\nThe options you can specify for prettier-max are as follows:\n\n```typescript\n// The plugin options:\nprettierMax({\n  // Generate .prettierrc and .prettierignore files if they don't exist\n  // Default: true\n  generatePrettierConfig: true,\n\n  // Fail the build on Prettier formatting or TypeScript errors\n  // Default: true\n  failOnError: true,\n\n  // Format files on build start\n  // Default: true\n  formatOnBuild: true,\n\n  // Run TypeScript validation after formatting\n  // Default: true\n  typescript: true,\n\n  // Detect usage of deprecated symbols marked with @deprecated JSDoc tag\n  // Default: true\n  detectDeprecated: true,\n});\n```\n\n### Configuration delegations\n\nprettier-max doesn't have any major features that could be described as settings.\nThey are simply defined by `.prettierrc`, `.prettierignore`, and `tsconfig.json`.\n\nIn other words, if you adjust them according to the standard Prettier configuration methods and/or TypeScript compiler configuration methods,\nit will work exactly as intended!\n\nprettier-max automatically places templates if `.prettierrc` and `.prettierignore` do not exist.\n(It generates them only if the files do NOT exist. If you dislike this behavior, you can suppress it by setting `generatePrettierConfig` to `false`.)\n\nHere, we'll show an example of adding definitions to `.prettierrc` and `tsconfig.json` to manage your project with more powerful formats and checks. Refer to [Prettier configuration file documentation](https://prettier.io/docs/configuration) and [official TypeScript documentation](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) for each feature.\n\n`.prettierrc`:\n\n```json\n{\n  \"semi\": true,\n  \"singleQuote\": true,\n  \"trailingComma\": \"es5\"\n}\n```\n\n`tsconfig.json`:\n\n```json\n{\n  \"compilerOptions\": {\n    // ... (Another required options)\n\n    \"useDefineForClassFields\": true,\n    \"declaration\": true,\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"noImplicitOverride\": true,\n    \"noImplicitReturns\": true,\n    \"noUncheckedIndexedAccess\": true\n  }\n}\n```\n\n### Deprecated detection\n\nprettier-max can detect usage of deprecated symbols marked with `@deprecated` JSDoc tags:\n\n```typescript\n/**\n * @deprecated Will be removed in future\n */\nconst olderSuperComponent = () =\u003e {\n  // ...\n};\n\n// PMAX001: 'olderSuperComponent' is deprecated: Will be removed in future\nolderSuperComponent();\n```\n\n- Reports `PMAX001` errors when deprecated symbols are used\n- Deprecated functions calling other deprecated symbols won't generate warnings\n\nYou can temporarily suppress this warning by inserting the `@prettier-max-ignore-deprecated` directive in your code:\n\n```typescript\n// @prettier-max-ignore-deprecated: Will fix soon\nolderSuperComponent();\n```\n\nNote that suppressions are logged to the console.\n\nIf the directive doesn't suppress any deprecated usage, a `PMAX002` error is reported.\nIn that case, please remove the unnecessary directive.\n\nDetecting deprecation causes TypeScript to perform detailed analysis.\nIf detection performance becomes an issue, you can disable it by setting `detectDeprecated: false`.\n\n### Log output\n\nLog output adjustments follow Vite's option specifications:\n\n```bash\n# Minimal logs (errors only)\nvite build --logLevel error\n\n# Detailed logs including debug information\nvite build --debug\n\n# Completely disable logs\nvite build --logLevel silent\n```\n\nYou can also use the `DEBUG` environment variable to output debug information by specifying namespaces:\n\n```bash\n# prettier-max debugging\nDEBUG=vite:plugin:prettier-max vite build\n```\n\n---\n\n## Limitations\n\nIf you are not using TypeScript, you cannot perform JSDoc deprecation checks.\n\n---\n\n## License\n\nUnder MIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkekyo%2Fprettier-max","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkekyo%2Fprettier-max","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkekyo%2Fprettier-max/lists"}