Skip to content

Commit 77afd57

Browse files
committed
refactor: change eslint & prettier configs
1 parent 197b78b commit 77afd57

File tree

59 files changed

+245
-402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+245
-402
lines changed

apps/calculator-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"preview": "astro preview",
1010
"build": "pnpm check && astro build",
1111
"lint": "eslint --fix src/**/*.{astro,ts}",
12-
"format": "prettier --write src/**/*.{astro,ts}",
13-
"check": "astro check --tsconfig tsconfig.json"
12+
"check": "astro check --tsconfig tsconfig.json",
13+
"format": "prettier --write src/**/*.{astro,ts,css}"
1414
},
1515
"engines": {
1616
"node": ">=20",
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<article class="rounded-xl bg-screen px-8 py-6">
1+
<article class="bg-screen rounded-xl px-8 py-6">
22
<input
3-
id="input-display"
4-
class="fix-color w-full overflow-x-auto bg-transparent text-right text-5xl leading-none text-primary focus:outline-none"
53
readonly
4+
id="input-display"
5+
class="fix-color text-primary w-full overflow-x-auto bg-transparent text-right text-5xl leading-none focus:outline-none"
66
/>
77
</article>

apps/calculator-app/src/components/Header.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import ThemeSwitch from '@/components/ThemeSwitch.astro'
33
---
44

55
<header class="grid w-full grid-cols-[repeat(2,max-content)] items-center justify-between">
6-
<h1 class="fix-color text-4xl text-primary">calc</h1>
6+
<h1 class="fix-color text-primary text-4xl">calc</h1>
77
<ThemeSwitch />
88
</header>

apps/calculator-app/src/components/Key.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const { id, value, variant = 'primary' } = Astro.props
1212
<button
1313
id={`key-${id}`}
1414
class:list={[
15-
'relative grid h-16 w-full select-none place-items-center rounded-lg border-b-4 border-key-primary-dark bg-key-primary-light text-3xl/none font-bold active:h-[60px] active:translate-y-[0.25rem] active:border-b-2',
15+
'border-key-primary-dark bg-key-primary-light relative grid h-16 w-full select-none place-items-center rounded-lg border-b-4 text-3xl/none font-bold active:h-[60px] active:translate-y-[0.25rem] active:border-b-2',
1616
{
1717
[`border-key-${variant}-dark bg-key-${variant}-light text-xl/none text-white`]: variant !== 'primary',
1818
},

apps/calculator-app/src/components/Keypad.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Key from '@/components/Key.astro'
33
import { keyList } from '@/scripts/consts.ts'
44
---
55

6-
<section class="w-full rounded-xl bg-keypad p-8">
6+
<section class="bg-keypad w-full rounded-xl p-8">
77
<article class="mb-4 grid grid-cols-[repeat(4,4rem)] gap-4">
88
{
99
keyList.map(({ key, code }) =>
Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,39 @@
1-
<article class="fix-color select-none text-sm uppercase text-primary">
1+
<article class="fix-color text-primary select-none text-sm uppercase">
22
<div class="ml-auto w-max *:cursor-pointer *:px-3">
33
<label for="step-1">1</label>
44
<label for="step-2">2</label>
55
<label for="step-3">3</label>
66
</div>
77
<div class="flex content-center items-center gap-x-6">
88
<span class="mt-1.5 leading-none">theme</span>
9-
<div class="relative grid h-8 w-[100px] grid-cols-3 rounded-full bg-keypad">
10-
<input type="radio" id="step-1" name="switch-step" value="1" class="hidden cursor-pointer" />
11-
<label aria-label="Step 1" for="step-1" class="cursor-pointer"></label>
9+
<div class="bg-keypad relative grid h-8 w-[100px] grid-cols-3 rounded-full">
10+
<input type="radio" id="switch-theme-1" name="switch-theme" value="1" class="hidden cursor-pointer" />
11+
<label aria-label="Step 1" for="switch-theme-1" class="cursor-pointer"></label>
1212

13-
<input type="radio" id="step-2" name="switch-step" value="2" class="hidden cursor-pointer" />
14-
<label aria-label="Step 2" for="step-2" class="cursor-pointer"></label>
13+
<input type="radio" id="switch-theme-2" name="switch-theme" value="2" class="hidden cursor-pointer" />
14+
<label aria-label="Step 2" for="switch-theme-2" class="cursor-pointer"></label>
1515

16-
<input type="radio" id="step-3" name="switch-step" value="3" class="hidden cursor-pointer" />
17-
<label aria-label="Step 3" for="step-3" class="cursor-pointer"></label>
16+
<input type="radio" id="switch-theme-3" name="switch-theme" value="3" class="hidden cursor-pointer" />
17+
<label aria-label="Step 3" for="switch-theme-3" class="cursor-pointer"></label>
1818

19-
<span id="selector" class="absolute left-0 transition-[left] duration-300 ease-in-out ml-1.5 mt-1.5 h-5 w-5 rounded-full bg-key-tertiary-light"></span>
19+
<span
20+
id="selector"
21+
class="bg-key-tertiary-light absolute left-0 ml-1.5 mt-1.5 h-5 w-5 rounded-full transition-[left] duration-300 ease-in-out"
22+
></span>
2023
</div>
2124
</div>
2225
</article>
2326

2427
<style>
25-
#step-1:checked ~ #selector {
28+
#switch-theme-1:checked ~ #selector {
2629
left: 0;
2730
}
2831

29-
#step-2:checked ~ #selector {
32+
#switch-theme-2:checked ~ #selector {
3033
left: 33%;
3134
}
3235

33-
#step-3:checked ~ #selector {
36+
#switch-theme-3:checked ~ #selector {
3437
left: 68%;
3538
}
3639
</style>

apps/calculator-app/src/layouts/Layout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import '@/styles/app.css'
1414
<script src="@/scripts/events.ts"></script>
1515
</head>
1616

17-
<body class="theme-1 grid min-h-screen content-center items-center gap-y-4 bg-main font-league-spartan">
17+
<body class="theme-1 bg-main font-league-spartan grid min-h-screen content-center items-center gap-y-4">
1818
<slot />
1919
</body>
2020
</html>

apps/calculator-app/src/pages/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ import Atributtion from 'shared/components/Atributtion.astro'
1313
<Display />
1414
<Keypad />
1515
</Container>
16-
<Atributtion class="fix-color mx-auto text-center text-sm text-primary" />
16+
<Atributtion class="fix-color text-primary mx-auto text-center text-sm" />
1717
</Layout>

apps/calculator-app/src/scripts/calculatorActions.ts

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -113,78 +113,6 @@ export function updateInputDisplay(value: string): void {
113113
}
114114
}
115115

116-
// export function updateInputDisplay (value: string): void {
117-
// const isDigit = !Number.isNaN(Number(value))
118-
119-
// if ($inputDisplay != null) {
120-
// switch (value) {
121-
// case 'NumpadMultiply':
122-
// case 'KeyX':
123-
// case 'X':
124-
// case 'x':
125-
// case '*':
126-
// updateOperation($inputDisplay, '*')
127-
// break
128-
// case 'NumpadDivide':
129-
// case '/':
130-
// updateOperation($inputDisplay, '/')
131-
// break
132-
// case 'NumpadAdd':
133-
// case '+':
134-
// updateOperation($inputDisplay, '+')
135-
// break
136-
// case 'NumpadSubtract':
137-
// case '-':
138-
// updateOperation($inputDisplay, '-')
139-
// break
140-
// case 'NumpadDecimal':
141-
// case '.':
142-
// updateValueWithPoint($inputDisplay)
143-
// break
144-
// case 'Backspace':
145-
// $inputDisplay.value = $inputDisplay.value.slice(0, -1)
146-
// break
147-
// case 'Delete':
148-
// $inputDisplay.value = ''
149-
// isOperationUsed = false
150-
// break
151-
// case 'Enter':
152-
// isOperationUsed = false
153-
154-
// if ($inputDisplay.value === '') {
155-
// $inputDisplay.value = '0'
156-
// return
157-
// }
158-
159-
// $inputDisplay.value = getResult($inputDisplay)
160-
// break
161-
// default:
162-
// if (isDigit) {
163-
// const lastValue = getLastNumber($inputDisplay.value)
164-
// $inputDisplay.value = lastValue === '0' ? $inputDisplay.value.slice(0, -1) + value : $inputDisplay.value + value
165-
// isOperationUsed = false
166-
// }
167-
// }
168-
169-
// $inputDisplay.scrollLeft = $inputDisplay.scrollWidth
170-
// }
171-
// }
172-
173-
// export function updateKeyActive (event: KeyboardEvent, classListMethod: 'add' | 'remove'): void {
174-
// try {
175-
// for (const { key, code } of keypadList) {
176-
// const codeExists = Array.isArray(code)
177-
178-
// if (key === event.key || (codeExists && code.includes(event.code))) {
179-
// const id = `#key-${codeExists ? code[0] : key}`
180-
// $(id)?.classList[classListMethod]('active')
181-
// }
182-
// }
183-
// } catch (error) {
184-
// console.error(error)
185-
// }
186-
// }
187-
188116
export function updateKeyActive(event: KeyboardEvent, classListMethod: 'add' | 'remove'): void {
189117
try {
190118
const keyItem = keypadList.find(({ key, code }) => matchesKeyOrCode(event, key, code))

apps/calculator-app/src/scripts/consts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const KEY_SELECTOR = '[id^="key-"]'
22
export const NUMBERS_SEPARATE_REGEX = /[+\-*/]/
33
export const THEME_STORAGE = 'calculator-app-theme'
4-
export const INPUT_SWITCH_SELECTOR = 'input[name="switch-step"]'
4+
export const INPUT_SWITCH_SELECTOR = 'input[name="switch-theme"]'
55

66
export const keyList = [
77
{ key: '7' },

0 commit comments

Comments
 (0)