Skip to content

Commit b44b581

Browse files
authored
Update prettier (#897)
1 parent 65c74bd commit b44b581

File tree

10 files changed

+87
-59
lines changed

10 files changed

+87
-59
lines changed

.grenrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module.exports = {
4545
release: function (placeholders) {
4646
placeholders.body = placeholders.body.replace(
4747
"*No changelog for this release.*",
48-
"\n_No changelog for this release._"
48+
"\n_No changelog for this release._",
4949
);
5050
return `## ${placeholders.release} (${placeholders.date})\n${placeholders.body}`;
5151
},

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ app.post(
173173
}),
174174
function (req, res) {
175175
res.redirect("/");
176-
}
176+
},
177177
);
178178
```
179179

@@ -187,7 +187,7 @@ app.get(
187187
passport.authenticate("saml", { failureRedirect: "/", failureFlash: true }),
188188
function (req, res) {
189189
res.redirect("/");
190-
}
190+
},
191191
);
192192
```
193193

@@ -201,7 +201,7 @@ app.get(
201201
}),
202202
function (req, res) {
203203
res.redirect("/");
204-
}
204+
},
205205
);
206206
```
207207

docs/xml-signing-example.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ console.log(
4242
verified: verified,
4343
},
4444
null,
45-
2
46-
)
45+
2,
46+
),
4747
);

package-lock.json

Lines changed: 43 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@
7373
"choma": "^1.2.1",
7474
"concurrently": "^8.2.2",
7575
"eslint": "^8.57.0",
76-
"eslint-config-prettier": "^8.10.0",
77-
"eslint-plugin-prettier": "^4.2.1",
76+
"eslint-config-prettier": "^9.1.0",
77+
"eslint-plugin-prettier": "^5.1.3",
7878
"mocha": "^10.3.0",
7979
"nyc": "^15.1.0",
8080
"onchange": "^7.1.0",
81-
"prettier": "^2.8.8",
81+
"prettier": "^3.2.5",
8282
"prettier-plugin-packagejson": "^2.4.12",
8383
"release-it": "^17.1.1",
8484
"sinon": "^17.0.1",

src/multiSamlStrategy.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ export class MultiSamlStrategy extends AbstractStrategy {
1717
constructor(
1818
options: MultiStrategyConfig,
1919
signonVerify: VerifyWithRequest,
20-
logoutVerify: VerifyWithRequest
20+
logoutVerify: VerifyWithRequest,
2121
);
2222
constructor(
2323
options: MultiStrategyConfig,
2424
signonVerify: VerifyWithoutRequest,
25-
logoutVerify: VerifyWithoutRequest
25+
logoutVerify: VerifyWithoutRequest,
2626
);
2727
constructor(options: MultiStrategyConfig, signonVerify: never, logoutVerify: never) {
2828
if (!options || typeof options.getSamlOptions !== "function") {
@@ -55,7 +55,7 @@ export class MultiSamlStrategy extends AbstractStrategy {
5555

5656
logout(
5757
req: RequestWithUser,
58-
callback: (err: Error | null, url?: string | null | undefined) => void
58+
callback: (err: Error | null, url?: string | null | undefined) => void,
5959
): void {
6060
this._options.getSamlOptions(req, (err, samlOptions) => {
6161
if (err) {
@@ -73,7 +73,7 @@ export class MultiSamlStrategy extends AbstractStrategy {
7373
req: Request,
7474
decryptionCert: string | null,
7575
signingCert: string | string[] | null,
76-
callback: (err: Error | null, metadata?: string) => void
76+
callback: (err: Error | null, metadata?: string) => void,
7777
): void {
7878
if (typeof callback !== "function") {
7979
throw new Error("Metadata can't be provided synchronously for MultiSamlStrategy.");
@@ -89,7 +89,7 @@ export class MultiSamlStrategy extends AbstractStrategy {
8989
Object.setPrototypeOf(strategy, this);
9090
return callback(
9191
null,
92-
this._generateServiceProviderMetadata.call(strategy, decryptionCert, signingCert)
92+
this._generateServiceProviderMetadata.call(strategy, decryptionCert, signingCert),
9393
);
9494
});
9595
}

src/strategy.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ export abstract class AbstractStrategy extends PassportStrategy {
2525
constructor(
2626
options: PassportSamlConfig,
2727
signonVerify: VerifyWithRequest,
28-
logoutVerify: VerifyWithRequest
28+
logoutVerify: VerifyWithRequest,
2929
);
3030
constructor(
3131
options: PassportSamlConfig,
3232
signonVerify: VerifyWithoutRequest,
33-
logoutVerify: VerifyWithoutRequest
33+
logoutVerify: VerifyWithoutRequest,
3434
);
3535
constructor(options: PassportSamlConfig, signonVerify: never, logoutVerify: never) {
3636
super();
@@ -90,15 +90,15 @@ export abstract class AbstractStrategy extends PassportStrategy {
9090
const RelayState = req.query?.RelayState || req.body?.RelayState;
9191
if (this._saml == null) {
9292
return this.error(
93-
new Error("Can't get logout response URL without a SAML provider defined.")
93+
new Error("Can't get logout response URL without a SAML provider defined."),
9494
);
9595
} else {
9696
this._saml.getLogoutResponseUrl(
9797
profile,
9898
RelayState,
9999
options,
100100
userMatch,
101-
redirectIfSuccess
101+
redirectIfSuccess,
102102
);
103103
}
104104

@@ -217,7 +217,7 @@ export abstract class AbstractStrategy extends PassportStrategy {
217217
(req.query && req.query.RelayState) || (req.body && req.body.RelayState);
218218
// Defaults to HTTP-Redirect
219219
this.redirect(
220-
await this._saml.getLogoutUrlAsync(req.user as Profile, RelayState, options)
220+
await this._saml.getLogoutUrlAsync(req.user as Profile, RelayState, options),
221221
);
222222
} catch (err) {
223223
this.error(err as Error);
@@ -242,7 +242,7 @@ export abstract class AbstractStrategy extends PassportStrategy {
242242

243243
protected _generateServiceProviderMetadata(
244244
decryptionCert: string | null,
245-
signingCert?: string | string[] | null
245+
signingCert?: string | string[] | null,
246246
): string {
247247
if (this._saml == null) {
248248
throw new Error("Can't generate service provider metadata without a SAML provider defined.");
@@ -268,7 +268,7 @@ export class Strategy extends AbstractStrategy {
268268

269269
generateServiceProviderMetadata(
270270
decryptionCert: string | null,
271-
signingCert?: string | string[] | null
271+
signingCert?: string | string[] | null,
272272
): string {
273273
return this._generateServiceProviderMetadata(decryptionCert, signingCert);
274274
}

src/types.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ export interface RequestWithUser extends express.Request {
2323
export type VerifiedCallback = (
2424
err: Error | null,
2525
user?: Record<string, unknown>,
26-
info?: Record<string, unknown>
26+
info?: Record<string, unknown>,
2727
) => void;
2828

2929
export type VerifyWithRequest = (
3030
req: express.Request,
3131
profile: Profile | null,
32-
done: VerifiedCallback
32+
done: VerifiedCallback,
3333
) => void;
3434

3535
export type VerifyWithoutRequest = (profile: Profile | null, done: VerifiedCallback) => void;
@@ -38,7 +38,7 @@ export type PassportSamlConfig = SamlConfig & StrategyOptions;
3838

3939
export type StrategyOptionsCallback = (
4040
err: Error | null,
41-
samlOptions?: Partial<PassportSamlConfig>
41+
samlOptions?: Partial<PassportSamlConfig>,
4242
) => void;
4343

4444
interface BaseMultiStrategyConfig {
@@ -50,7 +50,10 @@ export type MultiStrategyConfig = Partial<PassportSamlConfig> &
5050
BaseMultiStrategyConfig;
5151

5252
export class ErrorWithXmlStatus extends Error {
53-
constructor(message: string, public readonly xmlStatus: string) {
53+
constructor(
54+
message: string,
55+
public readonly xmlStatus: string,
56+
) {
5457
super(message);
5558
}
5659
}

test/multiSamlStrategy.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe("MultiSamlStrategy()", function () {
7272
getSamlOptions,
7373
},
7474
noop,
75-
noop
75+
noop,
7676
);
7777
// @ts-expect-error
7878
strategy.authenticate("random", "random");
@@ -120,7 +120,7 @@ describe("MultiSamlStrategy()", function () {
120120
fn(null, samlOptions);
121121
sinon.assert.calledOnce(superAuthenticateStub);
122122
superAuthenticateStub.calledWith(
123-
Object.assign({}, { cacheProvider: "mock cache provider" }, samlOptions)
123+
Object.assign({}, { cacheProvider: "mock cache provider" }, samlOptions),
124124
);
125125
done();
126126
} catch (err2) {
@@ -132,7 +132,7 @@ describe("MultiSamlStrategy()", function () {
132132
// @ts-expect-error
133133
{ getSamlOptions, cacheProvider: "mock cache provider" },
134134
noop,
135-
noop
135+
noop,
136136
);
137137
// @ts-expect-error
138138
strategy.authenticate("random", "random");
@@ -371,7 +371,7 @@ describe("MultiSamlStrategy()", function () {
371371
} catch (err2) {
372372
done(err2);
373373
}
374-
}
374+
},
375375
);
376376
});
377377
});

0 commit comments

Comments
 (0)