Skip to content

Commit

Permalink
chore(prettier): upgrade prettier to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnAlbin committed Nov 1, 2023
1 parent d5408ad commit 4bba890
Show file tree
Hide file tree
Showing 10 changed files with 790 additions and 442 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx pretty-quick --staged
npx lint-staged
3 changes: 3 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*": "prettier --write"
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v18
34 changes: 23 additions & 11 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
cache
.cache
# Ignore everything.
/*

# Don't ignore some files in the root directory.
!/*.js
!/*.ts
!/*.md
!/*.json

# Don't ignore these nested directories.
!/examples
!/modules
!/packages
!/scripts
!/starters
!/test
!/www

# In any nested folder, ignore these paths:
.next
CHANGELOG.md
composer.json
dist
package.json
package-lock.json
public
CHANGELOG.md
.yarn
packages/codemod/transforms/__testfixtures__/**/*
packages/codemod/transforms/__tests__/**/*
packages/codemod/**/*.js
packages/codemod/**/*.d.ts
dist
.next
/drupal
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"semi": false,
"trailingComma": "es5",
"overrides": [
{
"files": "modules/**/*",
Expand Down
2 changes: 1 addition & 1 deletion examples/example-query/types/drupal/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface FieldTextFormatted {

export type FieldEntityReference<
Types,
Cardinality extends FieldCardinality = "limited"
Cardinality extends FieldCardinality = "limited",
> = Cardinality extends "unlimited" ? Array<Partial<Types>> : Partial<Types>

export type FieldList<List> = keyof List
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,24 @@
"@typescript-eslint/parser": "^5.62.0",
"cypress": "^9.7.0",
"eslint": "^8.51.0",
"eslint-config-prettier": "^8.10.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"faker": "^6.6.6",
"husky": "^8.0.3",
"isomorphic-fetch": "^3.0.0",
"jest": "^27.5.1",
"lerna": "^4.0.0",
"lint-staged": "^15.0.2",
"microbundle": "^0.15.1",
"prettier": "^2.8.8",
"pretty-quick": "^3.1.3",
"prettier": "^3.0.3",
"start-server-and-test": "^1.15.5",
"ts-jest": "^27.1.5",
"ts-node": "^10.9.1",
"turbo": "^1.10.15",
"typescript": "^4.9.5",
"uuid": "^9.0.1",
"yaml": "^2.3.3"
},
"engines": {
"node": ">=16.19.0"
}
}
20 changes: 10 additions & 10 deletions packages/next-drupal-query/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ type Queries<Q> = Record<
type QueryTypeOf<
Q extends Queries<Q>,
T extends keyof Q,
F extends "params" | "data" | "formatter" | "placeholder"
F extends "params" | "data" | "formatter" | "placeholder",
> = Q[T][F]

// type QueryId<Q = null> = keyof Q
Expand All @@ -200,7 +200,7 @@ type QueryDataOpts<Q extends Queries<Q>, T extends keyof Q> = Parameters<

type QueryPlaceholderDataOpts<
Q extends Queries<Q>,
T extends keyof Q
T extends keyof Q,
> = Parameters<Q[T]["placeholder"]>[0]

type QueryFormatterInput<Q extends Queries<Q>, T extends keyof Q> = Parameters<
Expand All @@ -213,7 +213,7 @@ type QueryDataReturn<Q extends Queries<Q>, T extends keyof Q> = ReturnType<

type QueryPlaceholderDataReturn<
Q extends Queries<Q>,
T extends keyof Q
T extends keyof Q,
> = ReturnType<QueryTypeOf<Q, T, "placeholder">>

type QueryFormatterReturn<Q extends Queries<Q>, T extends keyof Q> = ReturnType<
Expand Down Expand Up @@ -268,7 +268,7 @@ export function massageRouteQuery(query) {
export function createQueries<Q extends Readonly<Queries<Q>>>(queries: Q) {
const getRawData = async <
T extends ConditionalKeys<Q, { data }>,
O extends QueryDataOpts<Q, T>
O extends QueryDataOpts<Q, T>,
>(
id: T,
opts: O = null
Expand Down Expand Up @@ -305,7 +305,7 @@ export function createQueries<Q extends Readonly<Queries<Q>>>(queries: Q) {

const getPlaceholderData = async <
T extends ConditionalKeys<Q, { data }>,
O extends QueryPlaceholderDataOpts<Q, T>
O extends QueryPlaceholderDataOpts<Q, T>,
>(
id: T,
opts: O = null
Expand All @@ -328,7 +328,7 @@ export function createQueries<Q extends Readonly<Queries<Q>>>(queries: Q) {

const formatData = <
T extends ConditionalKeys<Q, { formatter }>,
Input extends QueryFormatterInput<Q, T>
Input extends QueryFormatterInput<Q, T>,
>(
id: T,
input: Input
Expand Down Expand Up @@ -357,17 +357,17 @@ export function createQueries<Q extends Readonly<Queries<Q>>>(queries: Q) {

async function getData<
T extends ConditionalKeys<Q, { formatter; data }>,
O extends QueryDataOpts<Q, T>
O extends QueryDataOpts<Q, T>,
>(id: T, opts?: O): Promise<QueryFormatterReturn<Q, T>>

async function getData<
T extends ConditionalKeys<Q, { data }>,
O extends QueryDataOpts<Q, T>
O extends QueryDataOpts<Q, T>,
>(id: T, opts?: O): Promise<QueryDataReturn<Q, T>>

async function getData<
T extends ConditionalKeys<Q, { placeholder }>,
O extends QueryPlaceholderDataOpts<Q, T>
O extends QueryPlaceholderDataOpts<Q, T>,
>(id: T, opts?: O): Promise<QueryPlaceholderDataReturn<Q, T>>

async function getData(id, opts = null) {
Expand Down Expand Up @@ -412,7 +412,7 @@ export function createQueries<Q extends Readonly<Queries<Q>>>(queries: Q) {
},
getParams: <
T extends ConditionalKeys<Q, { params }>,
O extends QueryParamsOpts<Q, T>
O extends QueryParamsOpts<Q, T>,
>(
id: T = null,
opts: O = null
Expand Down
5 changes: 2 additions & 3 deletions www/content/features/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const tags = await drupal.getResourceCollection<DrupalTaxonomyTerm[]>(

```ts
// Any resource type.
const resources = await drupal.getResourceCollection<JsonApiResource[]>(
"entity--bundle"
)
const resources =
await drupal.getResourceCollection<JsonApiResource[]>("entity--bundle")
```
Loading

0 comments on commit 4bba890

Please sign in to comment.