Skip to content

Commit

Permalink
chore: update JSDoc types according to ESLint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
ozgurg committed Jul 2, 2023
1 parent a47d2d5 commit 7766ba3
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 31 deletions.
8 changes: 4 additions & 4 deletions data/pages/kdv-hesaplayici/kdv-hesaplayici.calculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ const Mode = {
*/
class Calculator {
/**
* @type {Object<string, number | null>}
* @type {{[key: string]: number|null}}
*/
#taxFees = {
total: null,
valueAddedTax: null // TRY | Turkish: Katma Değer Vergisi (KDV)
};

/**
* @type {Object<string, number | null>}
* @type {{[key: string]: number|null}}
*/
#taxRates = {
total: null,
valueAddedTax: null // Percentage of previous price | Turkish: Katma Değer Vergisi (KDV)
};

/**
* @type {Object<string, number | null>}
* @type {{[key: string]: number|null}}
*/
#prices = {
taxFree: null,
Expand Down Expand Up @@ -61,7 +61,7 @@ class Calculator {
}

/**
* @returns {Object<string, Object<string, number | null>>}
* @returns {{[key: string]: {[key: string]: number|null}}}
*/
calculate() {
this.#taxRates.valueAddedTax = this.#rate;
Expand Down
10 changes: 5 additions & 5 deletions data/pages/kdv-hesaplayici/kdv-hesaplayici.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Mode } from "@/data/pages/kdv-hesaplayici/kdv-hesaplayici.calculator.js
* Decides whether to show the calculator results or not.
* It doesn't validate the inputs. They must be validated before it can be used.
*
* @param {Object<string, *>} form
* @param {{[key: string]: *}} form
* @returns {boolean}
*/
const shouldShowResults = form => {
Expand All @@ -14,9 +14,9 @@ const shouldShowResults = form => {
};

/**
* @param {Object<string, *>} query
* @param {{[key: string]: *}} query
* @param {object} requirements
* @param {Object<{title: string, value: Mode}>} requirements.modeOptions
* @param {{title: string, value: Mode}[]} requirements.modeOptions
* @returns {{price: number, mode: Mode}|void}
*/
const handleQuery = (query, { modeOptions }) => {
Expand All @@ -40,8 +40,8 @@ const handleQuery = (query, { modeOptions }) => {
};

/**
* @param {Object<string, Object<string, number>>} results
* @returns {Object<{key: string, value: string}>[]}
* @param {{[key: string]: {[key: string]: number}}} results
* @returns {{key: string, value: string}[]}
*/
const buildResultList = results => {
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { normalizeCalculatorResults } from "@/utils/normalize-calculator-results
*/
class Calculator {
/**
* @type {Object<string, number | null>}
* @type {{[key: string]: number|null}}
*/
#taxFees = {
total: null,
Expand All @@ -20,7 +20,7 @@ class Calculator {
};

/**
* @type {Object<string, number | null>}
* @type {{[key: string]: number|null}}
*/
#taxRates = {
total: null,
Expand All @@ -30,7 +30,7 @@ class Calculator {
};

/**
* @type {Object<string, number | null>}
* @type {{[key: string]: number|null}}
*/
#prices = {
taxFree: null,
Expand Down Expand Up @@ -67,7 +67,7 @@ class Calculator {

/**
* @private
* @param {Object<string, number | null>} taxFees
* @param {{[key: string]: number|null}} taxFees
* @returns {number}
*/
#calculateTotalTaxFee(taxFees) {
Expand Down Expand Up @@ -109,7 +109,7 @@ class Calculator {

/**
* @public
* @returns {Object<string, Object<string, number | null>>}
* @returns {{[key: string]: {[key: string]: number|null}}}
*/
calculate() {
this.#_customTax();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { moneyFormat } from "@/utils/formatter.js";
* Decides whether to show the calculator results or not.
* It doesn't validate the inputs. They must be validated before it can be used.
*
* @param {Object<string, *>} form
* @param {{[key: string]: *}} form
* @returns {boolean}
*/
const shouldShowResults = form => {
Expand All @@ -14,7 +14,7 @@ const shouldShowResults = form => {
};

/**
* @param {Object<string, *>} query
* @param {{[key: string]: *}} query
* @param {object} requirements
* @param {string[]} requirements.availableCurrencies
* @returns {{price: number, currency: string}|void}
Expand All @@ -36,8 +36,8 @@ const handleQuery = (query, { availableCurrencies }) => {
};

/**
* @param {Object<string, Object<string, number>>} results
* @returns {Object<{key: string, value: string}>[]}
* @param {{[key: string]: {[key: string]: number}}} results
* @returns {{key: string, value: string}[]}
*/
const buildResultList = results => {
return [
Expand Down Expand Up @@ -72,7 +72,7 @@ const buildResultList = results => {
* @param {object} opts
* @param {number} opts.price
* @param {string} opts.currency
* @returns {Object<{key: string, value: string}>[]}
* @returns {{key: string, value: string}[]}
*/
const buildScreenshotInput = ({ price, currency }) => {
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Registration = {
*/
class Calculator {
/**
* @type {Object<string, number | null>}
* @type {{[key: string]: number|null}}
*/
#taxFees = {
total: null,
Expand All @@ -48,7 +48,7 @@ class Calculator {
};

/**
* @type {Object<string, number | null>}
* @type {{[key: string]: number|null}}
*/
#taxRates = {
total: null,
Expand All @@ -60,7 +60,7 @@ class Calculator {
};

/**
* @type {Object<string, number | null>}
* @type {{[key: string]: number|null}}
*/
#prices = {
taxFree: null,
Expand Down Expand Up @@ -103,7 +103,7 @@ class Calculator {

/**
* @private
* @param {Object<string, number | null>} taxFees
* @param {{[key: string]: number|null}} taxFees
* @returns {number}
*/
#calculateTotalTaxFee(taxFees) {
Expand Down Expand Up @@ -174,7 +174,7 @@ class Calculator {

/**
* @public
* @returns {Object<string, Object<string, number | null>>}
* @returns {{[key: string]: {[key: string]: number|null}}}
*/
calculate() {
if (this.#registration === Registration.Import) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { moneyFormat } from "@/utils/formatter.js";
* Decides whether to show the calculator results or not.
* It doesn't validate the inputs. They must be validated before it can be used.
*
* @param {Object<string, *>} form
* @param {{[key: string]: *}} form
* @returns {boolean}
*/
const shouldShowResults = form => {
Expand All @@ -16,7 +16,7 @@ const shouldShowResults = form => {
};

/**
* @param {Object<string, *>} query
* @param {{[key: string]: *}} query
* @param {object} requirements
* @param {string[]} requirements.availableCurrencies
* @param {{value: string}[]} requirements.registration
Expand Down Expand Up @@ -44,9 +44,9 @@ const handleQuery = (query, { availableCurrencies, registration }) => {
};

/**
* @param {Object<string, Object<string, number>>} results
* @param {{[key: string]: {[key: string]: number}}} results
* @param {Registration} registration
* @returns {Object<{key: string, value: string}>[]}
* @returns {{key: string, value: string}[]}
*/
const buildResultList = (results, registration) => {
return [
Expand Down Expand Up @@ -103,7 +103,7 @@ const buildResultList = (results, registration) => {
* @param {number} opts.price
* @param {string} opts.currency
* @param {string} opts.registrationTitle
* @returns {Object<{key: string, value: string}>[]}
* @returns {{key: string, value: string}[]}
*/
const buildScreenshotInput = ({ price, currency, registrationTitle }) => {
return [
Expand Down
4 changes: 2 additions & 2 deletions utils/normalize-calculator-results.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { normalizePrice } from "@/utils/formatter.js";

/**
* @param {Object<string, Object<string, number | null>>} results
* @returns {Object<string, Object<string, number | null>>}
* @param {{[key: string]: {[key: string]: number|null}}} results
* @returns {{[key: string]: {[key: string]: number|null}}}
*/
const normalizeCalculatorResults = results => {
for (const [key1, value1] of Object.entries(results)) {
Expand Down

0 comments on commit 7766ba3

Please sign in to comment.