Skip to content

Commit

Permalink
Replace eslint jsdoc with tsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
w1am committed May 2, 2024
1 parent fe69991 commit 1de0bae
Show file tree
Hide file tree
Showing 43 changed files with 202 additions and 203 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist
generated
protos
**/*.js
**/*.test.ts
21 changes: 3 additions & 18 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "jsdoc"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jsdoc/recommended",
],
plugins: ["@typescript-eslint", "eslint-plugin-tsdoc"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
rules: {
"no-constant-condition": ["error", { checkLoops: false }],
// prettier decides
Expand All @@ -22,17 +18,6 @@ module.exports = {
// better handled by ts itself
"@typescript-eslint/no-unused-vars": ["off"],

"jsdoc/check-alignment": ["off"],
"jsdoc/check-examples": ["warn"],
"jsdoc/check-indentation": ["warn"],
"jsdoc/check-syntax": ["warn"],
"jsdoc/check-tag-names": ["warn", { definedTags: ["jest-environment"] }],
"jsdoc/newline-after-description": ["warn", "never"],
"jsdoc/no-types": ["error", { contexts: ["any"] }],
"jsdoc/require-description": ["warn"],
"jsdoc/require-description-complete-sentence": ["warn"],
"jsdoc/require-jsdoc": ["off"],
"jsdoc/require-param-type": ["off"],
"jsdoc/require-returns": ["off"],
"tsdoc/syntax": "warn",
},
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"docker-compose": "^0.24.7",
"dotenv": "^10.0.0",
"eslint": "^7.32.0",
"eslint-plugin-jsdoc": "^40.3.0",
"eslint-plugin-tsdoc": "^0.2.17",
"get-port": "^5.1.1",
"grpc-tools": "^1.12.4",
"grpc_tools_node_protoc_ts": "^5.3.3",
Expand Down
19 changes: 8 additions & 11 deletions src/Client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,28 @@ interface ClientOptions {
/**
* The amount of time (in milliseconds) to wait after which a keepalive ping is sent on the transport.
* Use -1 to disable.
* @default 10_000
* @defaultValue 10_000
*/
keepAliveInterval?: number;
/**
* The amount of time (in milliseconds) the sender of the keepalive ping waits for an acknowledgement.
* If it does not receive an acknowledgment within this time, it will close the connection.
* @default 10_000
* @defaultValue 10_000
*/
keepAliveTimeout?: number;
/**
* Whether or not to immediately throw an exception when an append fails.
* @default true
* @defaultValue true
*/
throwOnAppendFailure?: boolean;
/**
* An optional length of time (in milliseconds) to use for gRPC deadlines.
* @default 10_000
* @defaultValue 10_000
*/
defaultDeadline?: number;
/**
* The name of the connection to use in logs.
* @default uuid
* @defaultValue uuid
*/
connectionName?: string;
}
Expand Down Expand Up @@ -118,13 +118,11 @@ export interface ChannelCredentialOptions {
*/
rootCertificate?: Buffer;
/**
* This has been deprecated in favor of {@link userKeyFile}.
* @deprecated
* @deprecated Use the new {@link userKeyFile} instead.
*/
privateKey?: Buffer;
/**
* This has been deprecated in favor of {@link userCertFile}.
* @deprecated
* @deprecated Use the new {@link userCertFile} instead.
*/
certChain?: Buffer;
/**
Expand Down Expand Up @@ -165,10 +163,9 @@ export class Client {
#http: HTTP;
#connectionName: string;

// eslint-disable-next-line jsdoc/require-param
/**
* Returns a connection from a connection string.
* @param connectionString The connection string for your database.
* @param connectionString - The connection string for your database.
*/
static connectionString(
connectionString: TemplateStringsArray | string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ declare module "../Client" {
* server remembers where the read offset is. This allows for many different modes of operations compared to a
* regular subscription where the client holds the read offset. The group name must be unique.
* Available from server version 21.10 onwards.
* @param groupName A group name.
* @param settings PersistentSubscription settings.
* @param groupName - A group name.
* @param settings - PersistentSubscription settings.
* @see {@link persistentSubscriptionToStreamSettingsFromDefaults}
* @param options Command options.
* @param options - Command options.
*/
createPersistentSubscriptionToAll(
groupName: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ declare module "../Client" {
* Creates a persistent subscription on a stream. Persistent subscriptions are special kind of subscription where the
* server remembers where the read offset is at. This allows for many different modes of operations compared to a
* regular subscription where the client holds the read offset. The pair stream name and group must be unique.
* @param streamName A stream name.
* @param groupName A group name.
* @param settings PersistentSubscription settings.
* @param streamName - A stream name.
* @param groupName - A group name.
* @param settings - PersistentSubscription settings.
* @see {@link persistentSubscriptionToStreamSettingsFromDefaults}
* @param options Command options.
* @param options - Command options.
*/
createPersistentSubscriptionToStream(
streamName: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ declare module "../Client" {
interface Client {
/**
* Deletes a persistent subscription.
* @param streamName A stream name.
* @param groupName A group name.
* @param options Deletion options.
* @param streamName - A stream name.
* @param groupName - A group name.
* @param options - Deletion options.
*/
deletePersistentSubscriptionToAll(
groupName: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ declare module "../Client" {
interface Client {
/**
* Deletes a persistent subscription.
* @param streamName A stream name.
* @param groupName A group name.
* @param options Deletion options.
* @param streamName - A stream name.
* @param groupName - A group name.
* @param options - Deletion options.
*/
deletePersistentSubscriptionToStream(
streamName: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ declare module "../Client" {
interface Client {
/**
* Gets information and statistics on the specified persistent subscription to $all and its connections.
* @param groupName A group name.
* @param options Get persistent subscription to all options.
* @param groupName - A group name.
* @param options - Get persistent subscription to all options.
*/
getPersistentSubscriptionToAllInfo(
groupName: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ declare module "../Client" {
interface Client {
/**
* Gets information and statistics on the specified persistent subscription and its connections.
* @param streamName A stream name.
* @param groupName A group name.
* @param options Get persistent subscription info options.
* @param streamName - A stream name.
* @param groupName - A group name.
* @param options - Get persistent subscription info options.
*/
getPersistentSubscriptionToStreamInfo(
streamName: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ declare module "../Client" {
interface Client {
/**
* Lists all persistent subscriptions.
* @param options List persistent subscriptions options.
* @param options - List persistent subscriptions options.
*/
listAllPersistentSubscriptions(
options?: ListPersistentSubscriptionsOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ declare module "../Client" {
interface Client {
/**
* Lists persistent subscriptions to the $all stream.
* @param options List persistent subscriptions options.
* @param options - List persistent subscriptions options.
*/
listPersistentSubscriptionsToAll(
options?: ListPersistentSubscriptionsToAllOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ declare module "../Client" {
interface Client {
/**
* Lists persistent subscriptions to a stream.
* @param streamName A stream name.
* @param options List persistent subscriptions options.
* @param streamName - A stream name.
* @param options - List persistent subscriptions options.
*/
listPersistentSubscriptionsToStream(
streamName: string,
Expand Down
6 changes: 3 additions & 3 deletions src/persistentSubscription/replayParkedMessagesToAll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Client } from "../Client";
export interface ReplayParkedMessagesToAllOptions extends BaseOptions {
/**
* When to stop replaying parked messages. Leave undefined to have no limit.
* @default undefined
* @defaultValue undefined
*/
stopAt?: number | bigint;
}
Expand All @@ -21,8 +21,8 @@ declare module "../Client" {
interface Client {
/**
* Replays the parked messages of a persistent subscription to $all.
* @param groupName A group name.
* @param options Replay options.
* @param groupName - A group name.
* @param options - Replay options.
*/
replayParkedMessagesToAll(
groupName: string,
Expand Down
8 changes: 4 additions & 4 deletions src/persistentSubscription/replayParkedMessagesToStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Client } from "../Client";
export interface ReplayParkedMessagesToStreamOptions extends BaseOptions {
/**
* When to stop replaying parked messages. Leave undefined to have no limit.
* @default undefined
* @defaultValue undefined
*/
stopAt?: number | bigint;
}
Expand All @@ -26,9 +26,9 @@ declare module "../Client" {
interface Client {
/**
* Replays the parked messages of a persistent subscription.
* @param streamName A stream name.
* @param groupName A group name.
* @param options Replay options.
* @param streamName - A stream name.
* @param groupName - A group name.
* @param options - Replay options.
*/
replayParkedMessagesToStream(
streamName: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare module "../Client" {
interface Client {
/**
* Restarts the persistent subscription subsystem.
* @param options Restart subsystem options.
* @param options - Restart subsystem options.
*/
restartPersistentSubscriptionSubsystem(
options?: RestartPersistentSubscriptionSubsystemOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface SubscribeToPersistentSubscriptionToAllOptions
extends BaseOptions {
/**
* The buffer size to use for the persistent subscription.
* @default 10
* @defaultValue 10
*/
bufferSize?: number;
}
Expand All @@ -29,9 +29,9 @@ declare module "../Client" {
interface Client {
/**
* Connects to a persistent subscription.
* @param stream A stream name.
* @param group A group name.
* @param options Connection options.
* @param stream - A stream name.
* @param group - A group name.
* @param options - Connection options.
*/
subscribeToPersistentSubscriptionToAll(
groupName: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface SubscribeToPersistentSubscriptionToStreamOptions
extends BaseOptions {
/**
* The buffer size to use for the persistent subscription.
* @default 10
* @defaultValue 10
*/
bufferSize?: number;
}
Expand All @@ -30,9 +30,9 @@ declare module "../Client" {
interface Client {
/**
* Connects to a persistent subscription.
* @param stream A stream name.
* @param group A group name.
* @param options Connection options.
* @param stream - A stream name.
* @param group - A group name.
* @param options - Connection options.
*/
subscribeToPersistentSubscriptionToStream<E extends EventType = EventType>(
streamName: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ declare module "../Client" {
interface Client {
/**
* Updates a persistent subscription to all configuration.
* @param groupName A group name.
* @param settings PersistentSubscriptionToAll settings.
* @param groupName - A group name.
* @param settings - PersistentSubscriptionToAll settings.
* @see {@link persistentSubscriptionToAllSettingsFromDefaults}
* @param options Command options.
* @param options - Command options.
*/
updatePersistentSubscriptionToAll(
groupName: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ declare module "../Client" {
interface Client {
/**
* Updates a persistent subscription configuration.
* @param streamName A stream name.
* @param groupName A group name.
* @param settings PersistentSubscription settings.
* @param streamName - A stream name.
* @param groupName - A group name.
* @param settings - PersistentSubscription settings.
* @see {@link persistentSubscriptionToStreamSettingsFromDefaults}
* @param options Command options.
* @param options - Command options.
*/
updatePersistentSubscriptionToStream(
streamName: string,
Expand Down
Loading

0 comments on commit 1de0bae

Please sign in to comment.