diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 607aa78be..000000000 --- a/.prettierrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "trailingComma": "es5", - "useTabs": false, - "tabWidth": 2, - "semi": true, - "singleQuote": false, - "printWidth": 80, - "plugins": ["prettier-plugin-tailwindcss"] -} diff --git a/eslintrc.js b/eslintrc.js new file mode 100644 index 000000000..ee1b7ede0 --- /dev/null +++ b/eslintrc.js @@ -0,0 +1,23 @@ +module.exports = { + extends: ["next", "prettier"], + plugins: ["unicorn"], + rules: { + "no-unused-vars": [ + "error", + { + args: "after-used", + caughtErrors: "none", + ignoreRestSiblings: true, + vars: "all", + }, + ], + "prefer-const": "error", + "react-hooks/exhaustive-deps": "error", + "unicorn/filename-case": [ + "error", + { + case: "kebabCase", + }, + ], + }, +}; diff --git a/eslintrc.json b/eslintrc.json deleted file mode 100644 index 001cab27a..000000000 --- a/eslintrc.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "parser": "@typescript-eslint/parser", - "overrides": [ - { - "files": ["*.ts", "*.tsx"], - "parserOptions": { - "ecmaFeatures": { - "jsx": true - }, - "ecmaVersion": "latest", - "sourceType": "module", - "project": ["./tsconfig.json"] - }, - "extends": [ - "next", - "plugin:import/typescript", - "plugin:prettier/recommended", - "eslint:recommended", - "plugin:@typescript-eslint/recommended" - ], - "settings": { - "mdx/codeblocks": true - }, - "env": { - "es2021": true, - "browser": true - }, - "rules": { - "prettier/prettier": "warn", - "quotes": [ - "error", - "double", - { - "avoidEscape": true - } - ], - "@typescript-eslint/quotes": [ - "error", - "double", - { - "avoidEscape": true - } - ], - "@typescript-eslint/no-shadow": "off", - "no-underscore-dangle": "off", - "class-methods-use-this": "off", - "@typescript-eslint/no-unused-vars": "warn", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/naming-convention": [ - "warn", - { - "selector": "typeProperty", - "format": ["PascalCase", "UPPER_CASE", "camelCase", "snake_case"], - "leadingUnderscore": "allow", - "trailingUnderscore": "allow" - } - ], - "import/no-extraneous-dependencies": "off" - }, - "plugins": ["@typescript-eslint", "prettier"] - } - ], - "extends": [] -} diff --git a/lib/commercetools/index.ts b/lib/commercetools/index.ts index 139597f9c..e69de29bb 100644 --- a/lib/commercetools/index.ts +++ b/lib/commercetools/index.ts @@ -1,2 +0,0 @@ - - diff --git a/lib/commercetools/types.ts b/lib/commercetools/types.ts index 5ce36b49c..078b86223 100644 --- a/lib/commercetools/types.ts +++ b/lib/commercetools/types.ts @@ -1,108 +1,107 @@ export type Cart = { - id: string; - checkoutUrl: string; - cost: { - subtotalAmount: Money; - totalAmount: Money; - totalTaxAmount: Money; - }; - lines: CartItem[]; - totalQuantity: number; + id: string; + checkoutUrl: string; + cost: { + subtotalAmount: Money; + totalAmount: Money; + totalTaxAmount: Money; }; - - export type CartItem = { - id: string; - quantity: number; - cost: { - totalAmount: Money; - }; - merchandise: { - id: string; - title: string; - selectedOptions: { - name: string; - value: string; - }[]; - product: Product; - }; + lines: CartItem[]; + totalQuantity: number; +}; + +export type CartItem = { + id: string; + quantity: number; + cost: { + totalAmount: Money; }; - - export type Collection = { - handle: string; - title: string; - description: string; - seo: SEO; - updatedAt: string; - path: string; - }; - - export type Image = { - url: string; - altText: string; - width: number; - height: number; - }; - - export type Menu = { - title: string; - path: string; - }; - - export type Money = { - amount: string; - currencyCode: string; - }; - - export type Page = { + merchandise: { id: string; title: string; - handle: string; - body: string; - bodySummary: string; - seo?: SEO; - createdAt: string; - updatedAt: string; - }; - - export type Product = { - id: string; - handle: string; - availableForSale: boolean; - title: string; - description: string; - descriptionHtml: string; - options: ProductOption[]; - priceRange: { - maxVariantPrice: Money; - minVariantPrice: Money; - }; - variants: ProductVariant[]; - featuredImage: Image; - images: Image[]; - seo: SEO; - tags: string[]; - updatedAt: string; - }; - - export type ProductOption = { - id: string; - name: string; - values: string[]; - }; - - export type ProductVariant = { - id: string; - title: string; - availableForSale: boolean; selectedOptions: { name: string; value: string; }[]; - price: Money; + product: Product; }; - - export type SEO = { - title: string; - description: string; +}; + +export type Collection = { + handle: string; + title: string; + description: string; + seo: SEO; + updatedAt: string; + path: string; +}; + +export type Image = { + url: string; + altText: string; + width: number; + height: number; +}; + +export type Menu = { + title: string; + path: string; +}; + +export type Money = { + amount: string; + currencyCode: string; +}; + +export type Page = { + id: string; + title: string; + handle: string; + body: string; + bodySummary: string; + seo?: SEO; + createdAt: string; + updatedAt: string; +}; + +export type Product = { + id: string; + handle: string; + availableForSale: boolean; + title: string; + description: string; + descriptionHtml: string; + options: ProductOption[]; + priceRange: { + maxVariantPrice: Money; + minVariantPrice: Money; }; - \ No newline at end of file + variants: ProductVariant[]; + featuredImage: Image; + images: Image[]; + seo: SEO; + tags: string[]; + updatedAt: string; +}; + +export type ProductOption = { + id: string; + name: string; + values: string[]; +}; + +export type ProductVariant = { + id: string; + title: string; + availableForSale: boolean; + selectedOptions: { + name: string; + value: string; + }[]; + price: Money; +}; + +export type SEO = { + title: string; + description: string; +}; diff --git a/package.json b/package.json index 4ebf09b47..f63778b8f 100644 --- a/package.json +++ b/package.json @@ -38,9 +38,6 @@ "@types/node": "20.8.9", "@types/react": "18.2.33", "@types/react-dom": "18.2.14", - "@types/eslint": "^8.44.7", - "@typescript-eslint/eslint-plugin": "^6.11.0", - "@typescript-eslint/parser": "^6.11.0", "@vercel/git-hooks": "^1.0.0", "autoprefixer": "^10.4.16", "eslint": "^8.52.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8faba6d93..8a2e26151 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -40,9 +40,6 @@ devDependencies: '@tailwindcss/typography': specifier: ^0.5.10 version: 0.5.10(tailwindcss@3.3.5) - '@types/eslint': - specifier: ^8.44.7 - version: 8.44.7 '@types/node': specifier: 20.8.9 version: 20.8.9 @@ -52,12 +49,6 @@ devDependencies: '@types/react-dom': specifier: 18.2.14 version: 18.2.14 - '@typescript-eslint/eslint-plugin': - specifier: ^6.11.0 - version: 6.11.0(@typescript-eslint/parser@6.11.0)(eslint@8.52.0)(typescript@5.2.2) - '@typescript-eslint/parser': - specifier: ^6.11.0 - version: 6.11.0(eslint@8.52.0)(typescript@5.2.2) '@vercel/git-hooks': specifier: ^1.0.0 version: 1.0.0 @@ -430,21 +421,6 @@ packages: tailwindcss: 3.3.5 dev: true - /@types/eslint@8.44.7: - resolution: {integrity: sha512-f5ORu2hcBbKei97U73mf+l9t4zTGl74IqZ0GQk4oVea/VS8tQZYkUveSYojk+frraAVYId0V2WC9O4PTNru2FQ==} - dependencies: - '@types/estree': 1.0.5 - '@types/json-schema': 7.0.15 - dev: true - - /@types/estree@1.0.5: - resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} - dev: true - - /@types/json-schema@7.0.15: - resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - dev: true - /@types/json5@0.0.29: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: true @@ -481,39 +457,6 @@ packages: resolution: {integrity: sha512-s/FPdYRmZR8SjLWGMCuax7r3qCWQw9QKHzXVukAuuIJkXkDRwp+Pu5LMIVFi0Fxbav35WURicYr8u1QsoybnQw==} dev: true - /@types/semver@7.5.5: - resolution: {integrity: sha512-+d+WYC1BxJ6yVOgUgzK8gWvp5qF8ssV5r4nsDcZWKRWcDQLQ619tvWAxJQYGgBrO1MnLJC7a5GtiYsAoQ47dJg==} - dev: true - - /@typescript-eslint/eslint-plugin@6.11.0(@typescript-eslint/parser@6.11.0)(eslint@8.52.0)(typescript@5.2.2): - resolution: {integrity: sha512-uXnpZDc4VRjY4iuypDBKzW1rz9T5YBBK0snMn8MaTSNd2kMlj50LnLBABELjJiOL5YHk7ZD8hbSpI9ubzqYI0w==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha - eslint: ^7.0.0 || ^8.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 6.11.0(eslint@8.52.0)(typescript@5.2.2) - '@typescript-eslint/scope-manager': 6.11.0 - '@typescript-eslint/type-utils': 6.11.0(eslint@8.52.0)(typescript@5.2.2) - '@typescript-eslint/utils': 6.11.0(eslint@8.52.0)(typescript@5.2.2) - '@typescript-eslint/visitor-keys': 6.11.0 - debug: 4.3.4 - eslint: 8.52.0 - graphemer: 1.4.0 - ignore: 5.2.4 - natural-compare: 1.4.0 - semver: 7.5.4 - ts-api-utils: 1.0.3(typescript@5.2.2) - typescript: 5.2.2 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/parser@6.11.0(eslint@8.52.0)(typescript@5.2.2): resolution: {integrity: sha512-+whEdjk+d5do5nxfxx73oanLL9ghKO3EwM9kBCkUtWMRwWuPaFv9ScuqlYfQ6pAD6ZiJhky7TZ2ZYhrMsfMxVQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -543,26 +486,6 @@ packages: '@typescript-eslint/visitor-keys': 6.11.0 dev: true - /@typescript-eslint/type-utils@6.11.0(eslint@8.52.0)(typescript@5.2.2): - resolution: {integrity: sha512-nA4IOXwZtqBjIoYrJcYxLRO+F9ri+leVGoJcMW1uqr4r1Hq7vW5cyWrA43lFbpRvQ9XgNrnfLpIkO3i1emDBIA==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/typescript-estree': 6.11.0(typescript@5.2.2) - '@typescript-eslint/utils': 6.11.0(eslint@8.52.0)(typescript@5.2.2) - debug: 4.3.4 - eslint: 8.52.0 - ts-api-utils: 1.0.3(typescript@5.2.2) - typescript: 5.2.2 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/types@6.11.0: resolution: {integrity: sha512-ZbEzuD4DwEJxwPqhv3QULlRj8KYTAnNsXxmfuUXFCxZmO6CF2gM/y+ugBSAQhrqaJL3M+oe4owdWunaHM6beqA==} engines: {node: ^16.0.0 || >=18.0.0} @@ -589,25 +512,6 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@6.11.0(eslint@8.52.0)(typescript@5.2.2): - resolution: {integrity: sha512-p23ibf68fxoZy605dc0dQAEoUsoiNoP3MD9WQGiHLDuTSOuqoTsa4oAy+h3KDkTcxbbfOtUjb9h3Ta0gT4ug2g==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.52.0) - '@types/json-schema': 7.0.15 - '@types/semver': 7.5.5 - '@typescript-eslint/scope-manager': 6.11.0 - '@typescript-eslint/types': 6.11.0 - '@typescript-eslint/typescript-estree': 6.11.0(typescript@5.2.2) - eslint: 8.52.0 - semver: 7.5.4 - transitivePeerDependencies: - - supports-color - - typescript - dev: true - /@typescript-eslint/visitor-keys@6.11.0: resolution: {integrity: sha512-+SUN/W7WjBr05uRxPggJPSzyB8zUpaYo2hByKasWbqr3PM8AXfZt8UHdNpBS1v9SA62qnSSMF3380SwDqqprgQ==} engines: {node: ^16.0.0 || >=18.0.0} diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 000000000..08c633104 --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,9 @@ +/** @type {import('prettier').Config} */ +module.exports = { + singleQuote: false, + arrowParens: 'always', + trailingComma: 'none', + printWidth: 100, + tabWidth: 2, + plugins: ['prettier-plugin-tailwindcss'] +};