Skip to content

Commit

Permalink
Improve cspell configuration (#1626)
Browse files Browse the repository at this point in the history
* Improve cspell configuration

* Improve eslintrc for products-feed
  • Loading branch information
krzysztofzuraw authored Oct 17, 2024
1 parent 790ec96 commit ada478b
Show file tree
Hide file tree
Showing 19 changed files with 587 additions and 2,190 deletions.
49 changes: 49 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"patterns": [
{
"name": "comment-single-line",
"pattern": "/#.*/g"
},
{
"name": "comment-multi-line",
"pattern": "/(?:\\/\\*[\\s\\S]*?\\*\\/)/g"
},
{
"name": "comments",
"pattern": ["comment-single-line", "comment-multi-line"]
}
],
"languageSettings": [
{
"languageId": "markdown",
"caseSensitive": true
},
{
"languageId": ["javascriptreact", "typescriptreact", "typescript", "javascript"],
"includeRegExpList": ["comments"]
}
],
"words": [
"avatax",
"bruno",
"codegen",
"contentful",
"datocms",
"klaviyo",
"mailhog",
"mjml",
"neverthrow",
"pactum",
"saleor",
"sendgrid",
"shopx",
"strapi",
"taxjar",
"unobfuscated",
"upstash",
"urql"
],
"language": "en-US",
"useGitignore": true,
"ignorePaths": ["**/graphql.ts", "**/CHANGELOG.md", "**/schema.graphql"]
}
14 changes: 9 additions & 5 deletions .github/workflows/check-spelling.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
name: "Check spelling"
on: # rebuild any PRs and main branch changes
on:
pull_request:
types: [synchronize, opened]

jobs:
spellcheck: # run the action
runs-on: ubuntu-latest
spellcheck:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: streetsidesoftware/cspell-action@22e32eb3d70acf30e3fc09bd46edc1d30fb2d6db
- uses: actions/checkout@v4
- uses: streetsidesoftware/cspell-action@934c74da3775ac844ec89503f666f67efb427fed # v6.8.1
with:
config: .cspell.json
files: "**/*.{jsx,tsx,js,ts,md,mdx}"
2 changes: 1 addition & 1 deletion apps/avatax/src/modules/app/order-metadata-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class OrderMetadataManager {
*
* @param orderId - Saleor order id
* @param externalId - Provider order id
* @deprecated - This will not be needed when we move to the new webhook flow because the transactions will be commited during OrderConfirmed
* @deprecated - This will not be needed when we move to the new webhook flow because the transactions will be committed during OrderConfirmed
*/
async updateOrderMetadataWithExternalId(orderId: string, externalId: string) {
const variables: UpdatePublicMetadataMutationVariables = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class AvataxCalculateTaxesPayloadLinesTransformer {
}

/**
* Method name is temporary -> replace with "transofrm" later
* Method name is temporary -> replace with "transform" later
* This method is including extra fields that will be added in SHOPX-1145
*/
transformWithDiscountType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const saleorOrderConfirmedEventMock = SaleorOrderConfirmedEventMockFactory.creat
const discountsStrategy = new PriceReductionDiscountsStrategy();

/**
* TODO: Dont export this, extract to shared code
* TODO: Don't export this, extract to shared code
*/
export const avataxConfigMock = mockGenerator.generateAvataxConfig();

Expand Down
2 changes: 1 addition & 1 deletion apps/avatax/src/pages/api/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default wrapWithLoggerContext(
createAppRegisterHandler({
apl: saleorApp.apl,
/**
* Prohibit installation from Saleors other than specified by the regex.
* Prohibit installation from Saleor other than specified by the regex.
* Regex source is ENV so if ENV is not set, all installations will be allowed.
*/
allowedSaleorUrls: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const procedure = protectedClientProcedure.use(({ ctx, next }) => {
/**
* Operations specific for Contentful service.
*
* For configruration see providers-list.router.ts
* For configuration see providers-list.router.ts
*/
export const contentfulRouter = router({
fetchEnvironmentsFromApi: procedure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { createLogger } from "../../../logger";
/**
* Operations specific for Datocms service.
*
* For configruration see providers-list.router.ts
* For configuration see providers-list.router.ts
*/
export const datocmsRouter = router({
fetchContentTypes: protectedClientProcedure
Expand Down
2 changes: 1 addition & 1 deletion apps/klaviyo/src/pages/api/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const allowedUrlsPattern = process.env.ALLOWED_DOMAIN_PATTERN;
const handler = createAppRegisterHandler({
apl: saleorApp.apl,
/**
* Prohibit installation from Saleors other than specified by the regex.
* Prohibit installation from Saleor other than specified by the regex.
* Regex source is ENV so if ENV is not set, all installations will be allowed.
*/
allowedSaleorUrls: [
Expand Down
10 changes: 0 additions & 10 deletions apps/products-feed/.eslintrc

This file was deleted.

11 changes: 11 additions & 0 deletions apps/products-feed/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
root: true,
extends: ["saleor"],
rules: {
"@saleor/saleor-app/logger-leak": "warn",
},
parserOptions: {
project: "tsconfig.json",
tsconfigRootDir: __dirname,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export const productToProxy = (p: ProductEntry) => {
item.push({
"g:gtin": [
{
"#text": p.gtin,
"#text": p.gtin, // cspell:disable-line
},
],
});
Expand Down
5 changes: 3 additions & 2 deletions apps/search/src/lib/algolia/algoliaSearchProvider.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import Algoliasearch, { SearchClient } from "algoliasearch";

import {
ProductVariantWebhookPayloadFragment,
ProductWebhookPayloadFragment,
} from "../../../generated/graphql";
import { isNotNil } from "../isNotNil";
import { createLogger } from "../logger";
import { SearchProvider } from "../searchProvider";
import {
AlgoliaObject,
channelListingToAlgoliaIndexId,
productAndVariantToAlgolia,
productAndVariantToObjectID,
} from "./algoliaUtils";
import { createLogger } from "../logger";

export interface AlgoliaSearchProviderOptions {
appId: string;
Expand All @@ -36,7 +37,7 @@ export class AlgoliaSearchProvider implements SearchProvider {
channels,
enabledKeys,
}: AlgoliaSearchProviderOptions) {
this.#algolia = Algoliasearch(appId, apiKey);
this.#algolia = Algoliasearch(appId, apiKey); // cspell:disable-line
this.#indexNamePrefix = indexNamePrefix;
this.#indexNames =
channels?.map((c) => channelListingToAlgoliaIndexId({ channel: c }, this.#indexNamePrefix)) ||
Expand Down
2 changes: 1 addition & 1 deletion apps/search/src/lib/algolia/algoliaUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const isAttributeValueBooleanType = (
): attributeValue is [{ boolean: boolean; inputType: AttributeInputTypeEnum.Boolean }] => {
return (
/**
* Boolean type can be only a single value. List API exists due to multi-value fields like multiselects
* Boolean type can be only a single value. List API exists due to multi-value fields like multiselect
*/
attributeValue.length === 1 &&
attributeValue[0].inputType === AttributeInputTypeEnum.Boolean &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createLogger } from "../../../logger";
import { SmtpConfig } from "./smtp-config-schema";

/*
*In case that pulling metadata takes too loong, the app will stuck and we won't know what is happening, since
*In case that pulling metadata takes too long, the app will stuck and we won't know what is happening, since
*function that process lives only 25s. We've set timeout, so if pulling metadata takes too long, we will throw an error.
*
*Maximum that call can take up to 1.5s, so we've set timeout to 3s as a safe margin.
Expand Down
2 changes: 1 addition & 1 deletion apps/smtp/src/modules/smtp/services/smtp-email-sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class SmtpEmailSender implements ISMTPEmailSender {
/*
* https://github.com/nodemailer/nodemailer/issues/1461#issuecomment-1263131029
* [secure argument] it’s not about security but if the server starts tcp connections over TLS mode or not.
* If it starts connections in cleartext mode, the client can not use TLS until STARTTLS can be established later.
* If it starts connections in cleartext mode, the client can not use TLS until START TLS can be established later.
*/

switch (smtpSettings.encryption) {
Expand Down
106 changes: 0 additions & 106 deletions cspell.json

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"scripts": {
"build": "turbo run build",
"check-spelling": "cspell **/*.{jsx,tsx,js,ts,md,mdx}",
"check-spelling": "cspell '**/*.{jsx,tsx,js,ts,md,mdx}'",
"check-types": "turbo run check-types",
"deploy": "turbo run deploy",
"dev": "turbo run dev",
Expand Down Expand Up @@ -39,7 +39,7 @@
"@sentry/cli": "2.32.1",
"@sentry/nextjs": "7.117.0",
"@types/node": "20.12.3",
"cspell": "^7.2.0",
"cspell": "8.15.2",
"eslint": "8.57.0",
"eslint-config-saleor": "workspace:*",
"husky": "9.1.4",
Expand Down
Loading

0 comments on commit ada478b

Please sign in to comment.