{"id":13989722,"url":"https://github.com/lipis/prettier-setup","last_synced_at":"2025-05-12T03:31:42.301Z","repository":{"id":48316367,"uuid":"93544325","full_name":"lipis/prettier-setup","owner":"lipis","description":"Basic configuration for Prettier, ESLint and Husky.","archived":false,"fork":false,"pushed_at":"2023-07-18T20:15:32.000Z","size":992,"stargazers_count":180,"open_issues_count":4,"forks_count":23,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-31T23:43:00.011Z","etag":null,"topics":[],"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/lipis.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}},"created_at":"2017-06-06T17:16:58.000Z","updated_at":"2025-01-21T19:02:23.000Z","dependencies_parsed_at":"2024-01-15T16:52:12.753Z","dependency_job_id":null,"html_url":"https://github.com/lipis/prettier-setup","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipis%2Fprettier-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipis%2Fprettier-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipis%2Fprettier-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipis%2Fprettier-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lipis","download_url":"https://codeload.github.com/lipis/prettier-setup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253668057,"owners_count":21944969,"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":[],"created_at":"2024-08-09T13:01:59.846Z","updated_at":"2025-05-12T03:31:42.012Z","avatar_url":"https://github.com/lipis.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# prettier-setup\n\nThis project sets up formatting and linting tools to keep your code clean and consistent, so you never have to argue about style again:\n\n- [Prettier](https://prettier.io) is an opinionated code formatter that enforces a consistent style by parsing your code and re-printing it with its own rules.\n- [ESLint](https://eslint.org) checks JavaScript code for stylistic or programming errors.\n- [Husky](https://github.com/typicode/husky) uses Git hooks to ensure that **Prettier** and **ESLint** run on all staged changes to fix files before committing.\n\nThe setup described here will format JavaScript, JSON, Sass, Markdown, and YAML files, but you can adjust the settings to your own needs.\n\n## Installing ESLint and Prettier\n\nThis step adds ESLint and Prettier to your project's dependencies so they're available locally regardless of the system configuration.\n\n### Install with `yarn`\n\n```bash\nyarn add eslint-{config,plugin}-prettier eslint prettier --dev --exact\n```\n\n\u003cdetails\u003e\u003csummary\u003eInstall with \u003ccode\u003enpm\u003c/code\u003e\u003c/summary\u003e\u003cp\u003e\n\n```bash\nnpm install eslint-{config,plugin}-prettier eslint prettier --save-dev --save-exact\n```\n\n\u003c/p\u003e\u003c/details\u003e\n\n### Set up the scripts\n\nOpen the [`package.json`](/package.json) file in your project and add the following `scripts`\\* entries:\n\n```json\n\"scripts\": {\n  \"fix:other\": \"yarn prettier --write\",\n  \"fix:code\": \"yarn test:code --fix\",\n  \"fix\": \"yarn fix:code \u0026\u0026 yarn fix:other\",\n  \"prettier\": \"prettier \\\"**/*.{json,md,scss,yaml,yml}\\\"\",\n  \"test:other\": \"yarn prettier --list-different\",\n  \"test:code\": \"eslint --ignore-path .gitignore --ignore-path .prettierignore --ext .js,.jsx .\",\n  \"test\": \"yarn test:other \u0026\u0026 yarn test:code\"\n}\n```\n\n\\* If you are using `npm`, replace `yarn` with `npm run` in the above section.\n\n## Installing Husky and commit hooks\n\nSet up Husky and the `lint-staged` commit hooks to format changed files before each commit.\n\n### Install with `yarn`\n\n```bash\nyarn add husky lint-staged --dev --exact\n```\n\n\u003cdetails\u003e\u003csummary\u003eInstall with \u003ccode\u003enpm\u003c/code\u003e\u003c/summary\u003e\u003cp\u003e\n\n```bash\nnpm install husky lint-staged --save-dev --save-exact\n```\n\n\u003c/p\u003e\u003c/details\u003e\n\n### Set up the rules\n\nAdd the `lint-staged` and `husky` rules to the [`package.json`](/package.json) file in your project:\n\n```json\n\"lint-staged\": {\n  \"*.{js,jsx}\": [\"eslint --fix\"],\n  \"*.{json,md,scss,yaml,yml}\": [\"prettier --write\"]\n},\n\"husky\": {\n  \"hooks\": {\n    \"pre-commit\": \"lint-staged\"\n  }\n},\n```\n\n---\n\n\u003cdetails\u003e\u003csummary\u003ePrettier rules\u003c/summary\u003e\u003cp\u003e\n\nThis project defines the following settings in the [`.prettierrc.json`](/.prettierrc.json) file. You can adjust these values according to your own preferences.\n\n| Rule                                                                                                              | Value\\*     |\n| ----------------------------------------------------------------------------------------------------------------- | ----------- |\n| [`arrowParens`](https://prettier.io/docs/en/options.html#arrow-function-parentheses)                              | `avoid`     |\n| [`bracketSpacing`](https://prettier.io/docs/en/options.html#bracket-spacing)                                      | **`false`** |\n| [`endOfLine`](https://prettier.io/docs/en/options.html#end-of-line)                                               | **`lf`**    |\n| [`htmlWhitespaceSensitivity`](https://prettier.io/docs/en/options.html#html-whitespace-sensitivity)               | `css`       |\n| [`jsxBracketSameLine`](https://prettier.io/docs/en/options.html#jsx-brackets)                                     | `false`     |\n| [`printWidth`](https://prettier.io/docs/en/options.html#print-width)                                              | `80`        |\n| [`proseWrap`](https://prettier.io/docs/en/options.html#prose-wrap)                                                | `preserve`  |\n| [`requirePragma`](https://prettier.io/docs/en/options.html#require-pragma)                                        | `false`     |\n| [`semi`](https://prettier.io/docs/en/options.html#semicolons)                                                     | `true`      |\n| [`singleQuote`](https://prettier.io/docs/en/options.html#quotes)                                                  | **`true`**  |\n| [`tabWidth`](https://prettier.io/docs/en/options.html#tab-width)                                                  | `2`         |\n| [`trailingComma`](https://prettier.io/docs/en/options.html#trailing-commas)                                       | **`all`**   |\n| [`useTabs`](https://prettier.io/docs/en/options.html#tabs)                                                        | `false`     |\n| [`vueIndentScriptAndStyle`](https://prettier.io/docs/en/options.html#vue-files-script-and-style-tags-indentation) | **`true`**  |\n\n\\* Values in **bold** differ from the Prettier defaults.\n\n\u003c/p\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eESLint rules\u003c/summary\u003e\u003cp\u003e\n\nAdjust your own rules by updating the [`.eslintrc.json`](/.eslintrc.json).\n\n- [`curly`](https://eslint.org/docs/rules/curly)\n- [`dot-notation`](https://eslint.org/docs/rules/dot-notation)\n- [`id-length`](https://eslint.org/docs/rules/id-length)\n- [`no-const-assign`](https://eslint.org/docs/rules/no-const-assign)\n- [`no-dupe-class-members`](https://eslint.org/docs/rules/no-dupe-class-members)\n- [`no-else-return`](https://eslint.org/docs/rules/no-else-return)\n- [`no-inner-declarations`](https://eslint.org/docs/rules/no-inner-declarations)\n- [`no-lonely-if`](https://eslint.org/docs/rules/no-lonely-if)\n- [`no-magic-numbers`](https://eslint.org/docs/rules/no-magic-numbers)\n- [`no-shadow`](https://eslint.org/docs/rules/no-shadow)\n- [`no-unneeded-ternary`](https://eslint.org/docs/rules/no-unneeded-ternary)\n- [`no-unused-expressions`](https://eslint.org/docs/rules/no-unused-expressions)\n- [`no-unused-vars`](https://eslint.org/docs/rules/no-unused-vars)\n- [`no-useless-return`](https://eslint.org/docs/rules/no-useless-return)\n- [`no-var`](https://eslint.org/docs/rules/no-var)\n- [`one-var`](https://eslint.org/docs/rules/one-var)\n- [`prefer-arrow-callback`](https://eslint.org/docs/rules/prefer-arrow-callback)\n- [`prefer-const`](https://eslint.org/docs/rules/prefer-const)\n- [`prefer-promise-reject-errors`](https://eslint.org/docs/rules/prefer-promise-reject-errors)\n- [`sort-imports`](https://eslint.org/docs/rules/sort-imports)\n- [`sort-keys`](https://eslint.org/docs/rules/sort-keys)\n- [`sort-vars`](https://eslint.org/docs/rules/sort-vars)\n- [`strict`](https://eslint.org/docs/rules/strict)\n  \u003c/p\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eDependencies\u003c/summary\u003e\u003cp\u003e\n\n- [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier)\n- [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier)\n- [eslint](https://github.com/eslint/eslint)\n- [husky](https://github.com/typicode/husky)\n- [lint-staged](https://github.com/okonet/lint-staged)\n- [prettier](https://github.com/prettier/prettier)\n  \u003c/p\u003e\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flipis%2Fprettier-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flipis%2Fprettier-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flipis%2Fprettier-setup/lists"}