Skip to content

Commit

Permalink
Patch
Browse files Browse the repository at this point in the history
+ Fixed issues under ts `strict` mode
+ Upgraded astro to latest
+ added eslint.config.js
  • Loading branch information
tsavpyn committed Jul 7, 2024
1 parent 4d66deb commit c922e1f
Show file tree
Hide file tree
Showing 8 changed files with 1,155 additions and 53 deletions.
13 changes: 13 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import eslintPluginAstro from 'eslint-plugin-astro';

export default [
// add more generic rule sets here, such as:
// js.configs.recommended,
...eslintPluginAstro.configs.recommended,
{
rules: {
// override/add rules settings here, such as:
// "astro/no-set-html-directive": "error"
},
},
];
1,164 changes: 1,127 additions & 37 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
"dependencies": {
"@astrojs/check": "^0.7.0",
"@astrojs/react": "^3.6.0",
"@astrojs/starlight": "^0.24.4",
"@astrojs/starlight": "^0.25.0",
"@astrojs/vue": "^4.5.0",
"astro": "^4.11.3",
"astro": "^4.11.5",
"sharp": "^0.32.5",
"typescript": "^5.4.5"
},
"devDependencies": {
"eslint": "^9.6.0",
"eslint-plugin-astro": "^1.2.2",
"prettier": "^3.3.2",
"prettier-plugin-astro": "^0.14.0",
"ts-node": "^10.9.2"
Expand Down
13 changes: 4 additions & 9 deletions src/components/Communities.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,20 @@ import {Community} from '../data/LyricifyCustomTypes';
interface Props {
communities: Array<Community>;
}
const wordIsFullMap = Labels['label.communityIsFull'];
const {communities} = Astro.props;
const locale = Astro.currentLocale ?? 'en';
---

<ul>
{
communities.map((item) => {
if (!(item.name instanceof Object)) {
throw new Error('String is not localizable');
}

const communityName =
item.name instanceof Object
? item.name[Astro.currentLocale]
: item.name;
item.name instanceof Object ? item.name[locale] : item.name;
const communityHasUrl = !!item.url;
const communityIsFull = !!item.isFull;
const wordIsFull = wordIsFullMap[Astro.currentLocale];
const wordIsFull = Labels['label.communityIsFull'][locale];
const communityValue = item.value;

const tmplWithUrl = (
Expand Down
1 change: 1 addition & 0 deletions src/components/StoreButton.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
// @ts-nocheck
import {Labels} from '@data/DataHelper';
interface Props {
Expand Down
4 changes: 2 additions & 2 deletions src/data/DataHelper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import data from '@data/Data.json';
import labels from '@data/Labels.json';

export const Data: object = data;
export const Labels: object = labels;
export const Data: any = data;
export const Labels: any = labels;
6 changes: 3 additions & 3 deletions src/data/LyricifyCustomTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ export type translatable = Record<string, any> | string;
export class Community {
name: translatable;
value: string;
url: string | null = null;
isFull: boolean = false;
url?: string;
isFull?: boolean;

constructor({
name,
value,
url = null,
url = void 0,
isFull = false,
}: {
name: translatable;
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"strict": true,
"baseUrl": ".",
"paths": {
"@components/*": ["src/components/*"],
Expand Down

0 comments on commit c922e1f

Please sign in to comment.