Skip to content

Commit

Permalink
Prettier fixes, and release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed May 5, 2024
1 parent f054550 commit 7ef1b6e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@

<!-- Your comment below this -->

- Adds a log when you run on GitHub Actions without being a pull_request - [@orta]
- GitHub: Move to 'List pull request files' API with pagination support [@fabianehlert]

<!-- Your comment above this -->

## 12.2.0

- Adds a log when you run on GitHub Actions without being a pull_request - [@orta]
- GitHub: Move to 'List pull request files' API with pagination support [@fabianehlert]

## 12.1.0

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"test:fixtures": "node ./scripts/run-fixtures.js",
"test:update-fixtures": "yarn test:fixtures --update",
"test:watch": "jest --watch",
"type-check": "tsc --noEmit",
"lint": "eslint \"source/*.ts\" \"source/**/*.ts\"",
"lint:fix": "yarn --silent lint --fix",
"prepublishOnly": "yarn build && yarn jest && yarn declarations && yarn build:flow-types && yarn build:pretty-types",
Expand Down
10 changes: 3 additions & 7 deletions source/commands/init/default-dangerfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,17 @@ export const generateDefaultDangerfile = (state: InitState) => {
${rules.join("\n")}
`
return formatDangerfile(dangerfile, state, dangerfileState)
return formatDangerfile(dangerfile, dangerfileState)
}

export const formatDangerfile = (
dangerfile: string,
initState: InitState,
dangerfileState: ReturnType<typeof generateDangerfileState>
) => {
export const formatDangerfile = (dangerfile: string, dangerfileState: ReturnType<typeof generateDangerfileState>) => {
if (dangerfileState.hasPrettier) {
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { format } = require("prettier")
// Get package settings
const localPrettier = fs.existsSync("package.json") && JSON.parse(fs.readFileSync("package.json", "utf8")).prettier
// Always include this
const always = { editorconfig: true, parser: "typescript", filepath: process.cwd() + " /" + initState.filename }
const always = { editorconfig: true, parser: "typescript" }
const settings = localPrettier ? { ...always, ...localPrettier } : always

return format(dangerfile, settings)
Expand Down

0 comments on commit 7ef1b6e

Please sign in to comment.