Skip to content

Commit 701496a

Browse files
committed
Use the shareable Prettier config
1 parent 0cb8565 commit 701496a

15 files changed

+98
-25
lines changed

.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/

.prettierrc.json

-4
This file was deleted.

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",

packages/rtk-codemods/.prettierignore

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

packages/rtk-codemods/.prettierrc.json

-6
This file was deleted.

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",
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+
})

packages/rtk-query-codegen-openapi/.prettierrc

-7
This file was deleted.

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",
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+
});

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

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",

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()

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()

yarn.lock

+5-1
Original file line numberDiff line numberDiff line change
@@ -7597,7 +7597,7 @@ __metadata:
75977597
languageName: unknown
75987598
linkType: soft
75997599

7600-
"@reduxjs/prettier-config@workspace:packages/configs/prettier":
7600+
"@reduxjs/prettier-config@workspace:^, @reduxjs/prettier-config@workspace:packages/configs/prettier":
76017601
version: 0.0.0-use.local
76027602
resolution: "@reduxjs/prettier-config@workspace:packages/configs/prettier"
76037603
dependencies:
@@ -7618,6 +7618,7 @@ __metadata:
76187618
version: 0.0.0-use.local
76197619
resolution: "@reduxjs/rtk-codemods@workspace:packages/rtk-codemods"
76207620
dependencies:
7621+
"@reduxjs/prettier-config": "workspace:^"
76217622
"@types/jscodeshift": "npm:^0.11.11"
76227623
"@typescript-eslint/parser": "npm:^6.19.1"
76237624
eslint: "npm:^8.56.0"
@@ -7705,6 +7706,7 @@ __metadata:
77057706
"@babel/helper-module-imports": "npm:^7.24.7"
77067707
"@microsoft/api-extractor": "npm:^7.13.2"
77077708
"@phryneas/ts-version": "npm:^1.0.2"
7709+
"@reduxjs/prettier-config": "workspace:^"
77087710
"@size-limit/file": "npm:^11.0.1"
77097711
"@size-limit/webpack": "npm:^11.0.1"
77107712
"@testing-library/dom": "npm:^10.4.0"
@@ -8165,6 +8167,7 @@ __metadata:
81658167
"@babel/preset-env": "npm:^7.12.11"
81668168
"@babel/preset-typescript": "npm:^7.12.7"
81678169
"@oazapfts/runtime": "npm:^1.0.3"
8170+
"@reduxjs/prettier-config": "workspace:^"
81688171
"@reduxjs/toolkit": "npm:^1.6.0"
81698172
"@types/commander": "npm:^2.12.2"
81708173
"@types/glob-to-regexp": "npm:^0.4.0"
@@ -28306,6 +28309,7 @@ __metadata:
2830628309
"@babel/helper-compilation-targets": "npm:^7.23.6"
2830728310
"@babel/traverse": "npm:^7.24.1"
2830828311
"@babel/types": "npm:^7.24.0"
28312+
"@reduxjs/prettier-config": "workspace:^"
2830928313
"@types/react": "npm:^19.0.1"
2831028314
"@types/react-dom": "npm:^19.0.1"
2831128315
"@typescript-eslint/eslint-plugin": "npm:6.12.0"

0 commit comments

Comments
 (0)