-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(deps-dev): replace standard with neostandard (#73)
* build(deps-dev): replace standard with neostandard * chore: add eslint.config.js * chore: ignore no-new eslint rule * build: bump neostandard
- Loading branch information
Showing
5 changed files
with
51 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict' | ||
|
||
module.exports = require('neostandard')({ | ||
ignores: require('neostandard').resolveIgnoresFromGitignore(), | ||
ts: true | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,47 @@ | ||
import { expectError, expectType } from "tsd"; | ||
import { Tokens } from ".."; | ||
|
||
Tokens(); | ||
new Tokens(); | ||
Tokens({}); | ||
new Tokens({}); | ||
Tokens({ algorithm: 'sha1' }); | ||
Tokens({ algorithm: 'sha256' }); | ||
Tokens({ saltLength: 10 }); | ||
Tokens({ secretLength: 10 }); | ||
Tokens({ userInfo: true }); | ||
Tokens({ validity: 10000 }); | ||
Tokens({ hmacKey: 'foo' }); | ||
new Tokens({ saltLength: 10 }); | ||
new Tokens({ secretLength: 10 }); | ||
new Tokens({ userInfo: true }); | ||
new Tokens({ validity: 10000 }); | ||
/* eslint-disable no-new -- Testing constructor types, so no need to assign */ | ||
import { expectError, expectType } from 'tsd' | ||
import { Tokens } from '..' | ||
|
||
Tokens() | ||
new Tokens() | ||
Tokens({}) | ||
new Tokens({}) | ||
Tokens({ algorithm: 'sha1' }) | ||
Tokens({ algorithm: 'sha256' }) | ||
Tokens({ saltLength: 10 }) | ||
Tokens({ secretLength: 10 }) | ||
Tokens({ userInfo: true }) | ||
Tokens({ validity: 10000 }) | ||
Tokens({ hmacKey: 'foo' }) | ||
new Tokens({ saltLength: 10 }) | ||
new Tokens({ secretLength: 10 }) | ||
new Tokens({ userInfo: true }) | ||
new Tokens({ validity: 10000 }) | ||
|
||
expectError(Tokens('secret')) | ||
expectError(new Tokens('secret')) | ||
|
||
expectError(new Tokens({}).create('secret', 'userInfo')); | ||
expectError(new Tokens({ userInfo: false}).create('secret', 'userInfo')); | ||
expectError(new Tokens({ userInfo: true }).create('secret')); | ||
expectError(new Tokens({}).create('secret', 'userInfo')) | ||
expectError(new Tokens({ userInfo: false }).create('secret', 'userInfo')) | ||
expectError(new Tokens({ userInfo: true }).create('secret')) | ||
|
||
expectError(new Tokens({}).verify('secret', 'token', 'userinfo')); | ||
expectError(new Tokens({ userInfo: false}).verify('secret', 'token', 'userInfo')); | ||
expectError(new Tokens({ userInfo: true }).verify('secret', 'token')); | ||
expectError(new Tokens({}).verify('secret', 'token', 'userinfo')) | ||
expectError(new Tokens({ userInfo: false }).verify('secret', 'token', 'userInfo')) | ||
expectError(new Tokens({ userInfo: true }).verify('secret', 'token')) | ||
|
||
expectError(new Tokens({ hmacKey: 123 })); | ||
expectError(new Tokens({ hmacKey: 123 })) | ||
|
||
expectType<Promise<string>>(Tokens().secret()); | ||
expectType<Promise<string>>(new Tokens().secret()); | ||
expectType<Promise<string>>(Tokens().secret()) | ||
expectType<Promise<string>>(new Tokens().secret()) | ||
|
||
expectType<void>(Tokens().secret((err, secret ) => { | ||
expectType<Error| null>(err) | ||
expectType<void>(Tokens().secret((err, secret) => { | ||
expectType<Error | null>(err) | ||
expectType<string>(secret) | ||
})); | ||
expectType<void>(new Tokens().secret((err, secret ) => { | ||
expectType<Error| null>(err) | ||
})) | ||
expectType<void>(new Tokens().secret((err, secret) => { | ||
expectType<Error | null>(err) | ||
expectType<string>(secret) | ||
})); | ||
})) | ||
|
||
expectType<string>(Tokens().secretSync()) | ||
expectType<string>(new Tokens().secretSync()) |