{"id":13473695,"url":"https://github.com/sheerun/prettier-standard","last_synced_at":"2025-05-14T03:03:20.027Z","repository":{"id":37735302,"uuid":"84959291","full_name":"sheerun/prettier-standard","owner":"sheerun","description":"Formats with Prettier and lints with ESLint+Standard! (✿◠‿◠)","archived":false,"fork":false,"pushed_at":"2024-11-19T05:18:40.000Z","size":523,"stargazers_count":869,"open_issues_count":37,"forks_count":43,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-10T19:51:28.538Z","etag":null,"topics":["eslint","javascript","linting","prettier","standard-js"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/sheerun.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}},"created_at":"2017-03-14T14:35:02.000Z","updated_at":"2025-03-05T16:36:23.000Z","dependencies_parsed_at":"2024-04-06T04:22:32.393Z","dependency_job_id":"4c3764b9-4dcc-463b-996f-357dd3baef7a","html_url":"https://github.com/sheerun/prettier-standard","commit_stats":{"total_commits":247,"total_committers":18,"mean_commits":"13.722222222222221","dds":"0.16194331983805665","last_synced_commit":"1e93300bcb7f4f967a2010df0a41730dcca0a714"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheerun%2Fprettier-standard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheerun%2Fprettier-standard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheerun%2Fprettier-standard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheerun%2Fprettier-standard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sheerun","download_url":"https://codeload.github.com/sheerun/prettier-standard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254059474,"owners_count":22007767,"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":["eslint","javascript","linting","prettier","standard-js"],"created_at":"2024-07-31T16:01:06.039Z","updated_at":"2025-05-14T03:03:19.937Z","avatar_url":"https://github.com/sheerun.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# ![prettier-standard](https://i.imgur.com/F62GQUk.png)\n\n[![Build Status][build-badge]][build] [![version][version-badge]][package] [![Modern Node](https://img.shields.io/badge/modern-node-9BB48F.svg)](https://github.com/sheerun/modern-node)\n\nFormats with [prettier](https://github.com/prettier/prettier) (actually [prettierx](https://github.com/brodybits/prettierx)) and lints with [eslint](https://eslint.org/) preconfigured with [standard](https://github.com/standard/standard) rules (✿◠‿◠)\n\nYou don't have to fix any whitespace errors and waste time configuring eslint presets :relieved:\n\n## Installation\n\n```\nyarn add --dev prettier-standard\n```\n\n\u003e If you're using the [`npm`][npm]: `npm install --save-dev prettier-standard`.\n\n\u003e You can also install globally with `npm install -g prettier-standard`\n\n## Usage\n\nPrettier-standard is best used with `prettier-standard --lint` command which formats and lints all non-ignored files in repository. Here's full usage:\n\n\n```\nUsage\n  $ prettier-standard [\u003cglob\u003e]\n\nOptions\n  --format  Just format all files in current repository\n  --lint    Additionally lint code after formatting\n  --check   Do not format, just check formatting\n  --staged  Run only on staged files\n  --changed Run only on changed files\n  --since   Run only on changed files since given revision\n  --lines   Run only on changed lines (warning: experimental!)\n  --stdin   Force reading input from stdin\n  --parser  Force parser to use for stdin (default: babel)\n  --help    Tells how to use prettier-standard\n\nExamples\n  $ prettier-standard --changed --lint\n  $ prettier-standard --lint '**/*.{js,css}'\n  $ prettier-standard --since master\n  $ \"precommit\": \"prettier-standard --lint --staged\" # in package.json\n  $ echo 'const {foo} = \"bar\";' | prettier-standard --stdin\n  $ echo '.foo { color: \"red\"; }' | prettier-standard --parser css\n```\n\nWarning: `--lines` flag should be considered experimental as prettier has issues with range formatting:\n\n- https://github.com/prettier/prettier/issues/4926\n- https://github.com/prettier/prettier/issues/6428\n\n## Examples\n\nTypically you'll use this in your [npm scripts][npm scripts] (or [package scripts][package scripts]):\n\n```json\n{\n  \"scripts\": {\n    \"format\": \"prettier-standard --format\"\n  }\n}\n```\n\nWe also encourage to use [modern-node](https://github.com/sheerun/modern-node) and [lint-staged](https://github.com/okonet/lint-staged). You can configure it as follows:\n\n```json\n{\n  \"scripts\": {\n    \"precommit\": \"lint-staged\"\n  },\n  \"lint-staged\": {\n    \"*\": [\"prettier-standard --lint\"]\n  }\n}\n```\n\nNOTE: Unlike [prettier](https://github.com/prettier/prettier) this package simplifies your workflow by making `--write` flag a default, and allowing for passing code to stdin without additional `--stdin` flag.\n\n### Vim\n\nIt's probably best to use [ale](https://github.com/w0rp/ale) plugin. It supports multiple fixers, including prettier-standard:\n\n```\nPlug 'w0rp/ale'\nlet g:ale_fixers = {'javascript': ['prettier_standard']}\nlet g:ale_linters = {'javascript': ['']}\nlet g:ale_fix_on_save = 1\n```\n\n### Sublime Text 3\n\nIt's possible to use 'prettier-standard' with Sublime Text 3.\n\n1. Install 'prettier-standard' globally according to the installation instructions above.\n2. Find the location of your installed executable file.\n   On a unix based system (like MacOS):\n\n```curl\n$ which prettier-standard\n```\n\n3. Copy the location. (e.g. `/usr/local/bin/prettier-standard`)\n4. Install [SublimeJsPrettier](https://github.com/jonlabelle/SublimeJsPrettier) according to their installation instructions.\n5. Open SublimeJsPrettier's default settings in Sublime and copy the line: `\"prettier_cli_path\": \"\"`\n6. Open SublimeJsPrettier's user settings in Sublime and add the line with the correct location of the 'prettier-standard' executable.\n\n```json\n{\n  \"prettier_cli_path\": \"/usr/local/bin/prettier-standard\"\n}\n```\n\nYou can now use 'prettier-standard' in Sublime Text 3 by opening the **Command Palette** (super + shift + p) and typing `JsPrettier: Format Code`.\n\n## Customizing\n\nYou can use .prettierrc for overriding some options, e.g to use [semistandard](https://www.npmjs.com/package/semistandard):\n\n```json\n{\n  \"semi\": true\n}\n```\n\nYou can also configure linting by creating appropriate [.eslintrc]() file that will override defaults:\n\n```json\n{\n  \"rules\": {\n    \"eqeqeq\": \"off\"\n  }\n}\n```\n\n\nPrettier-standard includes following packages so you don't need to install them in your repository:\n\n- eslint\n- babel-eslint\n- eslint-config-prettier\n- eslint-config-standard\n- eslint-config-standard-jsx\n- eslint-config-standard-react\n- eslint-config-standard-with-typescript\n- eslint-plugin-import\n- eslint-plugin-jest\n- eslint-plugin-node\n- eslint-plugin-promise\n- eslint-plugin-react\n- eslint-plugin-react-hooks\n- eslint-plugin-standard\n- @typescript-eslint/eslint-plugin\n- @typescript-eslint/parser\n\n\n### Ignoring Files\n\nYou can use `.prettierignore` file for ignoring any files to format, e.g:\n\n```\ndist\n.next\n**/*.ts\n```\n\nYou can also use `.eslintignore` to format some files, but prevent linting others.\n\n### API\n\nprettier-standard exposes the same API as prettier: https://prettier.io/docs/en/api.html\n\nIt also exposes one additional method that works similarly to its CLI:\n\n`run(cwd, config)`\n\n- **cwd** - path where to execute prettier-standard\n- **config** - object configuring execution\n  - **patterns** - patterns to use for formatting files (array of strings)\n  - **check** - whether to check instead of format files (boolean, default: false)\n  - **lint** - whether to perform linting (boolean, default: false)\n  - **changed** - whether to format only changed lines (boolean, experimental, default: false)\n  - **since** - format changes that happened since given branch (string, optional, example: \"master\")\n  - **onProcess** - callback that is called for each processed file matching pattern: { file, formatted, check, runtime }\n\n## LICENSE\n\nMIT\n\n[yarn]: https://yarnpkg.com/\n[npm]: https://www.npmjs.com/\n[node]: https://nodejs.org\n[build-badge]: https://img.shields.io/travis/sheerun/prettier-standard.svg?style=flat-square\n[build]: https://travis-ci.org/sheerun/prettier-standard\n[coverage-badge]: https://img.shields.io/codecov/c/github/sheerun/prettier-standard.svg?style=flat-square\n[coverage]: https://codecov.io/github/sheerun/prettier-standard\n[dependencyci-badge]: https://dependencyci.com/github/sheerun/prettier-standard/badge?style=flat-square\n[dependencyci]: https://dependencyci.com/github/sheerun/prettier-standard\n[version-badge]: https://img.shields.io/npm/v/prettier-standard.svg?style=flat-square\n[package]: https://www.npmjs.com/package/prettier-standard\n[npm scripts]: https://docs.npmjs.com/misc/scripts\n[package scripts]: https://github.com/kentcdodds/p-s\n[glob]: https://github.com/isaacs/node-glob\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheerun%2Fprettier-standard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsheerun%2Fprettier-standard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheerun%2Fprettier-standard/lists"}