Skip to content

Commit

Permalink
Add prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
andershagbard committed Sep 29, 2023
1 parent 2a56494 commit 515a303
Show file tree
Hide file tree
Showing 33 changed files with 356 additions and 337 deletions.
9 changes: 2 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
module.exports = {
extends: [
'airbnb-base',
'airbnb-typescript/base',
],
extends: ['airbnb-base', 'airbnb-typescript/base'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
plugins: [
'@typescript-eslint',
],
plugins: ['@typescript-eslint'],
};
58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '15 18 * * 2'

Expand All @@ -32,40 +32,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
75 changes: 45 additions & 30 deletions global/Shopify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,51 @@ import Image from './modules/Image';
import CustomerPrivacy from './modules/customerPrivacy';

export default interface Shopify {
CountryProvinceSelector?: (country_domid: string, province_domid: string, options?: {
hideElement: string
}) => void
postLink?: (path: string, options?: {
method?: string
parameters?: object
}) => void
addListener?: (target: HTMLElement, eventName: string, callback: CallableFunction) => void
setSelectorByValue?: (selector: HTMLSelectElement, value: any) => number
Image?: Image
OptionSelectors?: (selector: string, config: {
product: ProductJSON | ProductObject
onVariantSelected: CallableFunction
enableHistoryState?: boolean
}) => void
OptionSelectorsFromDOM?: FunctionConstructor
loadFeatures: (features: any[], callback: CallableFunction) => void
customerPrivacy?: CustomerPrivacy
CountryProvinceSelector?: (
country_domid: string,
province_domid: string,
options?: {
hideElement: string;
},
) => void;
postLink?: (
path: string,
options?: {
method?: string;
parameters?: object;
},
) => void;
addListener?: (
target: HTMLElement,
eventName: string,
callback: CallableFunction,
) => void;
setSelectorByValue?: (selector: HTMLSelectElement, value: any) => number;
Image?: Image;
OptionSelectors?: (
selector: string,
config: {
product: ProductJSON | ProductObject;
onVariantSelected: CallableFunction;
enableHistoryState?: boolean;
},
) => void;
OptionSelectorsFromDOM?: FunctionConstructor;
loadFeatures: (features: any[], callback: CallableFunction) => void;
customerPrivacy?: CustomerPrivacy;
currency: {
active: string
rate: string
}
cdnHost: 'cdn.shopify.com'
country: string
locale: string
formatMoney: (price: string | number, format: string) => string
money_format: string
shop: string
designMode: true | undefined
active: string;
rate: string;
};
cdnHost: 'cdn.shopify.com';
country: string;
locale: string;
formatMoney: (price: string | number, format: string) => string;
money_format: string;
shop: string;
designMode: true | undefined;
routes: {
root: string
}
root: string;
};
}

10 changes: 5 additions & 5 deletions global/modules/Image.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default interface Image {
switchImage: CallableFunction
getSizedImageUrl: (src: string, size: string) => string
imageSize: (src: string) => string | null
loadImage: (src: string) => void
removeProtocol: (url: string) => string
switchImage: CallableFunction;
getSizedImageUrl: (src: string, size: string) => string;
imageSize: (src: string) => string | null;
loadImage: (src: string) => void;
removeProtocol: (url: string) => string;
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"license": "MIT",
"scripts": {
"lint": "node_modules/.bin/eslint . --ext .js,.ts",
"test": "yarn lint"
"test": "yarn lint",
"format": "yarn prettier . --write"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.0.0",
Expand All @@ -13,6 +14,7 @@
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-plugin-import": "^2.0.0",
"prettier": "^3.0.0",
"typescript": "^4.0.0"
},
"repository": {
Expand Down
26 changes: 13 additions & 13 deletions type/json/Cart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import LineItem from './LineItem';
import DiscountApplication from './DiscountApplication';

export default interface Cart {
token: string
note: string | null
attributes: { [key: string]: string | boolean } | null
original_total_price: number
total_price: number
total_discount: number
total_weight: number
item_count: number
items: LineItem[]
requires_shipping: boolean
currency: string
items_subtotal_price: number
cart_level_discount_applications: DiscountApplication[]
token: string;
note: string | null;
attributes: { [key: string]: string | boolean } | null;
original_total_price: number;
total_price: number;
total_discount: number;
total_weight: number;
item_count: number;
items: LineItem[];
requires_shipping: boolean;
currency: string;
items_subtotal_price: number;
cart_level_discount_applications: DiscountApplication[];
}
2 changes: 1 addition & 1 deletion type/json/Collection/Products.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import Product from '../Product';

export type Products = Product[]
export type Products = Product[];
16 changes: 8 additions & 8 deletions type/json/Collection/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Image from '../Image';

export default interface Collection {
id: number
title: string
handle: string
description: string
published_at: string
updated_at: string
image: Image | null
products_count: number
id: number;
title: string;
handle: string;
description: string;
published_at: string;
updated_at: string;
image: Image | null;
products_count: number;
}
4 changes: 2 additions & 2 deletions type/json/DiscountAllocations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import DiscountApplication from './DiscountApplication';

export default interface DiscountAllocations {
amount: number
discount_application: DiscountApplication
amount: number;
discount_application: DiscountApplication;
}
22 changes: 11 additions & 11 deletions type/json/DiscountApplication.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export default interface DiscountApplication {
type: 'automatic' | 'discount_code' | 'manual' | 'script'
key: string
title: string
description: string | null
value: number
created_at: string
value_type: 'fixed_amount' | 'percentage'
allocation_method: 'across' | 'each' | 'one'
target_selection: 'all' | 'entitled' | 'explicit'
target_type: 'line_item' | 'shipping_line'
total_allocated_amount: number
type: 'automatic' | 'discount_code' | 'manual' | 'script';
key: string;
title: string;
description: string | null;
value: number;
created_at: string;
value_type: 'fixed_amount' | 'percentage';
allocation_method: 'across' | 'each' | 'one';
target_selection: 'all' | 'entitled' | 'explicit';
target_type: 'line_item' | 'shipping_line';
total_allocated_amount: number;
}
8 changes: 4 additions & 4 deletions type/json/Image.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default interface Image {
id: number
created_at: string
src: string
alt: string | null
id: number;
created_at: string;
src: string;
alt: string | null;
}
Loading

0 comments on commit 515a303

Please sign in to comment.