Skip to content

Commit d3ae7c9

Browse files
authored
run prettier on everything (#745)
1 parent b47b4cb commit d3ae7c9

File tree

125 files changed

+7566
-6651
lines changed

Some content is hidden

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

125 files changed

+7566
-6651
lines changed

.eslintrc.cjs

+31-30
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,38 @@ module.exports = {
1313
'@ephys/eslint-config-typescript/commonjs',
1414
'plugin:mdx/recommended',
1515
],
16-
rules: {
17-
// there are not supported enough in recent browsers to justify enforcing their usage
18-
'prefer-object-has-own': 'off',
19-
'unicorn/prefer-at': 'off',
20-
'unicorn/prefer-string-replace-all': 'off',
21-
22-
'unicorn/prefer-spread': 'off',
23-
'unicorn/no-useless-undefined': 'off',
24-
},
25-
overrides: [{
26-
files: ['*.mdx/**', '*.md/**'],
27-
rules: {
28-
// these rules require proper type-checking and cannot be enabled on code snippets inside markdown files
29-
'@typescript-eslint/dot-notation': 'off',
30-
'@typescript-eslint/return-await': 'off',
31-
'@typescript-eslint/no-throw-literal': 'off',
32-
'@typescript-eslint/no-implied-eval': 'off',
33-
'@typescript-eslint/no-floating-promises': 'off',
34-
'@typescript-eslint/no-misused-promises': 'off',
35-
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
36-
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
37-
'@typescript-eslint/prefer-includes': 'off',
38-
'@typescript-eslint/prefer-readonly': 'off',
39-
'@typescript-eslint/prefer-string-starts-ends-with': 'off',
40-
'@typescript-eslint/restrict-plus-operands': 'off',
41-
'@typescript-eslint/require-array-sort-compare': 'off',
42-
'@typescript-eslint/promise-function-async': 'off',
43-
'@typescript-eslint/consistent-type-exports': 'off',
44-
'@typescript-eslint/prefer-return-this-type': 'off',
16+
overrides: [
17+
{
18+
files: ['*.mdx/**', '*.md/**'],
19+
rules: {
20+
// these rules require proper type-checking and cannot be enabled on code snippets inside markdown files
21+
'@typescript-eslint/dot-notation': 'off',
22+
'@typescript-eslint/return-await': 'off',
23+
'@typescript-eslint/no-throw-literal': 'off',
24+
'@typescript-eslint/no-implied-eval': 'off',
25+
'@typescript-eslint/no-floating-promises': 'off',
26+
'@typescript-eslint/no-misused-promises': 'off',
27+
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
28+
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
29+
'@typescript-eslint/prefer-includes': 'off',
30+
'@typescript-eslint/prefer-readonly': 'off',
31+
'@typescript-eslint/prefer-string-starts-ends-with': 'off',
32+
'@typescript-eslint/restrict-plus-operands': 'off',
33+
'@typescript-eslint/require-array-sort-compare': 'off',
34+
'@typescript-eslint/promise-function-async': 'off',
35+
'@typescript-eslint/consistent-type-exports': 'off',
36+
'@typescript-eslint/prefer-return-this-type': 'off',
37+
},
4538
},
46-
}],
39+
{
40+
files: ['*.d.ts', 'src/pages/*', 'src/theme/**/*'],
41+
rules: {
42+
// in .d.ts files, we don't really have a choice as it's dictated by the file that's being typed.
43+
// For pages and theme files, docusaurus imposes the default export
44+
'import/no-default-export': 'off',
45+
},
46+
},
47+
],
4748
ignorePatterns: [
4849
// archives
4950
'static/v1',
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
name: 📗 Documentation Issue
33
about: Documentation is unclear, or otherwise insufficient/misleading, examples aren't working as expected
4-
title: ""
5-
labels: ""
6-
assignees: ""
4+
title: ''
5+
labels: ''
6+
assignees: ''
77
---
88

99
## Issue Description
@@ -14,12 +14,8 @@ Try to be as clear as possible. Don't assume that the maintainers will immediate
1414

1515
### What was unclear/insufficient/not covered in the documentation
1616

17-
18-
1917
### If possible: Provide some suggestion on how we can enhance the docs
2018

21-
22-
2319
### Additional context
2420

2521
<-- Add any other context or screenshots about the issue here. -->

.github/workflows/draft.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ jobs:
2020
node-version: 20.x
2121
cache: yarn
2222
- run: yarn install --frozen-lockfile
23-
- run: yarn lint-no-fix
24-
- run: yarn lint-scss-no-fix
25-
- run: yarn typecheck
23+
- run: yarn test:format
24+
- run: yarn test:typings
2625
- run: yarn sync
2726
- run: yarn build
2827
- name: Deploy to Draft to Netlify

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
node-version: 20.x
1919
cache: yarn
2020
- run: yarn install --frozen-lockfile
21-
- run: yarn lint-no-fix
22-
- run: yarn typecheck
21+
- run: yarn test:format
22+
- run: yarn test:typings
2323
- run: yarn sync
2424
- run: yarn build
2525
- name: Prepare Netlify dependencies

.prettierignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.yarn
2+
static/v5
3+
static/v4
4+
static/v3
5+
static/v2
6+
static/v1

.prettierrc.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"singleQuote": true
2+
"bracketSameLine": true,
3+
"printWidth": 100,
4+
"singleQuote": true,
5+
"arrowParens": "avoid"
36
}

docs/_fragments/_uuid-support-table.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { DialectTableFilter } from '@site/src/components/dialect-table-filter.ts
33
<DialectTableFilter>
44

55
| | PostgreSQL | MariaDB | MySQL | MSSQL | SQLite | Snowflake | db2 | ibmi |
6-
|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------|----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|--------|-----------|-----|------|
6+
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ------ | --------- | --- | ---- |
77
| `uuidV1` | [`uuid_generate_v1`](https://www.postgresql.org/docs/current/uuid-ossp.html) (requires `uuid-ossp`) | [`UUID`](https://mariadb.com/kb/en/uuid/) | [`UUID`](https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_uuid) | N/A | N/A | N/A | N/A | N/A |
8-
| `uuidV4` | __pg >= v13__: [`gen_random_uuid`](https://www.postgresql.org/docs/current/functions-uuid.html) <br/>__pg &lt; v13__: [`uuid_generate_v4`](https://www.postgresql.org/docs/current/uuid-ossp.html) (requires `uuid-ossp`) | N/A | N/A | [`NEWID`](https://learn.microsoft.com/en-us/sql/t-sql/functions/newid-transact-sql?view=sql-server-ver16) | N/A | N/A | N/A | N/A |
8+
| `uuidV4` | **pg >= v13**: [`gen_random_uuid`](https://www.postgresql.org/docs/current/functions-uuid.html) <br/>**pg &lt; v13**: [`uuid_generate_v4`](https://www.postgresql.org/docs/current/uuid-ossp.html) (requires `uuid-ossp`) | N/A | N/A | [`NEWID`](https://learn.microsoft.com/en-us/sql/t-sql/functions/newid-transact-sql?view=sql-server-ver16) | N/A | N/A | N/A | N/A |
99

1010
</DialectTableFilter>

docs/associations/association-scopes.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ SELECT * FROM `restaurants` WHERE `restaurants`.`status` = 'open' AND `restauran
5252

5353
## BelongsToMany scope
5454

55-
All associations support specifying a scope to filter the target model, but the `BelongsToMany` association
55+
All associations support specifying a scope to filter the target model, but the `BelongsToMany` association
5656
also supports specifying a scope to filter the join table. This is useful when you want to filter based on extra information
5757
stored in the join table.
5858

@@ -71,7 +71,7 @@ class Person extends Model {}
7171
class Game extends Model {
7272
/** This association will list everyone that worked on the game */
7373
@BelongsToMany(() => Person, {
74-
through: GameAuthor
74+
through: GameAuthor,
7575
})
7676
allAuthors;
7777
}
@@ -89,10 +89,10 @@ class Game extends Model {
8989
otherKey: 'personId',
9090
})
9191
allAuthors;
92-
92+
9393
/** This association will list everyone that worked on the game as a programmer */
9494
@BelongsToMany(() => Person, {
95-
through: {
95+
through: {
9696
model: GameAuthor,
9797
foreignKey: 'gameId',
9898
otherKey: 'personId',
@@ -101,7 +101,7 @@ class Game extends Model {
101101
},
102102
})
103103
programmers;
104-
104+
105105
/** This association will list everyone that worked on the game as a designer */
106106
@BelongsToMany(() => Person, {
107107
through: {

docs/associations/basics.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ title: Basics
55

66
# Association Basics
77

8-
Sequelize provides what are called __associations__.
9-
These can be declared on your models to define common [__relationships__](https://en.wikipedia.org/wiki/Cardinality_(data_modeling)) between your tables.
8+
Sequelize provides what are called **associations**.
9+
These can be declared on your models to define common [**relationships**](<https://en.wikipedia.org/wiki/Cardinality_(data_modeling)>) between your tables.
1010

11-
The two concepts are closely related, but not the same. __Associations__ are defined in JavaScript between your _models_, while
12-
__relationships__ are defined in your database between your _tables_.
11+
The two concepts are closely related, but not the same. **Associations** are defined in JavaScript between your _models_, while
12+
**relationships** are defined in your database between your _tables_.
1313

1414
Sequelize supports the standard associations: [One-To-One](https://en.wikipedia.org/wiki/One-to-one_%28data_model%29), [One-To-Many](https://en.wikipedia.org/wiki/One-to-many_%28data_model%29) and [Many-To-Many](https://en.wikipedia.org/wiki/Many-to-many_%28data_model%29).
1515

1616
## One-to-one Relationships
1717

18-
In a One-To-One relationship, a row of one table is associated with a single row of another table.
18+
In a One-To-One relationship, a row of one table is associated with a single row of another table.
1919

2020
The most common type of One-To-One relationship is one where one side is mandatory, and the other side is optional.
2121
For instance, a driving license always belongs to a single person, but a person can have zero or one driving licenses <small>(from the same place)</small>.
@@ -25,7 +25,7 @@ erDiagram
2525
people ||--o| driving_licenses : drivingLicense
2626
```
2727

28-
One-To-One relationships can be created by using __the [`HasOne`](./has-one.md) association__.
28+
One-To-One relationships can be created by using **the [`HasOne`](./has-one.md) association**.
2929

3030
## One-to-many Relationships
3131

@@ -38,7 +38,7 @@ erDiagram
3838
people ||--o{ cities : birthplace
3939
```
4040

41-
One-To-Many relationships can be created by using __the [`HasMany`](./has-many.md) association__.
41+
One-To-Many relationships can be created by using **the [`HasMany`](./has-many.md) association**.
4242

4343
## Many-to-many Relationships
4444

@@ -51,4 +51,4 @@ erDiagram
5151
people }o--o{ toots : likedToots
5252
```
5353

54-
Many-To-Many relationships can be created by using __the [`BelongsToMany`](./belongs-to-many.md) association__.
54+
Many-To-Many relationships can be created by using **the [`BelongsToMany`](./belongs-to-many.md) association**.

docs/associations/belongs-to-many.md

+32-19
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: BelongsToMany
55

66
# The BelongsToMany Association
77

8-
The BelongsToMany association is used to create a [Many-To-Many relationship](https://en.wikipedia.org/wiki/Many-to-many_(data_model)) between two models.
8+
The BelongsToMany association is used to create a [Many-To-Many relationship](<https://en.wikipedia.org/wiki/Many-to-many_(data_model)>) between two models.
99

1010
In a Many-To-Many relationship, a row of one table is associated with _zero, one or more_ rows of another table, and vice versa.
1111

@@ -16,7 +16,7 @@ erDiagram
1616
people }o--o{ toots : likedToots
1717
```
1818

19-
Because foreign keys can only point to a single row, Many-To-Many relationships are implemented using a junction table (called __through table__ in Sequelize), and are
19+
Because foreign keys can only point to a single row, Many-To-Many relationships are implemented using a junction table (called **through table** in Sequelize), and are
2020
really just two One-To-Many relationships.
2121

2222
```mermaid
@@ -54,7 +54,7 @@ and will receive the two foreign keys: `userId` and `tootId`.
5454

5555
:::caution String `through` option
5656

57-
The `through` option is used to specify the through __model__, not the through __table__.
57+
The `through` option is used to specify the through **model**, not the through **table**.
5858
We recommend that you follow the same naming conventions as other models (i.e. PascalCase & singular):
5959

6060
```ts
@@ -72,11 +72,17 @@ class Person extends Model<InferAttributes<Person>, InferCreationAttributes<Pers
7272

7373
## Customizing the Junction Table
7474

75-
The junction table can be customized by creating the model yourself, and passing it to the `through` option.
75+
The junction table can be customized by creating the model yourself, and passing it to the `through` option.
7676
This is useful if you want to add additional attributes to the junction table.
7777

7878
```ts
79-
import { Model, DataTypes, InferAttributes, InferCreationAttributes, NonAttribute } from '@sequelize/core';
79+
import {
80+
Model,
81+
DataTypes,
82+
InferAttributes,
83+
InferCreationAttributes,
84+
NonAttribute,
85+
} from '@sequelize/core';
8086
import { BelongsToMany, Attribute, NotNull } from '@sequelize/core/decorators-legacy';
8187
import { PrimaryKey } from './attribute.js';
8288

@@ -150,7 +156,7 @@ erDiagram
150156
Person }o--o{ Toot : "⬇️ likedToots / ⬆️ likers"
151157
```
152158

153-
Their names are automatically generated based on the name of the BelongsToMany association,
159+
Their names are automatically generated based on the name of the BelongsToMany association,
154160
and the name of its inverse association.
155161

156162
You can customize the names of these associations by using the `throughAssociations` options:
@@ -167,11 +173,11 @@ class Person extends Model<InferAttributes<Person>, InferCreationAttributes<Pers
167173
// 1️⃣ The name of the association going from the source model (Person)
168174
// to the through model (LikedToot)
169175
fromSource: 'likedTootsLikers',
170-
171-
// 2️⃣ The name of the association going from the through model (LikedToot)
176+
177+
// 2️⃣ The name of the association going from the through model (LikedToot)
172178
// to the source model (Person)
173179
toSource: 'liker',
174-
180+
175181
// 3️⃣ The name of the association going from the target model (Toot)
176182
// to the through model (LikedToot)
177183
fromTarget: 'likersLikedToots',
@@ -188,8 +194,8 @@ class Person extends Model<InferAttributes<Person>, InferCreationAttributes<Pers
188194

189195
## Foreign Keys Names
190196

191-
Sequelize will generate foreign keys automatically based on the names of your associations.
192-
It is the name of your association + the name of the attribute the association is pointing to (which defaults to the primary key).
197+
Sequelize will generate foreign keys automatically based on the names of your associations.
198+
It is the name of your association + the name of the attribute the association is pointing to (which defaults to the primary key).
193199

194200
In the example above, the foreign keys would be `likerId` and `likedTootId`, because the associations are called `likedToots` and `likers`,
195201
and the primary keys referenced by the foreign keys are both called `id`.
@@ -220,7 +226,7 @@ class Person extends Model<InferAttributes<Person>, InferCreationAttributes<Pers
220226
By default, Sequelize will use the primary key of the source & target models as the attribute the foreign key references.
221227
You can customize this by using the `sourceKey` & `targetKey` option.
222228

223-
The `sourceKey` option is the attribute from the model on which the association is defined,
229+
The `sourceKey` option is the attribute from the model on which the association is defined,
224230
and the `targetKey` is the attribute from the target model.
225231

226232
```ts
@@ -243,7 +249,7 @@ class Person extends Model<InferAttributes<Person>, InferCreationAttributes<Pers
243249

244250
## Through Pair Unique Constraint
245251

246-
The BelongsToMany association creates a unique key on the foreign keys of the through model.
252+
The BelongsToMany association creates a unique key on the foreign keys of the through model.
247253

248254
This unique key name can be changed using the `through.unique` option. You can also set it to `false` to disable the unique constraint altogether.
249255

@@ -337,7 +343,10 @@ There are two versions of this method:
337343
- `add<PluralAssociationName>`: Associates multiple new models.
338344

339345
```ts
340-
import { BelongsToManyAddAssociationMixin, BelongsToManyAddAssociationsMixin } from '@sequelize/core';
346+
import {
347+
BelongsToManyAddAssociationMixin,
348+
BelongsToManyAddAssociationsMixin,
349+
} from '@sequelize/core';
341350

342351
class Author extends Model<InferAttributes<Author>, InferCreationAttributes<Author>> {
343352
@BelongsToMany(() => Book, { through: 'BookAuthor' })
@@ -386,9 +395,11 @@ There are two versions of this method:
386395
- `remove<SingularAssociationName>`: Removes a single associated model.
387396
- `remove<PluralAssociationName>`: Removes multiple associated models.
388397

389-
390398
```ts
391-
import { BelongsToManyRemoveAssociationMixin, BelongsToManyRemoveAssociationsMixin } from '@sequelize/core';
399+
import {
400+
BelongsToManyRemoveAssociationMixin,
401+
BelongsToManyRemoveAssociationsMixin,
402+
} from '@sequelize/core';
392403

393404
class Author extends Model<InferAttributes<Author>, InferCreationAttributes<Author>> {
394405
@BelongsToMany(() => Book, { through: 'BookAuthor' })
@@ -462,8 +473,7 @@ In the example above, we did not need to specify the `postId` attribute. This is
462473
If you use TypeScript, you need to let TypeScript know that the foreign key is not required. You can do so using the second generic argument of the `BelongsToManyCreateAssociationMixin` type.
463474

464475
```ts
465-
BelongsToManyCreateAssociationMixin<Book, 'postId'>
466-
^ Here
476+
BelongsToManyCreateAssociationMixin<Book, 'postId'> ^ Here;
467477
```
468478

469479
:::
@@ -476,7 +486,10 @@ The association checker is used to check if a model is associated with another m
476486
- `has<PluralAssociationName>`: Checks whether all the specified models are associated.
477487

478488
```ts
479-
import { BelongsToManyHasAssociationMixin, BelongsToManyHasAssociationsMixin } from '@sequelize/core';
489+
import {
490+
BelongsToManyHasAssociationMixin,
491+
BelongsToManyHasAssociationsMixin,
492+
} from '@sequelize/core';
480493

481494
class Author extends Model<InferAttributes<Author>, InferCreationAttributes<Author>> {
482495
@BelongsToMany(() => Book, { through: 'BookAuthor' })

0 commit comments

Comments
 (0)