-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linter fix #2263
Linter fix #2263
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* eslint no-undef: off */ | ||
module.exports = { | ||
preset: "ts-jest", | ||
transform: { "^.+\\.ts?$": "ts-jest" }, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
}, | ||
"homepage": "https://github.com/valkey-io/valkey-glide#readme", | ||
"dependencies": { | ||
"@eslint/compat": "^1.1.1", | ||
"eslint-config-prettier": "^9.1.0", | ||
"glide-rs": "file:rust-client", | ||
"long": "^5.2.3", | ||
|
@@ -35,7 +36,9 @@ | |
"fix-protobuf-file": "replace 'this\\.encode\\(message, writer\\)\\.ldelim' 'this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim' src/ProtobufMessage.js", | ||
"test": "npm run build-test-utils && jest --verbose --runInBand --testPathIgnorePatterns='RedisModules'", | ||
"build-test-utils": "cd ../utils && npm i && npm run build", | ||
"lint": "eslint -f unix \"src/**/*.{ts,tsx}\"", | ||
"lint:fix": "npm run install-linting && npx eslint -c ../eslint.config.mjs --fix", | ||
"lint": "npm run install-linting && npx eslint -c ../eslint.config.mjs", | ||
Comment on lines
+39
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These should include prettier as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thought about it, didn't know if do or not. If you think so its enough for me, will do. |
||
"install-linting": "cd ../ & npm install", | ||
"prepack": "npmignore --auto", | ||
"prettier:check:ci": "./node_modules/.bin/prettier --check . --ignore-unknown '!**/*.{js,d.ts}'", | ||
"prettier:format": "./node_modules/.bin/prettier --write . --ignore-unknown '!**/*.{js,d.ts}'" | ||
|
@@ -48,11 +51,7 @@ | |
"@types/redis-server": "^1.2.2", | ||
"@types/semver": "^7.5.8", | ||
"@types/uuid": "^10.0.0", | ||
"@typescript-eslint/eslint-plugin": "^8.4.0", | ||
"@typescript-eslint/parser": "^8.4.0", | ||
"babel-jest": "^29.7.0", | ||
"eslint": "^9.10.0", | ||
"eslint-plugin-tsdoc": "^0.3.0", | ||
"find-free-port": "^2.0.0", | ||
"jest": "^29.7.0", | ||
"jest-html-reporter": "^3.10.2", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,12 +250,13 @@ import { | |
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */ | ||
type PromiseFunction = (value?: any) => void; | ||
type ErrorFunction = (error: RedisError) => void; | ||
/* eslint @typescript-eslint/consistent-indexed-object-style: off, @typescript-eslint/consistent-type-definitions: off */ | ||
export type ReturnTypeRecord = { [key: string]: ReturnType }; | ||
export type ReturnTypeMap = Map<string, ReturnType>; | ||
export type ReturnTypeAttribute = { | ||
export interface ReturnTypeAttribute { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why you changed to interface? did you changed it to all types? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interface is recommended by ts since it's behave like the JS under the hood and led to better performance, unless there's a specific need the recommendation is to use interface. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note that it is legal in TypeScript for multiple interfaces with the same name to be created. TypeScript will merge interfaces with the same name. Types cannot be merged. If you try to define the same type twice, TypeScript will throw an error. |
||
value: ReturnType; | ||
attributes: ReturnTypeRecord; | ||
}; | ||
} | ||
export enum ProtocolVersion { | ||
/** Use RESP2 to communicate with the server nodes. */ | ||
RESP2 = connection_request.ProtocolVersion.RESP2, | ||
|
@@ -296,13 +297,13 @@ export enum Decoder { | |
} | ||
|
||
/** An extension to command option types with {@link Decoder}. */ | ||
export type DecoderOption = { | ||
export interface DecoderOption { | ||
/** | ||
* {@link Decoder} type which defines how to handle the response. | ||
* If not set, the {@link BaseClientConfiguration.defaultDecoder|default decoder} will be used. | ||
*/ | ||
decoder?: Decoder; | ||
}; | ||
} | ||
|
||
/** A replacement for `Record<GlideString, T>` - array of key-value pairs. */ | ||
export type GlideRecord<T> = { | ||
|
@@ -411,7 +412,7 @@ class PointerResponse { | |
} | ||
|
||
/** Represents the credentials for connecting to a server. */ | ||
export type RedisCredentials = { | ||
export interface RedisCredentials { | ||
/** | ||
* The username that will be used for authenticating connections to the Valkey servers. | ||
* If not supplied, "default" will be used. | ||
|
@@ -421,7 +422,7 @@ export type RedisCredentials = { | |
* The password that will be used for authenticating connections to the Valkey servers. | ||
*/ | ||
password: string; | ||
}; | ||
} | ||
|
||
/** Represents the client's read from strategy. */ | ||
export type ReadFrom = | ||
|
@@ -434,7 +435,7 @@ export type ReadFrom = | |
/** | ||
* Configuration settings for creating a client. Shared settings for standalone and cluster clients. | ||
*/ | ||
export type BaseClientConfiguration = { | ||
export interface BaseClientConfiguration { | ||
/** | ||
* DNS Addresses and ports of known nodes in the cluster. | ||
* If the server is in cluster mode the list can be partial, as the client will attempt to map out the cluster and find all nodes. | ||
|
@@ -495,9 +496,9 @@ export type BaseClientConfiguration = { | |
* If not set, 'Decoder.String' will be used. | ||
*/ | ||
defaultDecoder?: Decoder; | ||
}; | ||
} | ||
|
||
export type ScriptOptions = { | ||
export interface ScriptOptions { | ||
/** | ||
* The keys that are used in the script. | ||
*/ | ||
|
@@ -506,7 +507,7 @@ export type ScriptOptions = { | |
* The arguments for the script. | ||
*/ | ||
args?: GlideString[]; | ||
}; | ||
} | ||
|
||
function getRequestErrorClass( | ||
type: response.RequestErrorType | null | undefined, | ||
|
@@ -604,11 +605,11 @@ function toProtobufRoute( | |
} | ||
} | ||
|
||
export type PubSubMsg = { | ||
export interface PubSubMsg { | ||
message: string; | ||
channel: string; | ||
pattern?: string | null; | ||
}; | ||
} | ||
|
||
/** | ||
* @internal | ||
|
@@ -4234,7 +4235,7 @@ export class BaseClient { | |
destination: GlideString, | ||
source: GlideString, | ||
rangeQuery: RangeByScore | RangeByLex | RangeByIndex, | ||
reverse: boolean = false, | ||
reverse = false, | ||
): Promise<number> { | ||
return this.createWritePromise( | ||
createZRangeStore(destination, source, rangeQuery, reverse), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we lint this file as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm i guess?