{"_id":"@elegantech/prettier-multi-config","_rev":"2-5a1ac5374dcdc49e2cfe442e08480a9b","name":"@elegantech/prettier-multi-config","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.1":{"name":"@elegantech/prettier-multi-config","version":"1.0.1","type":"module","description":"Pre-configuration builder for Prettier 3 to support multiple file formats.","repository":{"type":"git","url":"git+https://github.com/elegantech/prettier-multi-config.git"},"author":{"name":"Nelson Martell","email":"nelson6e65@gmail.com"},"license":"Apache-2.0","workspaces":["examples/*"],"engines":{"node":">=12.17.0"},"main":"./dist/index.cjs","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.cjs","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./helpers":{"types":"./dist/helpers/index.d.ts","require":"./dist/helpers/index.cjs","import":"./dist/helpers/index.mjs","default":"./dist/helpers/index.mjs"},"./presets":{"types":"./dist/presets/index.d.ts","require":"./dist/presets/index.cjs","import":"./dist/presets/index.mjs","default":"./dist/presets/index.mjs"}},"types":"./dist/index.d.ts","keywords":["prettier","prettier-plugin","prettier-config","prettier-preset","prettier-presets","static analysis"],"scripts":{"build":"unbuild","build:internal":"unbuild internal","build:watch":"watch 'npm run build' src","fix:eslint":"eslint . --fix","fix:style":"prettier --write .","internal:promote-prettier":"node scripts/promote-prettier-config.mjs","lint:all":"concurrently -t --success=all --timings  \"npm:lint:*(!all)\"","lint:eslint":"eslint .","lint:prettier-config":"npx prettier --check --no-error-on-unmatched-pattern --log-level=silent test","lint:style":"prettier --check .","lint:ts":"tsc --noEmit -p tsconfig.main.json","postbuild:internal":"npm run internal:promote-prettier","postinternal:promote-prettier":"prettier --write ./.prettierrc.json","prepack":"npm run build","test":"vitest","test:coverage":"vitest run --coverage","test:ui":"vitest --ui"},"peerDependencies":{"prettier":"^3.0.0","prettier-plugin-pkg":">= 0.18.0"},"dependencies":{"tslib":"^2.6.2"},"optionalDependencies":{"@prettier/plugin-php":"^0.20.1"},"devDependencies":{"@types/node":"^18.17.15","@typescript-eslint/eslint-plugin":"^6.7.0","@typescript-eslint/parser":"^6.7.0","@vitest/coverage-v8":"^0.34.4","@vitest/ui":"^0.34.4","bun-types":"^1.0.2","chalk":"^5.3.0","concurrently":"^8.2.1","eslint":"^8.49.0","eslint-config-prettier":"^9.0.0","eslint-plugin-import":"^2.28.1","eslint-plugin-node":"^11.1.0","eslint-plugin-unicorn":"^48.0.1","prettier":"^3.0.3","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-pkg":"^0.18.0","prettier-plugin-sh":"^0.13.1","semantic-release":"^22.0.5","typescript":"^5.2.2","unbuild":"^2.0.0","vitest":"^0.34.4","watch":"^1.0.2"},"_id":"@elegantech/prettier-multi-config@1.0.1","gitHead":"5d98a62228d926481d9e989f284ca28c362e1a5e","bugs":{"url":"https://github.com/elegantech/prettier-multi-config/issues"},"homepage":"https://github.com/elegantech/prettier-multi-config#readme","_nodeVersion":"20.8.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-NAasAT3k0TktJxrq8acLX/R94OCWv8if0elZ80w7RsJti3b/brPLqx2GCpUHQkEL59wh73cuqTGCZOWLkWL6Wg==","shasum":"735dcdfc13c1761b50909d11494513152c961062","tarball":"https://registry.npmjs.org/@elegantech/prettier-multi-config/-/prettier-multi-config-1.0.1.tgz","fileCount":34,"unpackedSize":58477,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIET8ZfJo33Oz24Xa7RfPs2jGbhweoQ2X/AUG8xl5uliSAiA024yieFsxDlRtP0Hm14P9skmWhGA65N3naN8xi23T6w=="}]},"_npmUser":{"name":"nelson6e65","email":"nelson6e65@gmail.com"},"directories":{},"maintainers":[{"name":"nelson6e65","email":"nelson6e65@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prettier-multi-config_1.0.1_1696958202889_0.18654424090500843"},"_hasShrinkwrap":false},"1.0.2":{"name":"@elegantech/prettier-multi-config","version":"1.0.2","type":"module","description":"Pre-configuration builder for Prettier 3 to support multiple file formats.","repository":{"type":"git","url":"git+https://github.com/elegantech/prettier-multi-config.git"},"author":{"name":"Nelson Martell","email":"nelson6e65@gmail.com"},"license":"Apache-2.0","workspaces":["examples/*"],"engines":{"node":">=12.17.0"},"main":"./dist/index.cjs","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.cjs","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./helpers":{"types":"./dist/helpers/index.d.ts","require":"./dist/helpers/index.cjs","import":"./dist/helpers/index.mjs","default":"./dist/helpers/index.mjs"},"./presets":{"types":"./dist/presets/index.d.ts","require":"./dist/presets/index.cjs","import":"./dist/presets/index.mjs","default":"./dist/presets/index.mjs"}},"types":"./dist/index.d.ts","keywords":["prettier","prettier-plugin","prettier-config","prettier-preset","prettier-presets","static analysis"],"scripts":{"build":"unbuild","build:internal":"unbuild internal","build:watch":"watch 'npm run build' src","fix:eslint":"eslint . --fix","fix:style":"prettier --write .","internal:promote-prettier":"node scripts/promote-prettier-config.mjs","lint:all":"concurrently -t --success=all --timings  \"npm:lint:*(!all)\"","lint:eslint":"eslint .","lint:prettier-config":"npx prettier --check --no-error-on-unmatched-pattern --log-level=silent test","lint:style":"prettier --check .","lint:ts":"tsc --noEmit -p tsconfig.main.json","postbuild:internal":"npm run internal:promote-prettier","postinternal:promote-prettier":"prettier --write ./.prettierrc.json","prepack":"npm run build","test":"vitest","test:coverage":"vitest run --coverage","test:ui":"vitest --ui"},"peerDependencies":{"prettier":"^3.0.0"},"dependencies":{"tslib":"^2.6.2"},"optionalDependencies":{"@prettier/plugin-php":">= 0.20.1","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-pkg":">= 0.18.0","prettier-plugin-sh":">= 0.13.1"},"devDependencies":{"@types/node":"^18.17.15","@typescript-eslint/eslint-plugin":"^6.7.0","@typescript-eslint/parser":"^6.7.0","@vitest/coverage-v8":"^0.34.4","@vitest/ui":"^0.34.4","bun-types":"^1.0.2","chalk":"^5.3.0","concurrently":"^8.2.1","eslint":"^8.49.0","eslint-config-prettier":"^9.0.0","eslint-plugin-import":"^2.28.1","eslint-plugin-node":"^11.1.0","eslint-plugin-unicorn":"^48.0.1","prettier":"^3.0.3","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-pkg":"^0.18.0","prettier-plugin-sh":"^0.13.1","semantic-release":"^22.0.5","typescript":"^5.2.2","unbuild":"^2.0.0","vitest":"^0.34.4","watch":"^1.0.2"},"_id":"@elegantech/prettier-multi-config@1.0.2","gitHead":"6b53062c806bd6192c3fcead535d300d63605acd","bugs":{"url":"https://github.com/elegantech/prettier-multi-config/issues"},"homepage":"https://github.com/elegantech/prettier-multi-config#readme","_nodeVersion":"20.8.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-rzt5FYglckRegjIQBuUpO1zX6XRjI3HvHuGdM7nTPXEhj5eKcDsfWC63Ejkiz+tXbOm6lAlnu2FpOD4gTXyKYA==","shasum":"b766cffe188bced0cdc953dfc3b5d93d008fa3f7","tarball":"https://registry.npmjs.org/@elegantech/prettier-multi-config/-/prettier-multi-config-1.0.2.tgz","fileCount":34,"unpackedSize":58572,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAoe3GlLprAwcCKu/jJoqReHvJ7fjeE5o2Pz9B+kza6xAiBhtAxgGoZWSmEkFEW2XKO83THtKXaAC/nXJrBo4MRemw=="}]},"_npmUser":{"name":"nelson6e65","email":"nelson6e65@gmail.com"},"directories":{},"maintainers":[{"name":"nelson6e65","email":"nelson6e65@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prettier-multi-config_1.0.2_1696970774653_0.5245043616537519"},"_hasShrinkwrap":false},"1.1.0":{"name":"@elegantech/prettier-multi-config","version":"1.1.0","type":"module","description":"Pre-configuration builder for Prettier 3 to support multiple file formats.","repository":{"type":"git","url":"git+https://github.com/elegantech/prettier-multi-config.git"},"author":{"name":"Nelson Martell","email":"nelson6e65@gmail.com"},"license":"Apache-2.0","workspaces":["examples/*"],"engines":{"node":">=12.17.0"},"main":"./dist/index.cjs","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.cjs","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./helpers":{"types":"./dist/helpers/index.d.ts","require":"./dist/helpers/index.cjs","import":"./dist/helpers/index.mjs","default":"./dist/helpers/index.mjs"},"./presets":{"types":"./dist/presets/index.d.ts","require":"./dist/presets/index.cjs","import":"./dist/presets/index.mjs","default":"./dist/presets/index.mjs"}},"types":"./dist/index.d.ts","keywords":["prettier","prettier-plugin","prettier-config","prettier-preset","prettier-presets","static analysis"],"scripts":{"build":"unbuild","build:watch":"watch 'npm run build' src","fix:eslint":"eslint . --fix","fix:style":"prettier --write .","internal:build":"unbuild internal","internal:promote-prettier":"node scripts/promote-prettier-config.mjs","lint:all":"concurrently -t --success=all --timings  \"npm:lint:*(!all)\"","lint:eslint":"eslint .","lint:prettier-config":"npx prettier --check --no-error-on-unmatched-pattern --log-level=silent test","lint:style":"prettier --check .","lint:ts":"tsc --noEmit -p tsconfig.main.json && tsc --noEmit -p tsconfig.configs.json && tsc --noEmit -p tsconfig.internal.json && tsc --noEmit -p tsconfig.test.json","postinternal:build":"npm run internal:promote-prettier","postinternal:promote-prettier":"prettier --write ./.prettierrc.json","prepack":"npm run build","prepare":"is-ci || husky install","test":"vitest","test:coverage":"vitest run --coverage","test:ui":"vitest --ui"},"peerDependencies":{"prettier":"^3.0.0"},"dependencies":{"tslib":"^2.6.2"},"optionalDependencies":{"@prettier/plugin-php":">= 0.20.1","prettier-plugin-multiline-arrays":"^3.0.0","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-pkg":">= 0.18.0","prettier-plugin-sh":">= 0.13.1"},"devDependencies":{"@types/node":"^18.17.15","@typescript-eslint/eslint-plugin":"^6.7.0","@typescript-eslint/parser":"^6.7.0","@vitest/coverage-v8":"^0.34.4","@vitest/ui":"^0.34.4","bun-types":"^1.0.2","chalk":"^5.3.0","concurrently":"^8.2.1","eslint":"^8.49.0","eslint-config-prettier":"^9.0.0","eslint-plugin-import":"^2.28.1","eslint-plugin-node":"^11.1.0","eslint-plugin-unicorn":"^48.0.1","husky":"^8.0.0","is-ci":"^3.0.1","lint-staged":"^15.0.0","prettier":"^3.0.3","prettier-plugin-multiline-arrays":"^3.0.0","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-pkg":"^0.18.0","prettier-plugin-sh":"^0.13.1","semantic-release":"^22.0.5","typescript":"^5.2.2","unbuild":"^2.0.0","vitest":"^0.34.4","watch":"^1.0.2"},"_id":"@elegantech/prettier-multi-config@1.1.0","gitHead":"df5db4370141587f27c608d9ad669b804c13454a","bugs":{"url":"https://github.com/elegantech/prettier-multi-config/issues"},"homepage":"https://github.com/elegantech/prettier-multi-config#readme","_nodeVersion":"20.8.1","_npmVersion":"10.1.0","dist":{"integrity":"sha512-fVOr1frqogNsa/5u6Z960PGptebOh3KbHEysA7BjxIxWKSPlXzCN35mJ+eU59TWAqoTsBDBJXWj2I279H5fCdA==","shasum":"3d6c5fa4847e635e8e3d99a89d8b3f7e340c14ea","tarball":"https://registry.npmjs.org/@elegantech/prettier-multi-config/-/prettier-multi-config-1.1.0.tgz","fileCount":36,"unpackedSize":62785,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAw0yU4+75bY4fCxPZ+U8rktl4IrqjVGDatLUGBdT+2mAiA+4pZ5l9LyFNxwv1Ain7w7aOU4e+a5qOTz1nhxOQ0mGw=="}]},"_npmUser":{"name":"nelson6e65","email":"nelson6e65@gmail.com"},"directories":{},"maintainers":[{"name":"nelson6e65","email":"nelson6e65@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prettier-multi-config_1.1.0_1698021675835_0.6579869232475597"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-10T17:16:42.770Z","1.0.1":"2023-10-10T17:16:43.162Z","modified":"2023-10-23T00:41:16.243Z","1.0.2":"2023-10-10T20:46:14.996Z","1.1.0":"2023-10-23T00:41:16.052Z"},"maintainers":[{"name":"nelson6e65","email":"nelson6e65@gmail.com"}],"description":"Pre-configuration builder for Prettier 3 to support multiple file formats.","homepage":"https://github.com/elegantech/prettier-multi-config#readme","keywords":["prettier","prettier-plugin","prettier-config","prettier-preset","prettier-presets","static analysis"],"repository":{"type":"git","url":"git+https://github.com/elegantech/prettier-multi-config.git"},"author":{"name":"Nelson Martell","email":"nelson6e65@gmail.com"},"bugs":{"url":"https://github.com/elegantech/prettier-multi-config/issues"},"license":"Apache-2.0","readme":"# @elegantech/prettier-multi-config\n\n<!-- [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) -->\n\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/elegantech/prettier-multi-config)\n\nMulti-configurations presets for [Prettier 3](https://prettier.io). Compatibility with some plugins (PHP, Blade templates, Bash, etc).\n\n## Requirements\n\n- Prettier >= 3.0.0: Base prettier and plugins are compatible with Prettier >= 3 only.\n- Node.js:\n  - Minimum: 14.18.0 (for ESM config compatibility and default plugins)\n- npm:\n  - Minimum: 7.2.0 (automatic install of `peerDependencies`).\n\n> Note: Some optional plugins may require a more recent version of Node.js.\n\n## Installing\n\n> In the following instructions it will be used `npm`, but commands arguments are the same for `yarn`.\n\nAdd Prettier and this package to your project:\n\n```sh\n# Base Prettier 3\nnpm add -D --save-exact prettier\n\n# This package\nnpm add -D @elegantech/prettier-multi-config\n```\n\n> Prettier's team recommends to use `--save-exact` for `prettier` dependency.\n\n### Installing plugins dependencies\n\nThere are other optional dependencies that vary depending of the presets you are using. Check that sections for instructions.\n\nDepending on how are you creating your own config file, you may choose to install the required plugins packages as:\n\n- `devDependencies` (`-D`, `--save-dev`).\n- `peerDependencies` (`--save-peer`).\n- `dependencies`.\n\n<!-- TODO: Add documentation about other types of installation -->\n\n> In the following plugin installation instructions, it is assumed you are building your configuration directly into your project, and therefore plugin packages should be installed as `devDependencies` (using the `-D` npm/yarn alias).\n\n## Available presets\n\nThere are some presets available with default configurations and plugins for specific languages or cases. These will help you create your own configuration file.\n\n> Check for examples in the [Usage](#usage) section.\n\n### Base preset (`base`)\n\nIncludes general base rules for all the languages/files officially supported by Prettier. Also, there are options for formatting the `package.json` file.\n\n#### Required plugins:\n\n- [prettier-plugin-pkg](https://github.com/un-ts/prettier/tree/master/packages/pkg)\n\n```sh\nnpm add -D prettier-plugin-pkg\n```\n\n### PHP preset (`php`)\n\nCompatibility with PHP.\n\n> Note: You need to set the `phpVersion` option depending of your PHP environment.\n\n#### Required plugins:\n\n- [@prettier/plugin-php](https://github.com/prettier/plugin-php)\n\n```sh\nnpm add -D @prettier/plugin-php\n```\n\n### Bash Script preset (`sh`)\n\nCompatibility with Shell Script for Bash or sh.\n\n#### Required plugins:\n\n- [prettier-plugin-sh](https://github.com/un-ts/prettier/tree/master/packages/sh)\n\n```sh\nnpm add -D prettier-plugin-sh\n```\n\n### Multiline preset (`sh`)\n\nMultiline elements for some languages.\n\n#### Required plugins:\n\n- [prettier-plugin-multiline-arrays](https://github.com/electrovir/prettier-plugin-multiline-arrays)\n\n```sh\nnpm add -D prettier-plugin-multiline-arrays\n```\n\n## Usage\n\n### Simple usage\n\nAlthough this package is not intended to be used directly as a shared configuration or plugin, you can still use the default export as your prettier setup.\n\nIn your `package.json`:\n\n```json\n{\n  \"prettier\": \"@elegantech/prettier-multi-config\"\n}\n```\n\nOr in your `.prettierrc.json`:\n\n```json\n\"@elegantech/prettier-multi-config\"\n```\n\n> This includes the `base` preset only.\n\nYou can use this technique to create your shared configuration using this package. 😉\n\nCheck out the following sections to create your own customized configuration file.\n\n### The config file\n\n<!-- TODO: Add doc in VitePress or VuePress -->\n\nYou have to use `.js`, `.cjs` or `.mjs` formats to be able to customize your presets. As you can see, this package it's available for ESM and CommonJs modules.\n\nRemember: If your project is an ESM (`{ \"type\": \"module\" }` in your `package.json`), by using `.prettierrc.js` it will `import` the ESM build, but in the other hand, it will be `require`d the commonjs version. To avoid this, you can use `.cjs` or `.mjs` extensions instead.\n\nInitial state for `.prettier.mjs`:\n\n```mjs\n/** @type {import(\"prettier\").Config} */\nconst config = {\n  // ...\n};\n\nexport default config;\n```\n\nRead more about config formats in the [Prettier documentation](https://prettier.io/docs/en/configuration.html).\n\n### Examples\n\n> Note: Most of the following examples will assume you are using `.prettierrc.mjs` (ESM), but you are free to use `.cjs` format instead.\n\nIn your `.prettier.mjs`:\n\n```mjs\nimport {\n  getMergedGlobalOptionsFor,\n  getPluginsFor,\n  getMergedOverrideFor,\n} from '@elegantech/prettier-multi-config/presets';\n\nconst selectedPresets = [\n  'base',\n  'php',\n  'sh',\n];\n\n/** @type {import(\"prettier\").Config} */\nconst config = {\n  // Add global configurations for selected presets\n  ...getMergedGlobalOptionsFor(selectedPresets, {\n    // Here you can add your own global options\n  }),\n\n  // Add plugins for selected presets\n  plugins: getPluginsFor(selectedPresets, [\n    // Here you can add other plugins\n    'prettier-plugin-organize-imports',\n  ]),\n\n  overrides: [\n    // Specific options for presets\n    ...getMergedOverrideFor('base'),\n    ...getMergedOverrideFor('php', {\n      config: {\n        // You can override some default options in the preset\n        options: { phpVersion: '8.1' },\n      },\n    }),\n    ...getMergedOverrideFor('sh'),\n\n    // Here ypu can add your custom config override\n    {\n      files: ['.prettierrc.json'],\n      options: {\n        printWidth: 80,\n      },\n    },\n  ],\n};\n```\n\nThe order of included options is respected. Be careful of options\n\n### Publish a package for your config file (🚧 WIP)\n\nYou can create a package that builds the config, using Typescript directly.\n\nCheck [this example](./examples/shareable-typescript) using unbuild to create a config.\n\n🚧 WIP\n\n<!-- TODO: Add instructions-->\n\n## IDEs\n\n### VS Code\n\nCheck the [.vscode](./.vscode/) directory for extensions and settings recommendations.\n\n## Sponsors\n\n- [Joinnus](https://www.joinnus.com/)\n\n## License\n\nLicensed under the [Apache License, Version 2.0](./NOTICE).\n","readmeFilename":"README.md"}