-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate to typescript #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 8 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
def82e2
Add typescript migration draft
akumm2k f4c3c5d
Update tsconfig
akumm2k 2e8fbde
Refactor css for width limit
akumm2k 2b38fe0
GitIgnore node_modules
akumm2k 3997107
Use transpiled js in index.html
akumm2k 467634f
Update css
akumm2k 93afd91
Add html validation action
akumm2k a90976f
Fix github action version
akumm2k 7bc6836
Fix ts -> js import conversion
akumm2k 7f65564
Update project highlights
akumm2k 36736e4
Ignore jekyll generated files
akumm2k f58fea5
Add teaching articles via jekyll rendering
akumm2k 52cad25
Fix html validation workflow by excluding jekyll yt component
akumm2k ac3cb53
Use const iterator in proj_highlighter
akumm2k c550897
Revert to inline blacklist in github workflow
akumm2k 716cf9a
Fix github workflow blacklist
akumm2k 7508d68
Fix c-sharp id to match the one used in ts
akumm2k 03842fe
Try more exclusion patterns in html validation workflow
akumm2k 68a0b46
Add consistency to const naming
akumm2k 155fc1d
Fix no-space-between-attr error in index.html
akumm2k 529b9f8
Try extra key in github workflow to ignore _includes
akumm2k 52da4bb
Add strict null check to tsconfig
akumm2k dc11b42
Fix assertion check in proj_highlighter.ts
akumm2k 2de808a
Fix validation checks in index.html
akumm2k 93f5449
Remove unused erasableSyntaxOnly field from tsconfig
akumm2k File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| root = true | ||
|
|
||
| [*] | ||
| max_line_length = 120 | ||
| insert_final_newline = true | ||
|
|
||
| [*.ts] | ||
| indent_style = space | ||
| indent_size = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| name: HTML Validation | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ '*' ] | ||
|
|
||
| jobs: | ||
| validate: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Validate HTML | ||
| uses: Cyb3r-Jak3/html5validator-action@v7.2.0 | ||
| with: | ||
| root: . | ||
| blacklist: .git,.github,node_modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| .DS_Store | ||
| node_modules/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| node_modules | ||
| dist | ||
| build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "singleQuote": true, | ||
| "semi": true, | ||
| "trailingComma": "es5", | ||
| "printWidth": 72, | ||
| "tabWidth": 2 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| function calculateAge(birthday) { | ||
| const today = new Date(); | ||
| const yearsSinceBirth = today.getUTCFullYear() - birthday.getUTCFullYear(); | ||
| const birthMonth = birthday.getUTCMonth(); | ||
| const currMonth = today.getUTCMonth(); | ||
| const todayDate = today.getUTCDate(); | ||
| const birthDate = birthday.getUTCDate(); | ||
| if (currMonth < birthMonth || | ||
| (currMonth === birthMonth && todayDate < birthDate)) { | ||
| return yearsSinceBirth - 1; | ||
| } | ||
| return yearsSinceBirth; | ||
| } | ||
| const MY_BIRTHDAY = new Date(Date.UTC(2002, 4, 24)); | ||
| const MY_AGE = calculateAge(MY_BIRTHDAY); | ||
| const aboutParagraph = document.querySelector('#about > p'); | ||
| if (aboutParagraph) { | ||
| aboutParagraph.textContent += ` I am ${MY_AGE} years old.`; | ||
| } | ||
| export {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| export const PROJECTS = { | ||
| REVERSI: 'reversi', | ||
| MAZE_RUNNER_PAGE_READER: 'maze-runner-page-reader', | ||
| SUDOKU_SOLVER: 'sudoku-solver', | ||
| CRUD_APP: 'crud-app', | ||
| RB_TREE: 'rbTree', | ||
| GAUSS: 'gauss', | ||
| DICE_ROLLER: 'diceRoller', | ||
| PORTFOLIO: 'portfolio', | ||
| WEB_STUDIO: 'web-studio', | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| export const TOOLS = { | ||
| JAVA: 'java', | ||
| JAVASCRIPT: 'javascript', | ||
| TYPESCRIPT: 'typescript', | ||
| PYTHON: 'python', | ||
| CSS3: 'css3', | ||
| HTML5: 'html5', | ||
| GIT: 'git', | ||
| C_SHARP: 'csharp', | ||
| GITLAB: 'gitlab', | ||
| GITHUB: 'github', | ||
| CPP: 'cpp', | ||
| PHP: 'php', | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| const DARK_MODE_CHECKBOX = document.querySelector('#dark-mode-checkbox'); | ||
| const body = document.body; | ||
| const DARK_MODE = 'dark-mode-body', LIGHT_MODE = 'light-mode-body'; | ||
| if (DARK_MODE_CHECKBOX) { | ||
| DARK_MODE_CHECKBOX.addEventListener('change', () => { | ||
| body.classList.toggle(DARK_MODE); | ||
| body.classList.toggle(LIGHT_MODE); | ||
| }); | ||
| if (window.matchMedia && | ||
| window.matchMedia('(prefers-color-scheme: dark)').matches) { | ||
| DARK_MODE_CHECKBOX.checked = true; | ||
| body.classList.toggle(DARK_MODE); | ||
| } | ||
| if (window.matchMedia && | ||
| window.matchMedia('(prefers-color-scheme: light)').matches) { | ||
| DARK_MODE_CHECKBOX.checked = false; | ||
| body.classList.toggle(LIGHT_MODE); | ||
| } | ||
| } | ||
| export {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { TOOLS } from './constants/tools'; | ||
| import { PROJECTS } from './constants/projects'; | ||
| const PROJ_NODES = document.querySelectorAll('ol.proj-list > li > a'); | ||
| const PROJ_STACK = { | ||
| [PROJECTS.REVERSI]: [TOOLS.JAVA, TOOLS.GITHUB], | ||
| [PROJECTS.MAZE_RUNNER_PAGE_READER]: [TOOLS.PYTHON], | ||
| [PROJECTS.SUDOKU_SOLVER]: [TOOLS.CPP, TOOLS.GIT, TOOLS.GITLAB], | ||
| [PROJECTS.CRUD_APP]: [ | ||
| TOOLS.PHP, | ||
| TOOLS.JAVASCRIPT, | ||
| TOOLS.CSS3, | ||
| TOOLS.HTML5, | ||
| TOOLS.GIT, | ||
| ], | ||
| [PROJECTS.RB_TREE]: [TOOLS.C_SHARP, TOOLS.GIT, TOOLS.GITLAB], | ||
| [PROJECTS.GAUSS]: [TOOLS.PYTHON, TOOLS.GITLAB], | ||
| [PROJECTS.DICE_ROLLER]: [TOOLS.CPP, TOOLS.GITLAB], | ||
| [PROJECTS.PORTFOLIO]: [ | ||
| TOOLS.JAVASCRIPT, | ||
| TOOLS.HTML5, | ||
| TOOLS.CSS3, | ||
| TOOLS.GIT, | ||
| TOOLS.GITHUB, | ||
| ], | ||
| [PROJECTS.WEB_STUDIO]: [ | ||
| TOOLS.JAVASCRIPT, | ||
| TOOLS.HTML5, | ||
| TOOLS.CSS3, | ||
| TOOLS.GIT, | ||
| TOOLS.GITHUB, | ||
| ], | ||
| }; | ||
| Object.keys(PROJ_STACK).forEach((project) => { | ||
| const projElement = document.getElementById(project); | ||
| console.assert(projElement !== undefined, `${project} is not present in html`); | ||
| }); | ||
| PROJ_NODES.forEach((proj) => { | ||
| proj.addEventListener('mouseover', () => { | ||
| for (let tech of PROJ_STACK[proj.id]) { | ||
| const techElement = document.getElementById(tech); | ||
| if (techElement !== null) { | ||
| techElement.classList.add('hover'); | ||
| } | ||
| } | ||
| }); | ||
| proj.addEventListener('mouseout', () => { | ||
| for (let tech of PROJ_STACK[proj.id]) { | ||
| const techElement = document.getElementById(tech); | ||
| if (techElement !== null) { | ||
| techElement.classList.remove('hover'); | ||
| } | ||
| } | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import js from "@eslint/js"; | ||
| import globals from "globals"; | ||
| import tseslint from "typescript-eslint"; | ||
| import { defineConfig } from "eslint/config"; | ||
|
|
||
| export default defineConfig([ | ||
| { files: ["**/*.{js,mjs,cjs,ts,mts,cts}"], plugins: { js }, extends: ["js/recommended"], languageOptions: { globals: globals.browser } }, | ||
|
akumm2k marked this conversation as resolved.
|
||
| tseslint.configs.recommended, | ||
| ]); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.