@vulog/aima-billing 1.2.34 → 1.2.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +17 -0
- package/dist/index.d.cts +7 -1
- package/dist/index.d.mts +7 -1
- package/dist/index.mjs +16 -1
- package/package.json +4 -4
- package/src/getInvoicePdf.test.ts +57 -0
- package/src/getInvoicePdf.ts +18 -0
- package/src/getInvoicesByTripId.test.ts +73 -0
- package/src/getInvoicesByTripId.ts +17 -0
- package/src/index.ts +2 -0
- package/src/refund.ts +0 -1
- package/.eslintrc.cjs +0 -112
package/dist/index.cjs
CHANGED
|
@@ -82,6 +82,21 @@ const getInvoiceById = async (client, id) => {
|
|
|
82
82
|
return client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${id}`).then(({ data }) => data);
|
|
83
83
|
};
|
|
84
84
|
//#endregion
|
|
85
|
+
//#region src/getInvoicePdf.ts
|
|
86
|
+
const getInvoicePdf = async (client, invoiceId) => {
|
|
87
|
+
const result = zod.z.string().trim().min(1).uuid().safeParse(invoiceId);
|
|
88
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
89
|
+
const { data } = await client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${invoiceId}/pdf`, { responseType: "arraybuffer" });
|
|
90
|
+
return data && data.byteLength > 0 ? data : null;
|
|
91
|
+
};
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/getInvoicesByTripId.ts
|
|
94
|
+
const getInvoicesByTripId = async (client, tripId) => {
|
|
95
|
+
const result = zod.z.string().trim().min(1).safeParse(tripId);
|
|
96
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
97
|
+
return client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/trips/${result.data}/invoices`).then(({ data }) => data);
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
85
100
|
//#region src/getRefundableAmount.ts
|
|
86
101
|
const schema$3 = zod.default.string().trim().min(1);
|
|
87
102
|
const getRefundableAmount = async (client, invoiceId) => {
|
|
@@ -149,6 +164,8 @@ const payInvoice = async (client, invoiceId, manualPayment) => {
|
|
|
149
164
|
exports.addCredits = addCredits;
|
|
150
165
|
exports.chargeProduct = chargeProduct;
|
|
151
166
|
exports.getInvoiceById = getInvoiceById;
|
|
167
|
+
exports.getInvoicePdf = getInvoicePdf;
|
|
168
|
+
exports.getInvoicesByTripId = getInvoicesByTripId;
|
|
152
169
|
exports.getRefundableAmount = getRefundableAmount;
|
|
153
170
|
exports.getUserCreditsByEntityId = getUserCreditsByEntityId;
|
|
154
171
|
exports.getWalletsByEntity = getWalletsByEntity;
|
package/dist/index.d.cts
CHANGED
|
@@ -153,6 +153,12 @@ declare const addCredits: (client: Client, payload: Payload$1) => Promise<Credit
|
|
|
153
153
|
//#region src/getInvoiceById.d.ts
|
|
154
154
|
declare const getInvoiceById: (client: Client, id: string) => Promise<Invoice>;
|
|
155
155
|
//#endregion
|
|
156
|
+
//#region src/getInvoicePdf.d.ts
|
|
157
|
+
declare const getInvoicePdf: (client: Client, invoiceId: string) => Promise<ArrayBuffer | null>;
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/getInvoicesByTripId.d.ts
|
|
160
|
+
declare const getInvoicesByTripId: (client: Client, tripId: string) => Promise<Invoice[]>;
|
|
161
|
+
//#endregion
|
|
156
162
|
//#region src/getRefundableAmount.d.ts
|
|
157
163
|
declare const getRefundableAmount: (client: Client, invoiceId: string) => Promise<RefundableAmount>;
|
|
158
164
|
//#endregion
|
|
@@ -176,4 +182,4 @@ declare const updateWallet: (client: Client, walletId: string, actions: PatchAct
|
|
|
176
182
|
//#region src/payInvoice.d.ts
|
|
177
183
|
declare const payInvoice: (client: Client, invoiceId: string, manualPayment: ManualPayment) => Promise<Invoice>;
|
|
178
184
|
//#endregion
|
|
179
|
-
export { ChargeProductInfo, Credit, Invoice, ManualPayment, Paths, Receipt, RefundableAmount, Wallet, addCredits, chargeProduct, getInvoiceById, getRefundableAmount, getUserCreditsByEntityId, getWalletsByEntity, payInvoice, refund, updateWallet };
|
|
185
|
+
export { ChargeProductInfo, Credit, Invoice, ManualPayment, Paths, Receipt, RefundableAmount, Wallet, addCredits, chargeProduct, getInvoiceById, getInvoicePdf, getInvoicesByTripId, getRefundableAmount, getUserCreditsByEntityId, getWalletsByEntity, payInvoice, refund, updateWallet };
|
package/dist/index.d.mts
CHANGED
|
@@ -153,6 +153,12 @@ declare const addCredits: (client: Client, payload: Payload$1) => Promise<Credit
|
|
|
153
153
|
//#region src/getInvoiceById.d.ts
|
|
154
154
|
declare const getInvoiceById: (client: Client, id: string) => Promise<Invoice>;
|
|
155
155
|
//#endregion
|
|
156
|
+
//#region src/getInvoicePdf.d.ts
|
|
157
|
+
declare const getInvoicePdf: (client: Client, invoiceId: string) => Promise<ArrayBuffer | null>;
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/getInvoicesByTripId.d.ts
|
|
160
|
+
declare const getInvoicesByTripId: (client: Client, tripId: string) => Promise<Invoice[]>;
|
|
161
|
+
//#endregion
|
|
156
162
|
//#region src/getRefundableAmount.d.ts
|
|
157
163
|
declare const getRefundableAmount: (client: Client, invoiceId: string) => Promise<RefundableAmount>;
|
|
158
164
|
//#endregion
|
|
@@ -176,4 +182,4 @@ declare const updateWallet: (client: Client, walletId: string, actions: PatchAct
|
|
|
176
182
|
//#region src/payInvoice.d.ts
|
|
177
183
|
declare const payInvoice: (client: Client, invoiceId: string, manualPayment: ManualPayment) => Promise<Invoice>;
|
|
178
184
|
//#endregion
|
|
179
|
-
export { ChargeProductInfo, Credit, Invoice, ManualPayment, Paths, Receipt, RefundableAmount, Wallet, addCredits, chargeProduct, getInvoiceById, getRefundableAmount, getUserCreditsByEntityId, getWalletsByEntity, payInvoice, refund, updateWallet };
|
|
185
|
+
export { ChargeProductInfo, Credit, Invoice, ManualPayment, Paths, Receipt, RefundableAmount, Wallet, addCredits, chargeProduct, getInvoiceById, getInvoicePdf, getInvoicesByTripId, getRefundableAmount, getUserCreditsByEntityId, getWalletsByEntity, payInvoice, refund, updateWallet };
|
package/dist/index.mjs
CHANGED
|
@@ -58,6 +58,21 @@ const getInvoiceById = async (client, id) => {
|
|
|
58
58
|
return client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${id}`).then(({ data }) => data);
|
|
59
59
|
};
|
|
60
60
|
//#endregion
|
|
61
|
+
//#region src/getInvoicePdf.ts
|
|
62
|
+
const getInvoicePdf = async (client, invoiceId) => {
|
|
63
|
+
const result = z.string().trim().min(1).uuid().safeParse(invoiceId);
|
|
64
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
65
|
+
const { data } = await client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${invoiceId}/pdf`, { responseType: "arraybuffer" });
|
|
66
|
+
return data && data.byteLength > 0 ? data : null;
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/getInvoicesByTripId.ts
|
|
70
|
+
const getInvoicesByTripId = async (client, tripId) => {
|
|
71
|
+
const result = z.string().trim().min(1).safeParse(tripId);
|
|
72
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
73
|
+
return client.get(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/trips/${result.data}/invoices`).then(({ data }) => data);
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
61
76
|
//#region src/getRefundableAmount.ts
|
|
62
77
|
const schema$3 = z$1.string().trim().min(1);
|
|
63
78
|
const getRefundableAmount = async (client, invoiceId) => {
|
|
@@ -122,4 +137,4 @@ const payInvoice = async (client, invoiceId, manualPayment) => {
|
|
|
122
137
|
return client.post(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${result.data.invoiceId}/payment`, result.data.manualPayment).then(({ data }) => data);
|
|
123
138
|
};
|
|
124
139
|
//#endregion
|
|
125
|
-
export { addCredits, chargeProduct, getInvoiceById, getRefundableAmount, getUserCreditsByEntityId, getWalletsByEntity, payInvoice, refund, updateWallet };
|
|
140
|
+
export { addCredits, chargeProduct, getInvoiceById, getInvoicePdf, getInvoicesByTripId, getRefundableAmount, getUserCreditsByEntityId, getWalletsByEntity, payInvoice, refund, updateWallet };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-billing",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.36",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.cts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dev": "tsdown --watch",
|
|
23
23
|
"test": "vitest run",
|
|
24
24
|
"test:watch": "vitest",
|
|
25
|
-
"lint": "eslint src
|
|
25
|
+
"lint": "eslint src/"
|
|
26
26
|
},
|
|
27
27
|
"keywords": [
|
|
28
28
|
"AIMA",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"author": "Vulog",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vulog/aima-client": "1.2.
|
|
36
|
-
"@vulog/aima-core": "1.2.
|
|
35
|
+
"@vulog/aima-client": "1.2.36",
|
|
36
|
+
"@vulog/aima-core": "1.2.36"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"zod": "^3.25.76"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { describe, test, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { Client } from '@vulog/aima-client';
|
|
3
|
+
import { randomUUID } from 'crypto';
|
|
4
|
+
import { getInvoicePdf } from './getInvoicePdf';
|
|
5
|
+
|
|
6
|
+
describe('getInvoicePdf', () => {
|
|
7
|
+
const getMock = vi.fn();
|
|
8
|
+
const client = {
|
|
9
|
+
get: getMock,
|
|
10
|
+
clientOptions: {
|
|
11
|
+
fleetId: 'FLEET_ID',
|
|
12
|
+
},
|
|
13
|
+
} as unknown as Client;
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
getMock.mockReset();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('throws Invalid args when invoiceId is not a valid UUID', async () => {
|
|
20
|
+
await expect(getInvoicePdf(client, 'not-a-uuid')).rejects.toThrow(TypeError);
|
|
21
|
+
await expect(getInvoicePdf(client, 'not-a-uuid')).rejects.toMatchObject({
|
|
22
|
+
message: 'Invalid args',
|
|
23
|
+
});
|
|
24
|
+
expect(getMock).not.toHaveBeenCalled();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('throws Invalid args when invoiceId is empty', async () => {
|
|
28
|
+
await expect(getInvoicePdf(client, '')).rejects.toThrow(TypeError);
|
|
29
|
+
expect(getMock).not.toHaveBeenCalled();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('calls GET with correct URL and responseType arraybuffer, returns ArrayBuffer when data has length', async () => {
|
|
33
|
+
const invoiceId = randomUUID();
|
|
34
|
+
const pdfBuffer = new ArrayBuffer(1024);
|
|
35
|
+
getMock.mockResolvedValueOnce({ data: pdfBuffer });
|
|
36
|
+
|
|
37
|
+
const result = await getInvoicePdf(client, invoiceId);
|
|
38
|
+
|
|
39
|
+
expect(getMock).toHaveBeenCalledTimes(1);
|
|
40
|
+
expect(getMock).toHaveBeenCalledWith(
|
|
41
|
+
`/boapi/proxy/billing/fleets/FLEET_ID/invoices/${invoiceId}/pdf`,
|
|
42
|
+
{ responseType: 'arraybuffer' }
|
|
43
|
+
);
|
|
44
|
+
expect(result).toBe(pdfBuffer);
|
|
45
|
+
expect(result).toBeInstanceOf(ArrayBuffer);
|
|
46
|
+
expect((result as ArrayBuffer).byteLength).toBe(1024);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('returns null when response data is empty or zero length', async () => {
|
|
50
|
+
const invoiceId = randomUUID();
|
|
51
|
+
getMock.mockResolvedValueOnce({ data: new ArrayBuffer(0) });
|
|
52
|
+
|
|
53
|
+
const result = await getInvoicePdf(client, invoiceId);
|
|
54
|
+
|
|
55
|
+
expect(result).toBeNull();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Client } from '@vulog/aima-client';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export const getInvoicePdf = async (client: Client, invoiceId: string): Promise<ArrayBuffer | null> => {
|
|
5
|
+
const result = z.string().trim().min(1).uuid().safeParse(invoiceId);
|
|
6
|
+
if (!result.success) {
|
|
7
|
+
throw new TypeError('Invalid args', {
|
|
8
|
+
cause: result.error.issues,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { data } = await client.get<ArrayBuffer>(
|
|
13
|
+
`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/invoices/${invoiceId}/pdf`,
|
|
14
|
+
{ responseType: 'arraybuffer' }
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return data && data.byteLength > 0 ? data : null;
|
|
18
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { describe, test, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { Client } from '@vulog/aima-client';
|
|
3
|
+
import { getInvoicesByTripId } from './getInvoicesByTripId';
|
|
4
|
+
import type { Invoice } from './types';
|
|
5
|
+
|
|
6
|
+
describe('getInvoicesByTripId', () => {
|
|
7
|
+
const getMock = vi.fn();
|
|
8
|
+
const client = {
|
|
9
|
+
get: getMock,
|
|
10
|
+
clientOptions: {
|
|
11
|
+
fleetId: 'FLEET_ID',
|
|
12
|
+
},
|
|
13
|
+
} as unknown as Client;
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
getMock.mockReset();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('throws Invalid args when tripId is empty', async () => {
|
|
20
|
+
await expect(getInvoicesByTripId(client, '')).rejects.toThrow(TypeError);
|
|
21
|
+
await expect(getInvoicesByTripId(client, '')).rejects.toMatchObject({
|
|
22
|
+
message: 'Invalid args',
|
|
23
|
+
});
|
|
24
|
+
expect(getMock).not.toHaveBeenCalled();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('throws Invalid args when tripId is whitespace only', async () => {
|
|
28
|
+
await expect(getInvoicesByTripId(client, ' ')).rejects.toThrow(TypeError);
|
|
29
|
+
expect(getMock).not.toHaveBeenCalled();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('calls GET with correct URL and returns invoices', async () => {
|
|
33
|
+
const tripId = 'BEBD00056A9A16103D418CC36D940E26';
|
|
34
|
+
const invoices: Invoice[] = [
|
|
35
|
+
{
|
|
36
|
+
id: '66bcbd77-37ef-47bd-b9af-877e5d213b8f',
|
|
37
|
+
sequence: 1,
|
|
38
|
+
userId: '20fb98a3-b60d-491a-9359-62e55f51fcb9',
|
|
39
|
+
invoiceDate: '2026-03-03',
|
|
40
|
+
updateDate: '2026-03-03T09:46:50Z',
|
|
41
|
+
fleetId: 'FLEET_ID',
|
|
42
|
+
invoiceYear: 2026,
|
|
43
|
+
invoicesStatus: 'PAID',
|
|
44
|
+
amount: 100,
|
|
45
|
+
currency: 'EUR',
|
|
46
|
+
entityId: 'entity-1',
|
|
47
|
+
attempts: 0,
|
|
48
|
+
pspReference: 'ref-1',
|
|
49
|
+
withTaxRefundAmount: 0,
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
getMock.mockResolvedValueOnce({ data: invoices });
|
|
53
|
+
|
|
54
|
+
const result = await getInvoicesByTripId(client, tripId);
|
|
55
|
+
|
|
56
|
+
expect(getMock).toHaveBeenCalledTimes(1);
|
|
57
|
+
expect(getMock).toHaveBeenCalledWith(
|
|
58
|
+
`/boapi/proxy/billing/fleets/FLEET_ID/trips/${tripId}/invoices`
|
|
59
|
+
);
|
|
60
|
+
expect(result).toEqual(invoices);
|
|
61
|
+
expect(result).toHaveLength(1);
|
|
62
|
+
expect(result[0].id).toBe(invoices[0].id);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('returns empty array when no invoices', async () => {
|
|
66
|
+
const tripId = 'some-trip-id';
|
|
67
|
+
getMock.mockResolvedValueOnce({ data: [] });
|
|
68
|
+
|
|
69
|
+
const result = await getInvoicesByTripId(client, tripId);
|
|
70
|
+
|
|
71
|
+
expect(result).toEqual([]);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Client } from '@vulog/aima-client';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
import { Invoice } from './types';
|
|
5
|
+
|
|
6
|
+
export const getInvoicesByTripId = async (client: Client, tripId: string): Promise<Invoice[]> => {
|
|
7
|
+
const result = z.string().trim().min(1).safeParse(tripId);
|
|
8
|
+
if (!result.success) {
|
|
9
|
+
throw new TypeError('Invalid args', {
|
|
10
|
+
cause: result.error.issues,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return client
|
|
15
|
+
.get<Invoice[]>(`/boapi/proxy/billing/fleets/${client.clientOptions.fleetId}/trips/${result.data}/invoices`)
|
|
16
|
+
.then(({ data }) => data);
|
|
17
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,8 @@ export * from './types';
|
|
|
3
3
|
export * from './getUserCreditsByEntityId';
|
|
4
4
|
export * from './addCredits';
|
|
5
5
|
export * from './getInvoiceById';
|
|
6
|
+
export * from './getInvoicePdf';
|
|
7
|
+
export * from './getInvoicesByTripId';
|
|
6
8
|
export * from './getRefundableAmount';
|
|
7
9
|
export * from './refund';
|
|
8
10
|
export * from './getWalletsByEntity';
|
package/src/refund.ts
CHANGED
|
@@ -24,7 +24,6 @@ export const refund = async (client: Client, payload: Payload): Promise<void> =>
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const filteredData = Object.fromEntries(
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28
27
|
Object.entries(result.data).filter(([_, value]) => value !== undefined && value !== null)
|
|
29
28
|
);
|
|
30
29
|
|
package/.eslintrc.cjs
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: '@typescript-eslint/parser',
|
|
3
|
-
parserOptions: {
|
|
4
|
-
// Indicates the location of the TypeScript configuration file
|
|
5
|
-
project: 'tsconfig.json',
|
|
6
|
-
// Sets the root directory for the TypeScript configuration
|
|
7
|
-
tsconfigRootDir: __dirname,
|
|
8
|
-
// Specifies the version of ECMAScript syntax to be used
|
|
9
|
-
ecmaVersion: 'latest',
|
|
10
|
-
// Indicates the type of source code (script or module)
|
|
11
|
-
sourceType: 'module',
|
|
12
|
-
},
|
|
13
|
-
plugins: ['@typescript-eslint', 'prettier', 'import'],
|
|
14
|
-
extends: [
|
|
15
|
-
'airbnb-base',
|
|
16
|
-
'airbnb-typescript/base',
|
|
17
|
-
'plugin:@typescript-eslint/recommended',
|
|
18
|
-
'prettier',
|
|
19
|
-
'plugin:prettier/recommended',
|
|
20
|
-
],
|
|
21
|
-
root: true,
|
|
22
|
-
env: {
|
|
23
|
-
es6: true,
|
|
24
|
-
node: true,
|
|
25
|
-
},
|
|
26
|
-
ignorePatterns: [
|
|
27
|
-
'/dist/**/*', // Ignore built files.
|
|
28
|
-
'.eslintrc.js',
|
|
29
|
-
'**/*.test.ts',
|
|
30
|
-
],
|
|
31
|
-
rules: {
|
|
32
|
-
// Configures the Prettier integration with ESLint
|
|
33
|
-
'prettier/prettier': ['error', { endOfLine: 'auto' }],
|
|
34
|
-
// Disables the rule requiring an 'I' prefix for interfaces
|
|
35
|
-
'@typescript-eslint/interface-name-prefix': 'off',
|
|
36
|
-
// Configures the naming conventions for various code constructs
|
|
37
|
-
'@typescript-eslint/naming-convention': [
|
|
38
|
-
// ... various naming convention configurations ...
|
|
39
|
-
'error',
|
|
40
|
-
// Allows any naming format for destructured variables
|
|
41
|
-
{
|
|
42
|
-
selector: 'variable',
|
|
43
|
-
modifiers: ['destructured'],
|
|
44
|
-
format: null,
|
|
45
|
-
},
|
|
46
|
-
// Requires strict camelCase for function names
|
|
47
|
-
{
|
|
48
|
-
selector: 'function',
|
|
49
|
-
format: ['strictCamelCase'],
|
|
50
|
-
},
|
|
51
|
-
// Requires boolean variables to have one of the specified prefixes
|
|
52
|
-
{
|
|
53
|
-
selector: 'variable',
|
|
54
|
-
format: null,
|
|
55
|
-
types: ['boolean'],
|
|
56
|
-
prefix: ['is', 'should', 'has', 'can', 'did', 'will'],
|
|
57
|
-
},
|
|
58
|
-
// Requires enum names to have a strict PascalCase format
|
|
59
|
-
{
|
|
60
|
-
selector: 'enum',
|
|
61
|
-
format: ['StrictPascalCase'],
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
'import/extensions': 'off',
|
|
65
|
-
// Disables the rule requiring explicit return types for functions
|
|
66
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
67
|
-
// Disables the rule requiring explicit boundary types for modules
|
|
68
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
69
|
-
// Disables the rule prohibiting the use of 'any' type
|
|
70
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
71
|
-
// Disables the rule detecting unused variables
|
|
72
|
-
'no-unused-vars': 0,
|
|
73
|
-
// Disables the rule disallowing named exports used as a default export
|
|
74
|
-
'import/no-named-as-default': 0,
|
|
75
|
-
// Configures the order and formatting of import statements
|
|
76
|
-
'import/order': [
|
|
77
|
-
// ... import order configuration ...
|
|
78
|
-
'error',
|
|
79
|
-
{
|
|
80
|
-
// Configure the alphabetization settings
|
|
81
|
-
alphabetize: {
|
|
82
|
-
// Enforce ascending alphabetical order
|
|
83
|
-
order: 'asc',
|
|
84
|
-
// Do not ignore the case while sorting
|
|
85
|
-
caseInsensitive: false,
|
|
86
|
-
},
|
|
87
|
-
// Enforce newlines between different groups and inside groups of imports
|
|
88
|
-
'newlines-between': 'always-and-inside-groups',
|
|
89
|
-
// Warn when there is an import statement that is not part of any group
|
|
90
|
-
warnOnUnassignedImports: true,
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
// Configures the rule detecting extraneous dependencies
|
|
94
|
-
'import/no-extraneous-dependencies': [
|
|
95
|
-
// ... extraneous dependencies configuration ...
|
|
96
|
-
'error',
|
|
97
|
-
{
|
|
98
|
-
// Specify the file patterns where devDependencies imports are allowed
|
|
99
|
-
devDependencies: [
|
|
100
|
-
// Allow devDependencies imports in test and spec files
|
|
101
|
-
'**/*.test.{ts,js}',
|
|
102
|
-
'**/*.spec.{ts,js}',
|
|
103
|
-
// Allow devDependencies imports in the 'test' folder
|
|
104
|
-
'./test/**.{ts,js}',
|
|
105
|
-
// Allow devDependencies imports in the 'scripts' folder
|
|
106
|
-
'./scripts/**/*.{ts,js}',
|
|
107
|
-
],
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
'import/prefer-default-export': 'off',
|
|
111
|
-
},
|
|
112
|
-
};
|