{"id":14978230,"url":"https://github.com/antfu/eslint-plugin-format","last_synced_at":"2026-02-07T03:02:28.162Z","repository":{"id":210707505,"uuid":"727268850","full_name":"antfu/eslint-plugin-format","owner":"antfu","description":"Format various languages with formatters in ESLint","archived":false,"fork":false,"pushed_at":"2025-01-08T07:01:36.000Z","size":517,"stargazers_count":154,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-01T03:26:37.520Z","etag":null,"topics":["dprint","eslint-plugin","prettier"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"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/antfu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"github":["antfu"],"open_collective":"antfu"}},"created_at":"2023-12-04T14:25:22.000Z","updated_at":"2025-03-28T12:14:31.000Z","dependencies_parsed_at":"2023-12-04T15:20:23.510Z","dependency_job_id":"3f3be9b4-9c8d-4876-b203-c53949f1717b","html_url":"https://github.com/antfu/eslint-plugin-format","commit_stats":{"total_commits":17,"total_committers":4,"mean_commits":4.25,"dds":"0.17647058823529416","last_synced_commit":"a2f4e908077f3386f80778152b217548c93283bd"},"previous_names":["antfu/eslint-plugin-format"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antfu%2Feslint-plugin-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antfu%2Feslint-plugin-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antfu%2Feslint-plugin-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antfu%2Feslint-plugin-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antfu","download_url":"https://codeload.github.com/antfu/eslint-plugin-format/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247773719,"owners_count":20993639,"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","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":["dprint","eslint-plugin","prettier"],"created_at":"2024-09-24T13:57:06.490Z","updated_at":"2026-02-07T03:02:28.156Z","avatar_url":"https://github.com/antfu.png","language":"TypeScript","funding_links":["https://github.com/sponsors/antfu","https://opencollective.com/antfu"],"categories":["TypeScript"],"sub_categories":[],"readme":"# eslint-plugin-format\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![bundle][bundle-src]][bundle-href]\n[![JSDocs][jsdocs-src]][jsdocs-href]\n[![License][license-src]][license-href]\n\nFormat various languages with formatters in ESLint. Supports [Prettier](https://prettier.io/) and [dprint](https://dprint.dev/). Side-effects-free and fully configurable.\n\n## Usages\n\n### Install\n\n```bash\nnpm i -D eslint-plugin-format\n```\n\n### Configure\n\nThis plugin does not do language detection or reading configure files, you need to specify the language for each file type you want to format along with other formatting options. We recommend using [ESLint's Flat Config format](https://eslint.org/docs/latest/use/configure/configuration-files-new).\n\n```ts\n// eslint.config.js\nimport format from 'eslint-plugin-format'\n\nexport default [\n  // ...other flat configs\n\n  // use Prettier to format CSS\n  {\n    files: ['**/*.css'],\n    languageOptions: {\n      parser: format.parserPlain,\n    },\n    plugins: {\n      format,\n    },\n    rules: {\n      'format/prettier': ['error', { parser: 'css', tabWidth: 2 }],\n    },\n  },\n\n  // use dprint to format TOML\n  {\n    files: ['**/*.toml'],\n    languageOptions: {\n      parser: format.parserPlain,\n    },\n    plugins: {\n      format,\n    },\n    rules: {\n      'format/dprint': ['error', { language: 'toml', languageOptions: { indentWidth: 2 } }],\n    },\n  },\n\n  // use dprint to format HTML and CSS in style tags\n  {\n    files: ['**/*.html'],\n    languageOptions: {\n      parser: format.parserPlain,\n    },\n    plugins: {\n      format,\n    },\n    rules: {\n      'format/dprint': ['error', {\n        plugins: [\n          {\n            plugin: 'node_modules/dprint-plugin-malva/plugin.wasm',\n            options: {},\n          },\n          {\n            plugin: 'node_modules/dprint-plugin-markup/plugin.wasm',\n            options: {\n              scriptIndent: true,\n              styleIndent: true,\n            },\n          },\n        ],\n        useTabs: false,\n        indentWidth: 2,\n      }],\n    },\n  },\n]\n```\n\n## Rules\n\n### `format/prettier`\n\nUse Prettier to format files.\n\n#### Options\n\n- `parser` (required) - the language to format, [Supported languages](https://prettier.io/docs/en/options.html#parser)\n- The rest options are passed as Prettier options\n\n### `format/dprint`\n\nUse dprint to format files.\n\n#### Options\n\nEither:\n- `language` (required) - the language to format, or can be a filepath or URL to the WASM binary. [Supported languages](https://dprint.dev/plugins/)\n- `languageOptions` - the options for the language\n- The rest options are passed as dprint's general options\n\nOr:\n- `plugins` (required) - Array of plugins, defined as an object containing `plugin` (same as `language` above) and `options`, which is the same as `languageOptions` above.\n- The rest of the options are passed as dprint's general options\n\n## Sponsors\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg\"\u003e\n    \u003cimg src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## FAQ\n\n### What's the difference between this and `eslint-plugin-prettier`?\n\nWhile this plugin provides Prettier as one of the formatters, the main difference is that `eslint-plugin-prettier` is much more opinionated toward the Prettier CLI ecosystem. While this plugin only treats Prettier as the side-effects-free formatter and gives you full control in ESLint.\n\n## Credits\n\nThanks to the existing works for references and inspiration.\n\n- [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier)\n- [eslint-plugin-dprint-integration](https://github.com/so1ve/eslint-plugin-dprint-integration)\n\n## License\n\n[MIT](./LICENSE) License © 2023-PRESENT [Anthony Fu](https://github.com/antfu)\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/eslint-plugin-format?style=flat\u0026colorA=080f12\u0026colorB=1fa669\n[npm-version-href]: https://npmjs.com/package/eslint-plugin-format\n[npm-downloads-src]: https://img.shields.io/npm/dm/eslint-plugin-format?style=flat\u0026colorA=080f12\u0026colorB=1fa669\n[npm-downloads-href]: https://npmjs.com/package/eslint-plugin-format\n[bundle-src]: https://img.shields.io/bundlephobia/minzip/eslint-plugin-format?style=flat\u0026colorA=080f12\u0026colorB=1fa669\u0026label=minzip\n[bundle-href]: https://bundlephobia.com/result?p=eslint-plugin-format\n[license-src]: https://img.shields.io/github/license/antfu/eslint-plugin-format.svg?style=flat\u0026colorA=080f12\u0026colorB=1fa669\n[license-href]: https://github.com/antfu/eslint-plugin-format/blob/main/LICENSE\n[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat\u0026colorA=080f12\u0026colorB=1fa669\n[jsdocs-href]: https://www.jsdocs.io/package/eslint-plugin-format\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantfu%2Feslint-plugin-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantfu%2Feslint-plugin-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantfu%2Feslint-plugin-format/lists"}