diff --git a/.eslintrc.js b/.eslintrc.js index f553a7d..6a2a062 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -40,6 +40,8 @@ module.exports = { // because sometimes it's clearer than template strings 'prefer-template': 'off', + 'no-unused-vars': 'warn', + /* PRETTIER * * These Airbnb rules need to be re-defined @@ -56,7 +58,7 @@ module.exports = { 'eslint-comments/no-unused-disable': 'error', - 'simple-import-sort/imports': 'error', + 'simple-import-sort/imports': 'warn', /* UNICORN * diff --git a/README.md b/README.md index 738d5d1..3272e51 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,10 @@ Also, in VS Code: 2. Choose _"Extensions: Show Recommended Extensions"_ 3. Install the recommended extensions +### Other tips + +- [Run 'ESLint: Fix all auto-fixable Problems' on save](https://www.digitalocean.com/community/tutorials/workflow-auto-eslinting#step-4-%E2%80%93-adding-code-actions-on-save) + ## Building for production 1. `npm install` diff --git a/netlify.toml b/netlify.toml index 013cbb9..85a37c6 100644 --- a/netlify.toml +++ b/netlify.toml @@ -27,6 +27,10 @@ from = "https://krapu.la/kysy" to = "https://forms.gle/uyh3v8bbQUwnizEw5" status = 302 +[[redirects]] + from = "https://koodikrapula.fi/kysy" + to = "https://forms.gle/uyh3v8bbQUwnizEw5" + status = 302 [[redirects]] from = "https://koodikrapula.netlify.app/*" diff --git a/package-lock.json b/package-lock.json index 2ce7afe..0159190 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,12 +16,12 @@ "eslint-config-prettier": "^8.3.0", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-import": "^2.22.1", - "eslint-plugin-simple-import-sort": "^7.0.0", "eslint-plugin-sonarjs": "^0.8.0-125", "eslint-plugin-unicorn": "^33.0.1", "esm": "^3.2.25", "htm": "^3.0.4", - "markdown-it": "^10.0.0", + "markdown-it": "^12.2.0", + "markdown-it-link-attributes": "^3.0.0", "preact": "^10.5.13", "preact-render-to-string": "^5.1.19", "prettier": "2.3.2", @@ -29,7 +29,8 @@ "twind": "^0.16.16" }, "devDependencies": { - "@types/eslint": "^7.2.13" + "@types/eslint": "^7.2.13", + "eslint-plugin-simple-import-sort": "^7.0.0" }, "engines": { "node": ">=14.0.0", @@ -90,6 +91,29 @@ "url": "https://opencollective.com/11ty" } }, + "node_modules/@11ty/eleventy/node_modules/linkify-it": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", + "integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==", + "dependencies": { + "uc.micro": "^1.0.1" + } + }, + "node_modules/@11ty/eleventy/node_modules/markdown-it": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz", + "integrity": "sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg==", + "dependencies": { + "argparse": "^1.0.7", + "entities": "~2.0.0", + "linkify-it": "^2.0.0", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" + }, + "bin": { + "markdown-it": "bin/markdown-it.js" + } + }, "node_modules/@babel/code-frame": { "version": "7.12.11", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", @@ -2099,6 +2123,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz", "integrity": "sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw==", + "dev": true, "peerDependencies": { "eslint": ">=5.0.0" } @@ -3435,9 +3460,9 @@ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=" }, "node_modules/linkify-it": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", - "integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", + "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", "dependencies": { "uc.micro": "^1.0.1" } @@ -3621,13 +3646,13 @@ } }, "node_modules/markdown-it": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz", - "integrity": "sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg==", + "version": "12.2.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.2.0.tgz", + "integrity": "sha512-Wjws+uCrVQRqOoJvze4HCqkKl1AsSh95iFAeQDwnyfxM09divCBSXlDR1uTvyUP3Grzpn4Ru8GeCxYPM8vkCQg==", "dependencies": { - "argparse": "^1.0.7", - "entities": "~2.0.0", - "linkify-it": "^2.0.0", + "argparse": "^2.0.1", + "entities": "~2.1.0", + "linkify-it": "^3.0.1", "mdurl": "^1.0.1", "uc.micro": "^1.0.5" }, @@ -3635,6 +3660,24 @@ "markdown-it": "bin/markdown-it.js" } }, + "node_modules/markdown-it-link-attributes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/markdown-it-link-attributes/-/markdown-it-link-attributes-3.0.0.tgz", + "integrity": "sha512-B34ySxVeo6MuEGSPCWyIYryuXINOvngNZL87Mp7YYfKIf6DcD837+lXA8mo6EBbauKsnGz22ZH0zsbOiQRWTNg==" + }, + "node_modules/markdown-it/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/markdown-it/node_modules/entities": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", + "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/maximatch": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/maximatch/-/maximatch-0.1.0.tgz", @@ -6041,6 +6084,28 @@ "slugify": "^1.4.7", "time-require": "^0.1.2", "valid-url": "^1.0.9" + }, + "dependencies": { + "linkify-it": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", + "integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==", + "requires": { + "uc.micro": "^1.0.1" + } + }, + "markdown-it": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz", + "integrity": "sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg==", + "requires": { + "argparse": "^1.0.7", + "entities": "~2.0.0", + "linkify-it": "^2.0.0", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" + } + } } }, "@babel/code-frame": { @@ -7606,6 +7671,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz", "integrity": "sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw==", + "dev": true, "requires": {} }, "eslint-plugin-sonarjs": { @@ -8566,9 +8632,9 @@ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=" }, "linkify-it": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", - "integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", + "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", "requires": { "uc.micro": "^1.0.1" } @@ -8714,17 +8780,34 @@ "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" }, "markdown-it": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz", - "integrity": "sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg==", + "version": "12.2.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.2.0.tgz", + "integrity": "sha512-Wjws+uCrVQRqOoJvze4HCqkKl1AsSh95iFAeQDwnyfxM09divCBSXlDR1uTvyUP3Grzpn4Ru8GeCxYPM8vkCQg==", "requires": { - "argparse": "^1.0.7", - "entities": "~2.0.0", - "linkify-it": "^2.0.0", + "argparse": "^2.0.1", + "entities": "~2.1.0", + "linkify-it": "^3.0.1", "mdurl": "^1.0.1", "uc.micro": "^1.0.5" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "entities": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", + "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==" + } } }, + "markdown-it-link-attributes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/markdown-it-link-attributes/-/markdown-it-link-attributes-3.0.0.tgz", + "integrity": "sha512-B34ySxVeo6MuEGSPCWyIYryuXINOvngNZL87Mp7YYfKIf6DcD837+lXA8mo6EBbauKsnGz22ZH0zsbOiQRWTNg==" + }, "maximatch": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/maximatch/-/maximatch-0.1.0.tgz", diff --git a/package.json b/package.json index f707a3b..df4816a 100644 --- a/package.json +++ b/package.json @@ -19,12 +19,12 @@ "eslint-config-prettier": "^8.3.0", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-import": "^2.22.1", - "eslint-plugin-simple-import-sort": "^7.0.0", "eslint-plugin-sonarjs": "^0.8.0-125", "eslint-plugin-unicorn": "^33.0.1", "esm": "^3.2.25", "htm": "^3.0.4", - "markdown-it": "^10.0.0", + "markdown-it": "^12.2.0", + "markdown-it-link-attributes": "^3.0.0", "preact": "^10.5.13", "preact-render-to-string": "^5.1.19", "prettier": "2.3.2", @@ -32,7 +32,8 @@ "twind": "^0.16.16" }, "devDependencies": { - "@types/eslint": "^7.2.13" + "@types/eslint": "^7.2.13", + "eslint-plugin-simple-import-sort": "^7.0.0" }, "engines": { "node": ">=14.0.0", diff --git a/src/js/components/Link.js b/src/js/components/Link.js index faa6ab9..45d3584 100644 --- a/src/js/components/Link.js +++ b/src/js/components/Link.js @@ -1,6 +1,7 @@ import { ExternalLinkIcon } from '@heroicons/react/solid' import { html } from 'htm/preact' import { apply, tw } from 'twind' +import { linkClasses } from '../utils/const' export default ({ children, @@ -10,7 +11,7 @@ export default ({ ...rest }) => html` html`

Soitin tulossa pian${char.trade}! Sitä ennen voit kuunnella podia mm.${' '} - + <${Link} href="https://open.spotify.com/show/1st4zWhHxzXn345vqdTfk8"> Spotifyssa - + ${' ja '} - + <${Link} + href="https://podcasts.apple.com/us/podcast/koodikrapula/id1572320652" + > Apple Podcastsissa - + .

` diff --git a/src/js/utils/const.js b/src/js/utils/const.js new file mode 100644 index 0000000..3ea0ee1 --- /dev/null +++ b/src/js/utils/const.js @@ -0,0 +1,5 @@ +/* eslint-disable eslint-comments/disable-enable-pair */ +/* eslint-disable import/prefer-default-export */ + +export const linkClasses = + 'underline text-red(hover:600 active:700) focus-visible:(outline-none ring(2 blue-300 offset-2))' diff --git a/src/js/utils/markdownIt.js b/src/js/utils/markdownIt.js index 8b66b5c..4b8ba68 100644 --- a/src/js/utils/markdownIt.js +++ b/src/js/utils/markdownIt.js @@ -1,3 +1,9 @@ import markdownIt from 'markdown-it' +import markdownItLinkAttributes from 'markdown-it-link-attributes' +import { linkClasses } from './const' -export default markdownIt({ html: true }) +export default markdownIt({ html: true }).use(markdownItLinkAttributes, { + attrs: { + class: linkClasses, + }, +})