Skip to content

fix: fix eslint config #79

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

Merged
merged 2 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
root: true,
extends: ["@instill-ai/eslint-config-cortex"],
ignorePatterns: [
".eslintrc.cjs",
"tsup.config.ts",
"vitest.config.ts",
"dist/",
"examples/",
"setupTests.ts",
"turbo.json",
],
};
2 changes: 1 addition & 1 deletion src/connector/ConnectorClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ConnectorClient {
private axiosInstance: AxiosInstance;

constructor(baseUrl: string, appVersion: string, apiToken: string) {
let URL: Nullable<string> = `${baseUrl}/vdp/${appVersion}`;
const URL: Nullable<string> = `${baseUrl}/vdp/${appVersion}`;

this.axiosInstance = axios.create({
baseURL: URL,
Expand Down
3 changes: 1 addition & 2 deletions src/connector/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from "./types";
export * from "./ConnectorClient";

export { default } from "./ConnectorClient";
2 changes: 1 addition & 1 deletion src/helper/axiosInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const createAxiosInstance = (
appVersion: string,
product: string
): AxiosInstance => {
let URL: Nullable<string> = `${baseUrl}/${product}/${appVersion}`;
const URL: Nullable<string> = `${baseUrl}/${product}/${appVersion}`;

return axios.create({
baseURL: URL,
Expand Down
8 changes: 4 additions & 4 deletions src/helper/createClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ export function createClient(
}
}

if (!process.env.API_GATEWAY_URL && !env("API_GATEWAY_URL")) {
if (!env("API_GATEWAY_URL")) {
throw new Error("API_GATEWAY_URL or API_GATEWAY_URL is not defined");
}

let baseURL: Nullable<string> = `${
process.env.API_GATEWAY_URL ?? env("API_GATEWAY_URL")
}/${product}/${env("API_VERSION")}`;
const baseURL: Nullable<string> = `${env("API_GATEWAY_URL")}/${product}/${env(
"API_VERSION"
)}`;

return axios.create({
baseURL,
Expand Down
2 changes: 1 addition & 1 deletion src/helper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export { createClient } from "./createClient";
export { getQueryString } from "./getQueryString";
export { getInstillApiErrorMessage } from "./getInstillApiErrorMessage";
export * from "./config";
export * from "./axiosInstance";
export { default } from "./axiosInstance";
15 changes: 7 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import ConnectorClient from "./connector/ConnectorClient";
import MetricClient from "./metric/MetricClient";
import AuthClient from "./mgmt/AuthClient";
import ModelClient from "./model/ModelClient";
import OperationClient from "./operation/OperationClient";
import PipelineClient from "./pipeline/PipelineClient";
import OrganizationClient from "./organization/OrganizationClient";
import ConnectorClient from "./connector";
import MetricClient from "./metric";
import AuthClient from "./mgmt";
import ModelClient from "./model";
import OperationClient from "./operation";
import OrganizationClient from "./organization";
import PipelineClient from "./pipeline";

class InstillClient {
public Pipeline: PipelineClient;
Expand All @@ -30,7 +30,6 @@ export * from "./types";
export * from "./connector";
export * from "./helper";
export * from "./metric";
export * from "./mgmt";
export * from "./model";
export * from "./operation";
export * from "./pipeline";
Expand Down
2 changes: 1 addition & 1 deletion src/metric/MetricClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class MetricClient {
private axiosInstance: AxiosInstance;

constructor(baseUrl: string, appVersion: string, apiToken: string) {
let URL: Nullable<string> = `${baseUrl}/core/${appVersion}`;
const URL: Nullable<string> = `${baseUrl}/core/${appVersion}`;

this.axiosInstance = axios.create({
baseURL: URL,
Expand Down
1 change: 1 addition & 0 deletions src/metric/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./pipeline";
export { default } from "./MetricClient";
8 changes: 6 additions & 2 deletions src/mgmt/AuthClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AuthClient {
private axiosInstance: AxiosInstance;

constructor(baseUrl: string, appVersion: string, apiToken: string) {
let URL: Nullable<string> = `${baseUrl}/core/${appVersion}`;
const URL: Nullable<string> = `${baseUrl}/core/${appVersion}`;

this.axiosInstance = axios.create({
baseURL: URL,
Expand Down Expand Up @@ -84,7 +84,11 @@ class AuthClient {
* MGMT Mutation
* -----------------------------------------------------------------------*/

async updateAuthenticatedUserMutation({ payload }: { payload: Partial<User> }) {
async updateAuthenticatedUserMutation({
payload,
}: {
payload: Partial<User>;
}) {
return updateAuthenticatedUserMutation({
axiosInstance: this.axiosInstance,
payload: payload,
Expand Down
2 changes: 1 addition & 1 deletion src/mgmt/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./AuthClient";
export { default } from "./AuthClient";
1 change: 0 additions & 1 deletion src/mgmt/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
CreateApiTokenPayload,
CreateApiTokenResponse,
UpdateUserResponse,
User,
} from "./types";

export async function updateAuthenticatedUserMutation({
Expand Down
2 changes: 1 addition & 1 deletion src/model/ModelClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ModelClient {
private axiosInstance: AxiosInstance;

constructor(baseUrl: string, appVersion: string, apiToken: string) {
let URL: Nullable<string> = `${baseUrl}/model/${appVersion}`;
const URL: Nullable<string> = `${baseUrl}/model/${appVersion}`;

this.axiosInstance = axios.create({
baseURL: URL,
Expand Down
2 changes: 1 addition & 1 deletion src/model/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "./types";
export * from "./ModelClient";
export { default } from "./ModelClient";
2 changes: 1 addition & 1 deletion src/operation/OperationClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class OperationClient {
private axiosInstance: AxiosInstance;

constructor(baseUrl: string, appVersion: string, apiToken: string) {
let URL: Nullable<string> = `${baseUrl}/model/${appVersion}`;
const URL: Nullable<string> = `${baseUrl}/model/${appVersion}`;

this.axiosInstance = axios.create({
baseURL: URL,
Expand Down
2 changes: 1 addition & 1 deletion src/operation/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "./types";
export * from "./OperationClient";
export { default } from "./OperationClient";
2 changes: 1 addition & 1 deletion src/organization/OrganizationClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class OrganizationClient {
private axiosInstance: AxiosInstance;

constructor(baseUrl: string, appVersion: string, apiToken: string) {
let URL: Nullable<string> = `${baseUrl}/core/${appVersion}`;
const URL: Nullable<string> = `${baseUrl}/core/${appVersion}`;

this.axiosInstance = axios.create({
baseURL: URL,
Expand Down
3 changes: 2 additions & 1 deletion src/organization/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./mutations";
export * from "./queries";
export * from "./queries";
export { default } from "./OrganizationClient";
6 changes: 2 additions & 4 deletions src/pipeline/PipelineClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ import {
triggerUserPipelineReleaseAction,
} from "./action";

class PipelineClient {
export class PipelineClient {
// Define your specific API methods here

private axiosInstance: AxiosInstance;

constructor(baseUrl: string, appVersion: string, apiToken: string) {
let URL: Nullable<string> = `${baseUrl}/vdp/${appVersion}`;
const URL: Nullable<string> = `${baseUrl}/vdp/${appVersion}`;

this.axiosInstance = axios.create({
baseURL: URL,
Expand All @@ -58,7 +58,6 @@ class PipelineClient {
async listPipelinesQuery({
pageSize,
nextPageToken,
enablePagination,
}: {
pageSize: Nullable<number>;
nextPageToken: Nullable<string>;
Expand All @@ -76,7 +75,6 @@ class PipelineClient {
pageSize,
nextPageToken,
userName,
enablePagination,
}: {
pageSize: Nullable<number>;
nextPageToken: Nullable<string>;
Expand Down
2 changes: 1 addition & 1 deletion src/pipeline/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "./types";
export * from "./PipelineClient";
export { default } from "./PipelineClient";