Skip to content

Commit

Permalink
Fix AvaTax app eslint errors (#1580)
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofzuraw authored Sep 20, 2024
1 parent d6a4c54 commit def3bb1
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 23 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-dancers-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-avatax": patch
---

Fix Eslint issues. It won't affect AvaTax app functionality.
17 changes: 0 additions & 17 deletions apps/avatax/.eslintrc

This file was deleted.

13 changes: 13 additions & 0 deletions apps/avatax/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
root: true,
extends: ["saleor"],
plugins: ["neverthrow"],
rules: {
"turbo/no-undeclared-env-vars": ["error"],
},
parserOptions: {
project: "tsconfig.json",
tsconfigRootDir: __dirname,
},
ignorePatterns: ["**/generated/graphql.ts"],
};
2 changes: 1 addition & 1 deletion apps/avatax/scripts/run-webhooks-migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const runMigrations = async () => {
logger.info("Fetching environments from the saleor-cloud APL", { dryRun });

const saleorCloudEnv = await saleorAPL.getAll().catch((error) => {
logger.error("Could not fetch instances from the Cloud APL", { error, dryRun });
logger.error("Could not fetch instances from the Cloud APL", { error: error, dryRun });

process.exit(1);
});
Expand Down
1 change: 1 addition & 0 deletions apps/avatax/src/modules/avatax/ui/tax-code-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const useTaxCodeAutocomplete = ({ taxClassId }: { taxClassId: string }) => {
prevValueRef.current = debouncedValue;
updateMutation({ saleorTaxClassId: taxClassId, avataxTaxCode: debouncedValue });
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [debouncedValue, isTouched, taxCodes, taxClassId, updateMutation]);

React.useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export default wrapWithLoggerContext(
discountStrategy,
);

// eslint-disable-next-line @saleor/saleor-app/logger-leak
logger.info("Taxes calculated", { calculatedTaxes });

return res.status(200).json(ctx.buildResponse(calculatedTaxes));
Expand Down
6 changes: 3 additions & 3 deletions apps/avatax/src/pages/api/webhooks/order-confirmed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default wrapWithLoggerContext(

return res.status(200).end();
} catch (error) {
logger.debug("Error confirming order", { error });
logger.debug("Error confirming order", { error: error });

switch (true) {
case error instanceof TaxBadPayloadError: {
Expand All @@ -192,7 +192,7 @@ export default wrapWithLoggerContext(
}
}
Sentry.captureException(error);
logger.error("Unhandled error executing webhook", { error });
logger.error("Unhandled error executing webhook", { error: error });

return res.status(500).json({ message: "Unhandled error" });
}
Expand All @@ -217,7 +217,7 @@ export default wrapWithLoggerContext(
}
} catch (error) {
Sentry.captureException(error);
logger.error("Unhandled error executing webhook", { error });
logger.error("Unhandled error executing webhook", { error: error });

return res.status(500).json({ message: "Unhandled error" });
}
Expand Down
2 changes: 1 addition & 1 deletion apps/avatax/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"@/*": ["src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "next.config.js"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "next.config.js", ".eslintrc.cjs"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"apps/*/src/**",
"apps/*/e2e/data/**",
"**/*.bru",
"**/.eslintrc",
"**/.eslintrc*",
".github/**",
"Dockerfile*"
]
Expand Down

0 comments on commit def3bb1

Please sign in to comment.