Skip to content

Commit 6ec72fa

Browse files
Enable recommended eslint rules (#1823)
1 parent 66520f3 commit 6ec72fa

File tree

26 files changed

+411
-47
lines changed

26 files changed

+411
-47
lines changed

apps/avatax/eslint.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ export default [
2727
],
2828
},
2929
},
30+
{
31+
// TODO: remove this override once the recommended rules are fixed
32+
name: "saleor-app-avatax/override-recommended",
33+
files: ["**/*.{ts,tsx}"],
34+
rules: {
35+
"@typescript-eslint/no-empty-object-type": "warn",
36+
"@typescript-eslint/no-unused-vars": "warn",
37+
"@typescript-eslint/no-explicit-any": "warn",
38+
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
39+
"no-fallthrough": "warn",
40+
},
41+
},
3042
{
3143
name: "saleor-app-avatax/override-no-process-env",
3244
files: ["next.config.ts", "src/env.ts", "src/instrumentation.ts"],

apps/avatax/src/modules/avatax/avatax-client-tax-code.service.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import { AvataxForbiddenAccessError } from "../taxes/tax-error";
77

88
describe("AvataxClientTaxCodeService", () => {
99
describe("getFilteredTaxCodes", () => {
10-
it("Throws ForbiddenAccessError error if Avatax returns AvataxForbiddenAccessError", () => {
10+
it("Throws ForbiddenAccessError error if Avatax returns AvataxForbiddenAccessError", async () => {
1111
const service = new AvataxClientTaxCodeService({
1212
listTaxCodes() {
1313
return Promise.resolve(err(new AvataxForbiddenAccessError("Not permitted")));
1414
},
1515
});
1616

17-
expect(() => service.getFilteredTaxCodes({ filter: "" })).rejects.toThrowError(
17+
await expect(() => service.getFilteredTaxCodes({ filter: "" })).rejects.toThrowError(
1818
AvataxClientTaxCodeService.ForbiddenAccessError,
1919
);
2020
});

apps/avatax/src/modules/avatax/order-confirmed/saleor-order-to-avatax-lines-transformer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const saleorConfirmedOrderEvent = SaleorOrderConfirmedEventMockFactory.create();
1414
const discountsStrategy = new PriceReductionDiscountsStrategy();
1515

1616
describe("SaleorOrderToAvataxLinesTransformer", () => {
17-
it("should transform lines and shipping from order into product and shipping lines ", () => {
17+
it("should transform lines and shipping from order into product and shipping lines", () => {
1818
const { order } = SaleorOrderConfirmedEventMockFactory.getGraphqlPayload();
1919

2020
expect(

apps/cms/eslint.config.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
import { config } from "@saleor/eslint-config-apps/index.js";
22

33
/** @type {import("eslint").Linter.Config} */
4-
export default config;
4+
export default [
5+
...config,
6+
{
7+
// TODO: remove this override once the recommended rules are fixed
8+
name: "saleor-app-cms/override-recommended",
9+
files: ["**/*.{ts,tsx}"],
10+
rules: {
11+
"@typescript-eslint/no-unused-vars": "warn",
12+
"@typescript-eslint/no-unused-expressions": "warn",
13+
"@typescript-eslint/no-empty-object-type": "warn",
14+
"@typescript-eslint/no-explicit-any": "warn",
15+
"@typescript-eslint/no-namespace": "warn",
16+
"@typescript-eslint/no-require-imports": "warn",
17+
"@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
18+
"no-fallthrough": "warn",
19+
},
20+
},
21+
];

apps/klaviyo/eslint.config.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
import { config } from "@saleor/eslint-config-apps/index.js";
22

33
/** @type {import("eslint").Linter.Config} */
4-
export default config;
4+
export default [
5+
...config,
6+
{
7+
// TODO: remove this override once the recommended rules are fixed
8+
name: "saleor-app-klaviyo/override-recommended",
9+
files: ["**/*.{ts,tsx}"],
10+
rules: {
11+
"@typescript-eslint/no-empty-object-type": "warn",
12+
"@typescript-eslint/no-explicit-any": "warn",
13+
"no-constant-binary-expression": "warn",
14+
"@typescript-eslint/no-require-imports": "warn",
15+
"@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
16+
},
17+
},
18+
];

apps/products-feed/eslint.config.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
import { config } from "@saleor/eslint-config-apps/index.js";
22

33
/** @type {import("eslint").Linter.Config} */
4-
export default config;
4+
export default [
5+
...config,
6+
{
7+
// TODO: remove this override once the recommended rules are fixed
8+
name: "saleor-app-products-feed/override-recommended",
9+
files: ["**/*.{ts,tsx}"],
10+
rules: {
11+
"@typescript-eslint/no-unused-vars": "warn",
12+
"no-empty": "warn",
13+
"@typescript-eslint/ban-ts-comment": "warn",
14+
"@typescript-eslint/no-empty-object-type": "warn",
15+
"@typescript-eslint/no-unused-expressions": "warn",
16+
"@typescript-eslint/no-explicit-any": "warn",
17+
"@typescript-eslint/no-require-imports": "warn",
18+
},
19+
},
20+
];

apps/products-feed/src/modules/app-configuration/attribute-fetcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class AttributeFetcher {
4545
* Fetches all attribute pages - standard page is max 100 items
4646
*/
4747
async fetchAllAttributes(): Promise<AttributeWithMappingFragmentFragment[]> {
48-
let attributes: AttributeWithMappingFragmentFragment[] = [];
48+
const attributes: AttributeWithMappingFragmentFragment[] = [];
4949

5050
this.logger.debug("fetchAllAttributes called");
5151

apps/products-feed/src/modules/category-mapping/categories-fetcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class CategoriesFetcher {
4646
* Fetches all categories pages - standard page is max 100 items
4747
*/
4848
async fetchAllCategories(): Promise<CategoryWithMappingFragmentFragment[]> {
49-
let categories: CategoryWithMappingFragmentFragment[] = [];
49+
const categories: CategoryWithMappingFragmentFragment[] = [];
5050

5151
this.logger.debug("fetchAllCategories called");
5252

apps/products-feed/src/modules/google-feed/fetch-product-data.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import { fetchProductData, getCursors } from "./fetch-product-data";
1010

1111
describe("getCursors", () => {
12-
it("loads cursor for each variant page ", async () => {
12+
it("loads cursor for each variant page", async () => {
1313
const client = {
1414
query: vi.fn().mockReturnValue({
1515
toPromise: vi

apps/search/eslint.config.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
import { config } from "@saleor/eslint-config-apps/index.js";
22

33
/** @type {import("eslint").Linter.Config} */
4-
export default config;
4+
export default [
5+
...config,
6+
{
7+
// TODO: remove this override once the recommended rules are fixed
8+
name: "saleor-app-search/override-recommended",
9+
files: ["**/*.{ts,tsx}"],
10+
rules: {
11+
"@typescript-eslint/no-unused-vars": "warn",
12+
"@typescript-eslint/ban-ts-comment": "warn",
13+
"@typescript-eslint/no-empty-object-type": "warn",
14+
"@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
15+
"@typescript-eslint/no-explicit-any": "warn",
16+
"@typescript-eslint/no-require-imports": "warn",
17+
},
18+
},
19+
];

0 commit comments

Comments
 (0)