Skip to content

Commit e2f788f

Browse files
authored
chore: unify prettier to 3.4.2 (#212)
* chore: unify prettier to 3.4.2 * chore: run root-level prettier:fix * chore: rebuild api reports in all workspaces * add .eslintignore * chore: call eslint fix in all workspaces * handle no-disabled-tests rule * chore: call yarn dedupe
1 parent 68cb7be commit e2f788f

File tree

78 files changed

+590
-396
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+590
-396
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
playwright.config.ts
2+
dist-types
3+
coverage

.github/workflows/automate_changeset_feedback.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ jobs:
4646
bot-username: rhdh-gh-app[bot]
4747
private-key: ${{ secrets.RHDH_GH_APP_PRIVATE_KEY }}
4848
installation-id: ${{ secrets.RHDH_GH_APP_INSTALLATION_ID }}
49-
multiple-workspaces: true
49+
multiple-workspaces: true

.github/workflows/automate_renovate_changesets.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ jobs:
3434
git config --global user.name 'Github changeset workflow'
3535
3636
- name: Generate changesets
37-
run: node ./scripts/ci/generate-bump-changesets.js
37+
run: node ./scripts/ci/generate-bump-changesets.js

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
id: find-changed-workspaces
3030
run: node ./scripts/ci/list-workspaces-with-changes.js
3131
env:
32-
COMMIT_SHA_BEFORE: "${{ github.event.before }}"
32+
COMMIT_SHA_BEFORE: '${{ github.event.before }}'
3333

3434
maybe-release-workspace:
3535
name: Maybe release ${{ matrix.workspace }}

.github/workflows/release_workspace.yml

+9-11
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@ on:
44
workflow_dispatch:
55
inputs:
66
workspace:
7-
description: "Name of the Workspace"
7+
description: 'Name of the Workspace'
88
required: true
99
type: string
1010
force_release:
11-
description: "Force release even if no changesets are present"
11+
description: 'Force release even if no changesets are present'
1212
required: false
1313
type: boolean
1414
branch:
15-
description: "Branch to run the workflow on"
15+
description: 'Branch to run the workflow on'
1616
required: false
17-
default: "main"
17+
default: 'main'
1818
type: string
1919
workflow_call:
2020
inputs:
2121
force_release:
22-
description: "Force release even if no changesets are present"
22+
description: 'Force release even if no changesets are present'
2323
required: false
2424
type: boolean
2525
workspace:
26-
description: "Name of the Workspace"
26+
description: 'Name of the Workspace'
2727
required: true
2828
type: string
2929
branch:
30-
description: "Branch to run the workflow on"
30+
description: 'Branch to run the workflow on'
3131
required: false
32-
default: "main"
32+
default: 'main'
3333
type: string
3434

3535
concurrency:
@@ -102,8 +102,6 @@ jobs:
102102
env:
103103
GITHUB_TOKEN: ${{ secrets.RHDH_BOT_TOKEN }}
104104

105-
106-
107105
release:
108106
name: Release workspace ${{ inputs.workspace }} on branch ${{ inputs.branch }}
109107
runs-on: ubuntu-latest
@@ -157,7 +155,7 @@ jobs:
157155
yarn workspaces foreach -v --no-private npm publish --access public --tolerate-republish
158156
env:
159157
NODE_AUTH_TOKEN: ${{ secrets.RHDH_NPM_TOKEN }}
160-
158+
161159
- name: Create tag
162160
working-directory: ${{ github.workspace }}/scripts/ci
163161
run: node create-tag.js

.github/workflows/version-bump.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
YARN_ENABLE_IMMUTABLE_INSTALLS: false
9898
- name: Run dedupe
9999
working-directory: ./workspaces/${{ matrix.workspace }}
100-
run: yarn dedupe
100+
run: yarn dedupe
101101
- name: 'Check for changes'
102102
id: check_for_changes
103103
run: |

.prettierignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
dist
2+
dist-types
3+
coverage
4+
.vscode
5+
.eslintrc.js
6+
generated
7+
report.api.md
8+
*.hbs

.yarnrc.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ httpTimeout: 300000
44

55
nodeLinker: node-modules
66

7-
npmRegistryServer: "https://registry.npmjs.org/"
7+
npmRegistryServer: 'https://registry.npmjs.org/'
88

99
plugins:
1010
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
11-
spec: "@yarnpkg/plugin-workspace-tools"
11+
spec: '@yarnpkg/plugin-workspace-tools'
1212

1313
yarnPath: .yarn/releases/yarn-3.8.7.cjs

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@backstage/cli": "^0.27.0",
1919
"@backstage/cli-node": "^0.2.2",
2020
"@changesets/parse": "^0.4.0",
21+
"@ianvs/prettier-plugin-sort-imports": "^4.4.0",
2122
"@manypkg/get-packages": "^2.2.2",
2223
"@octokit/rest": "^20.1.1",
2324
"@red-hat-developer-hub/cli": "portal:./workspaces/repo-tools/packages/cli",
@@ -33,7 +34,7 @@
3334
"lint-staged": "^15.2.2",
3435
"lodash.escaperegexp": "^4.1.2",
3536
"node-fetch": "^2.6.7",
36-
"prettier": "^2.3.2"
37+
"prettier": "^3.4.2"
3738
},
3839
"prettier": "@spotify/prettier-config",
3940
"lint-staged": {

scripts/ci/verify-changesets.js

+26-26
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { join } from "path";
19-
import fs from "fs/promises";
20-
import { default as parseChangeset } from "@changesets/parse";
18+
import { join } from 'path';
19+
import fs from 'fs/promises';
20+
import { default as parseChangeset } from '@changesets/parse';
2121

2222
const privatePackages = new Set([
23-
"app",
24-
"backend",
25-
"e2e-test",
26-
"storybook",
27-
"techdocs-cli-embedded-app",
23+
'app',
24+
'backend',
25+
'e2e-test',
26+
'storybook',
27+
'techdocs-cli-embedded-app',
2828
]);
2929

3030
/**
@@ -34,42 +34,42 @@ const privatePackages = new Set([
3434
*/
3535
async function main() {
3636
if (process.argv.length < 3) {
37-
throw new Error("Usage: node verify-changesets.js name-of-the-workspace");
37+
throw new Error('Usage: node verify-changesets.js name-of-the-workspace');
3838
}
3939
const workspace = process.argv[2];
4040

4141
const changesetsFolderPath = join(
4242
import.meta.dirname,
43-
"..",
44-
"..",
45-
"workspaces",
43+
'..',
44+
'..',
45+
'workspaces',
4646
workspace,
47-
".changeset"
47+
'.changeset',
4848
);
4949
const fileNames = await fs.readdir(changesetsFolderPath);
5050
const changesetNames = fileNames.filter(
51-
(name) => name.endsWith(".md") && name !== "README.md"
51+
name => name.endsWith('.md') && name !== 'README.md',
5252
);
5353

5454
const changesets = await Promise.all(
55-
changesetNames.map(async (name) => {
55+
changesetNames.map(async name => {
5656
const content = await fs.readFile(
5757
join(changesetsFolderPath, name),
58-
"utf8"
58+
'utf8',
5959
);
6060
return { name, ...parseChangeset(content) };
61-
})
61+
}),
6262
);
6363

6464
const errors = [];
6565
for (const changeset of changesets) {
66-
const privateReleases = changeset.releases.filter((release) =>
67-
privatePackages.has(release.name)
66+
const privateReleases = changeset.releases.filter(release =>
67+
privatePackages.has(release.name),
6868
);
6969
if (privateReleases.length > 0) {
7070
const names = privateReleases
71-
.map((release) => `'${release.name}'`)
72-
.join(", ");
71+
.map(release => `'${release.name}'`)
72+
.join(', ');
7373
errors.push({
7474
name: changeset.name,
7575
messages: [
@@ -81,9 +81,9 @@ async function main() {
8181

8282
if (errors.length) {
8383
console.log();
84-
console.log("***********************************************************");
85-
console.log("* Changeset verification failed! *");
86-
console.log("***********************************************************");
84+
console.log('***********************************************************');
85+
console.log('* Changeset verification failed! *');
86+
console.log('***********************************************************');
8787
console.log();
8888
for (const error of errors) {
8989
console.error(`Changeset '${error.name}' is invalid:`);
@@ -93,13 +93,13 @@ async function main() {
9393
}
9494
}
9595
console.log();
96-
console.log("***********************************************************");
96+
console.log('***********************************************************');
9797
console.log();
9898
process.exit(1);
9999
}
100100
}
101101

102-
main().catch((error) => {
102+
main().catch(error => {
103103
console.error(error.stack);
104104
process.exit(1);
105105
});

scripts/ci/verify-lockfile-duplicates.js

+25-25
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717

1818
/* eslint-disable @backstage/no-undeclared-imports */
1919

20-
import { execFile as execFileCb } from "child_process";
21-
import { resolve as resolvePath, dirname as dirnamePath } from "path";
22-
import { promisify } from "util";
20+
import { execFile as execFileCb } from 'child_process';
21+
import { resolve as resolvePath, dirname as dirnamePath } from 'path';
22+
import { promisify } from 'util';
2323

2424
const execFile = promisify(execFileCb);
2525

2626
async function findLockFiles() {
2727
// Not using relative paths as this should be run inside a workspace folder
28-
const projectRoot = resolvePath(".");
28+
const projectRoot = resolvePath('.');
2929

30-
let files = process.argv.slice(2).filter((arg) => !arg.startsWith("--"));
30+
let files = process.argv.slice(2).filter(arg => !arg.startsWith('--'));
3131

3232
for (const argumentFile of files) {
3333
if (!argumentFile.match(/(?:^|[\/\\])yarn.lock$/)) {
@@ -37,10 +37,10 @@ async function findLockFiles() {
3737

3838
if (!files.length) {
3939
// List all lock files that are in the root or in an immediate subdirectory
40-
files = ["yarn.lock"];
40+
files = ['yarn.lock'];
4141
}
4242

43-
return files.map((file) => ({
43+
return files.map(file => ({
4444
fileRelativeToProjectRoot: file,
4545
directoryRelativeToProjectRoot: dirnamePath(file),
4646
directoryAbsolute: resolvePath(projectRoot, dirnamePath(file)),
@@ -52,8 +52,8 @@ async function main() {
5252

5353
let fix = false;
5454
for (const arg of process.argv) {
55-
if (arg.startsWith("--")) {
56-
if (arg === "--fix") {
55+
if (arg.startsWith('--')) {
56+
if (arg === '--fix') {
5757
fix = true;
5858
} else {
5959
throw new Error(`Unknown argument ${arg}`);
@@ -62,20 +62,20 @@ async function main() {
6262
}
6363

6464
for (const lockFile of lockFiles) {
65-
console.log("Checking lock file", lockFile.fileRelativeToProjectRoot);
65+
console.log('Checking lock file', lockFile.fileRelativeToProjectRoot);
6666

6767
let stdout;
6868
let stderr;
6969
let failed;
7070

7171
try {
7272
const result = await execFile(
73-
"yarn",
74-
["dedupe", ...(fix ? [] : ["--check"])],
73+
'yarn',
74+
['dedupe', ...(fix ? [] : ['--check'])],
7575
{
7676
shell: true,
7777
cwd: lockFile.directoryAbsolute,
78-
}
78+
},
7979
);
8080
stdout = result.stdout?.trim();
8181
stderr = result.stderr?.trim();
@@ -97,40 +97,40 @@ async function main() {
9797
if (failed) {
9898
if (!fix) {
9999
const command = `yarn${
100-
lockFile.directoryRelativeToProjectRoot === "."
101-
? ""
100+
lockFile.directoryRelativeToProjectRoot === '.'
101+
? ''
102102
: ` --cwd ${lockFile.directoryRelativeToProjectRoot}`
103103
} dedupe`;
104-
const padding = " ".repeat(Math.max(0, 85 - 6 - command.length));
105-
console.error("");
104+
const padding = ' '.repeat(Math.max(0, 85 - 6 - command.length));
105+
console.error('');
106106
console.error(
107-
"*************************************************************************************"
107+
'*************************************************************************************',
108108
);
109109
console.error(
110-
"* You have duplicate versions of some packages in a yarn.lock file. *"
110+
'* You have duplicate versions of some packages in a yarn.lock file. *',
111111
);
112112
console.error(
113-
"* To solve this, run the following command from the project root and commit all *"
113+
'* To solve this, run the following command from the project root and commit all *',
114114
);
115115
console.log(
116-
"* yarn.lock changes. *"
116+
'* yarn.lock changes. *',
117117
);
118118
console.log(
119-
"* *"
119+
'* *',
120120
);
121121
console.log(`* ${command}${padding} *`);
122122
console.error(
123-
"*************************************************************************************"
123+
'*************************************************************************************',
124124
);
125-
console.error("");
125+
console.error('');
126126
}
127127

128128
process.exit(1);
129129
}
130130
}
131131
}
132132

133-
main().catch((error) => {
133+
main().catch(error => {
134134
console.error(error.stack);
135135
process.exit(1);
136136
});

workspaces/bulk-import/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"@spotify/prettier-config": "^12.0.0",
4343
"knip": "^5.27.4",
4444
"node-gyp": "^9.0.0",
45-
"prettier": "^2.3.2",
45+
"prettier": "^3.4.2",
4646
"typescript": "~5.3.0"
4747
},
4848
"resolutions": {

workspaces/bulk-import/packages/app/public/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />

0 commit comments

Comments
 (0)