From 210247ef9622f2f3f9f9924ce30c68e471353896 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Wed, 15 May 2024 16:39:21 -0700 Subject: [PATCH] chore: add prettier:true to template-oss config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Julian Møller Ellehauge --- .eslintrc.js | 1 + .prettierignore | 14 ++++++++++++++ .prettierrc.js | 8 ++++++++ package.json | 11 ++++++++--- 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc.js diff --git a/.eslintrc.js b/.eslintrc.js index 0c65d1f5..c160050a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -17,5 +17,6 @@ module.exports = { extends: [ '@npmcli', ...localConfigs, + 'prettier', ], } diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..9f89ee15 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,14 @@ +# This file is automatically added by @npmcli/template-oss. Do not edit. + +tap-testdir*/ +tap-snapshots/ +test/fixtures/**/*.json +workspace/test-workspace/** +/.commitlintrc.js +/.eslintrc.js +/.github/ +/.prettierrc.js +/.release-please-manifest.json +/package.json +/release-please-config.json +/tsconfig.json diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 00000000..86dd0cc0 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,8 @@ +/* This file is automatically added by @npmcli/template-oss. Do not edit. */ + +const githubConfig = require('@github/prettier-config') + +module.exports = { + ...githubConfig, + bracketSpacing: true, +} diff --git a/package.json b/package.json index 83cc496c..e6f2c523 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "template-oss-release-manager": "bin/release-manager.js" }, "scripts": { - "lint": "npm run eslint", - "lintfix": "npm run eslint -- --fix", + "lint": "npm run eslint && npm run prettier -- --check", + "lintfix": "npm run eslint -- --fix && npm run prettier -- --write", "posttest": "npm run lint", "snap": "tap", "test": "tap", @@ -19,6 +19,7 @@ "postlint": "template-oss-check", "postinstall": "template-oss-apply", "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", + "prettier": "prettier \"**/*.{js,cjs,ts,mjs,jsx,tsx,json}\"", "test-all": "npm run test -ws -iwr --if-present", "lint-all": "npm run lint -ws -iwr --if-present" }, @@ -66,9 +67,12 @@ "lib/" ], "devDependencies": { + "@github/prettier-config": "0.0.6", "@npmcli/eslint-config": "^4.0.0", "@npmcli/template-oss": "file:./", + "eslint-config-prettier": "^9.1.0", "nock": "^13.3.8", + "prettier": "^3.2.5", "tap": "^16.0.0" }, "tap": { @@ -86,7 +90,8 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "publish": true + "publish": true, + "prettier": true }, "engines": { "node": "^18.17.0 || >=20.5.0"