Skip to content

Commit 5c9200d

Browse files
committed
Use the shareable Prettier config
1 parent bb5e8df commit 5c9200d

15 files changed

+98
-25
lines changed

Diff for: .prettierignore

+30-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
1-
**/dist/**
2-
**/etc/**
3-
**/temp/**
4-
**/__testfixtures__/**
1+
dist/
2+
temp/
3+
tmp/
4+
__testfixtures__/
5+
build/
6+
lib/
7+
8+
.yalc
9+
yalc.lock
10+
yalc.sig
11+
12+
.idea/
13+
.vscode/
14+
.tmp-projections
15+
coverage/
16+
17+
typesversions
18+
.cache
19+
.yarnrc
20+
.yarn/*
21+
.yarn/releases
22+
**/.yarn/cache
23+
.pnp.*
24+
*.tgz
25+
26+
tsconfig.vitest-temp.json
27+
.eslintcache
28+
29+
.docusaurus/
30+
.next/

Diff for: .prettierrc.json

-4
This file was deleted.

Diff for: package.json

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"@babel/helper-compilation-targets": "^7.23.6",
3232
"@babel/traverse": "^7.24.1",
3333
"@babel/types": "^7.24.0",
34+
"@reduxjs/prettier-config": "workspace:^",
3435
"@types/react": "^19.0.1",
3536
"@types/react-dom": "^19.0.1",
3637
"@typescript-eslint/eslint-plugin": "6.12.0",
@@ -57,6 +58,8 @@
5758
"scripts": {
5859
"build": "yarn build:packages",
5960
"test": "yarn test:packages",
61+
"format": "prettier --write .",
62+
"format-check": "prettier --check .",
6063
"install": "yarn build-configs",
6164
"build-configs": "yarn workspaces foreach -Atip --include '@reduxjs/*config' run build",
6265
"build:examples": "yarn workspaces foreach -A --include '@reduxjs/*' --include '@examples-query-react/*' --include '@examples-action-listener/*' -vtp run build",

Diff for: packages/rtk-codemods/.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__testfixtures__/

Diff for: packages/rtk-codemods/.prettierrc.json

-6
This file was deleted.

Diff for: packages/rtk-codemods/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"name": "@reduxjs/rtk-codemods",
33
"version": "0.1.2",
44
"scripts": {
5+
"format": "prettier --config prettier.config.mjs --write .",
6+
"format-check": "prettier --config prettier.config.mjs --check .",
57
"lint": "eslint .",
68
"test": "vitest --run",
79
"test:watch": "vitest --watch",
@@ -29,6 +31,7 @@
2931
"typescript": "^5.3.3"
3032
},
3133
"devDependencies": {
34+
"@reduxjs/prettier-config": "workspace:^",
3235
"@types/jscodeshift": "^0.11.11",
3336
"@typescript-eslint/parser": "^6.19.1",
3437
"eslint": "^8.56.0",

Diff for: packages/rtk-codemods/prettier.config.mjs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { createPrettierConfig } from '@reduxjs/prettier-config'
2+
3+
export default createPrettierConfig({
4+
trailingComma: 'none'
5+
})

Diff for: packages/rtk-query-codegen-openapi/.prettierrc

-7
This file was deleted.

Diff for: packages/rtk-query-codegen-openapi/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"build": "yarn clean && tsup && chmod +x lib/bin/cli.mjs",
3636
"clean": "rimraf lib",
3737
"prepack": "yarn build && chmod +x lib/bin/cli.mjs",
38-
"format": "prettier --write \"src/**/*.ts\"",
38+
"format": "prettier --config prettier.config.mjs --write .",
39+
"format-check": "prettier --config prettier.config.mjs --check .",
3940
"test:update": "vitest --run --update",
4041
"test:update:enum": "lib/bin/cli.mjs test/config.example.enum.ts",
4142
"test": "vitest --run --typecheck",
@@ -51,6 +52,7 @@
5152
"@babel/preset-env": "^7.12.11",
5253
"@babel/preset-typescript": "^7.12.7",
5354
"@oazapfts/runtime": "^1.0.3",
55+
"@reduxjs/prettier-config": "workspace:^",
5456
"@reduxjs/toolkit": "^1.6.0",
5557
"@types/commander": "^2.12.2",
5658
"@types/glob-to-regexp": "^0.4.0",
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { createPrettierConfig } from '@reduxjs/prettier-config';
2+
3+
export default createPrettierConfig({
4+
printWidth: 120,
5+
semi: true,
6+
trailingComma: 'es5',
7+
});

Diff for: packages/toolkit/.prettierignore

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.DS_Store
2+
*.log
3+
node_modules
4+
dist/
5+
lib
6+
7+
.yalc
8+
yalc.lock
9+
yalc.sig
10+
11+
.idea/
12+
.vscode/
13+
temp/
14+
.tmp-projections
15+
build/
16+
.rts2*
17+
coverage/
18+
19+
typesversions
20+
.cache
21+
.yarnrc
22+
.yarn/*
23+
!.yarn/patches
24+
!.yarn/releases
25+
!.yarn/plugins
26+
!.yarn/sdks
27+
!.yarn/versions
28+
.pnp.*
29+
*.tgz
30+
31+
tsconfig.vitest-temp.json
32+
.eslintcache

Diff for: packages/toolkit/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"@babel/helper-module-imports": "^7.24.7",
5555
"@microsoft/api-extractor": "^7.13.2",
5656
"@phryneas/ts-version": "^1.0.2",
57+
"@reduxjs/prettier-config": "workspace:^",
5758
"@size-limit/file": "^11.0.1",
5859
"@size-limit/webpack": "^11.0.1",
5960
"@testing-library/dom": "^10.4.0",
@@ -107,8 +108,8 @@
107108
"run-build": "tsup",
108109
"build": "yarn clean && yarn run-build && tsx scripts/fixUniqueSymbolExports.mts",
109110
"build-only": "yarn clean && yarn run-build",
110-
"format": "prettier --write \"(src|examples)/**/*.{ts,tsx}\" \"**/*.md\"",
111-
"format:check": "prettier --list-different \"(src|examples)/**/*.{ts,tsx}\" \"docs/*/**.md\"",
111+
"format": "prettier --config prettier.config.mjs --write .",
112+
"format-check": "prettier --config prettier.config.mjs --check .",
112113
"lint": "eslint src examples",
113114
"test": "vitest --typecheck --run ",
114115
"test:watch": "vitest --watch",

Diff for: packages/toolkit/prettier.config.mjs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { createPrettierConfig } from '@reduxjs/prettier-config'
2+
3+
export default createPrettierConfig()

Diff for: prettier.config.mjs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { createPrettierConfig } from '@reduxjs/prettier-config'
2+
3+
export default createPrettierConfig()

Diff for: yarn.lock

+5-1
Original file line numberDiff line numberDiff line change
@@ -7553,7 +7553,7 @@ __metadata:
75537553
languageName: unknown
75547554
linkType: soft
75557555

7556-
"@reduxjs/prettier-config@workspace:packages/configs/prettier":
7556+
"@reduxjs/prettier-config@workspace:^, @reduxjs/prettier-config@workspace:packages/configs/prettier":
75577557
version: 0.0.0-use.local
75587558
resolution: "@reduxjs/prettier-config@workspace:packages/configs/prettier"
75597559
dependencies:
@@ -7574,6 +7574,7 @@ __metadata:
75747574
version: 0.0.0-use.local
75757575
resolution: "@reduxjs/rtk-codemods@workspace:packages/rtk-codemods"
75767576
dependencies:
7577+
"@reduxjs/prettier-config": "workspace:^"
75777578
"@types/jscodeshift": "npm:^0.11.11"
75787579
"@typescript-eslint/parser": "npm:^6.19.1"
75797580
eslint: "npm:^8.56.0"
@@ -7661,6 +7662,7 @@ __metadata:
76617662
"@babel/helper-module-imports": "npm:^7.24.7"
76627663
"@microsoft/api-extractor": "npm:^7.13.2"
76637664
"@phryneas/ts-version": "npm:^1.0.2"
7665+
"@reduxjs/prettier-config": "workspace:^"
76647666
"@size-limit/file": "npm:^11.0.1"
76657667
"@size-limit/webpack": "npm:^11.0.1"
76667668
"@testing-library/dom": "npm:^10.4.0"
@@ -8121,6 +8123,7 @@ __metadata:
81218123
"@babel/preset-env": "npm:^7.12.11"
81228124
"@babel/preset-typescript": "npm:^7.12.7"
81238125
"@oazapfts/runtime": "npm:^1.0.3"
8126+
"@reduxjs/prettier-config": "workspace:^"
81248127
"@reduxjs/toolkit": "npm:^1.6.0"
81258128
"@types/commander": "npm:^2.12.2"
81268129
"@types/glob-to-regexp": "npm:^0.4.0"
@@ -28118,6 +28121,7 @@ __metadata:
2811828121
"@babel/helper-compilation-targets": "npm:^7.23.6"
2811928122
"@babel/traverse": "npm:^7.24.1"
2812028123
"@babel/types": "npm:^7.24.0"
28124+
"@reduxjs/prettier-config": "workspace:^"
2812128125
"@types/react": "npm:^19.0.1"
2812228126
"@types/react-dom": "npm:^19.0.1"
2812328127
"@typescript-eslint/eslint-plugin": "npm:6.12.0"

0 commit comments

Comments
 (0)