Skip to content

Commit

Permalink
Update linter
Browse files Browse the repository at this point in the history
  • Loading branch information
neki-dev committed Feb 17, 2024
1 parent e3b3792 commit 5e2efde
Show file tree
Hide file tree
Showing 22 changed files with 211 additions and 210 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line no-undef
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
Expand All @@ -18,6 +19,7 @@ module.exports = {
"eol-last": ["error", "always"],
"no-trailing-spaces": "error",
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"indent": ["error", 2],
// TypeScript
"@typescript-eslint/semi": "error",
"@typescript-eslint/consistent-type-imports": "error",
Expand Down Expand Up @@ -47,5 +49,4 @@ module.exports = {
},
],
},
ignorePatterns: ["**/*.js"],
};
6 changes: 3 additions & 3 deletions src/game/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ export class Game extends Phaser.Game implements IGame {

public getDifficultyMultiplier() {
switch (this.difficulty) {
case GameDifficulty.EASY: return 0.8;
case GameDifficulty.HARD: return 1.4;
default: return 1.0;
case GameDifficulty.EASY: return 0.8;
case GameDifficulty.HARD: return 1.4;
default: return 1.0;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/scenes/gameover/interface/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const GameoverUI: React.FC<Props> = ({ stat, record }) => {
<Wrapper>
<Head>
<Label>GAME OVER</Label>
<Result stat={stat} record={record} />
<Result stat={stat} record={record} />
<Button ref={refButton}>
<IconRestart src='assets/sprites/hud/restart.png' />
{phrase('RESTART_GAME')}
Expand Down
2 changes: 1 addition & 1 deletion src/game/scenes/menu/interface/content/load-game/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const LoadGame: React.FC = () => {
const [confirmation, setConfirmation] = useState<Nullable<{
message: LangPhrase
onConfirm:() => void
}>>(null);
}>>(null);

const onClickStart = () => {
game.continueGame(selectedSave);
Expand Down
2 changes: 1 addition & 1 deletion src/game/scenes/menu/interface/content/save-game/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const SaveGame: React.FC = () => {
const [confirmation, setConfirmation] = useState<Nullable<{
message: LangPhrase
onConfirm:() => void
}>>(null);
}>>(null);

const refInput = useRef<HTMLInputElement>();

Expand Down
2 changes: 1 addition & 1 deletion src/game/scenes/menu/interface/navigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const Navigation: React.FC<Props> = ({ page, onSelect }) => {
const [confirmation, setConfirmation] = useState<Nullable<{
message: LangPhrase
onConfirm:() => void
}>>(null);
}>>(null);

const menuItems = useMemo(() => {
const items: (MenuItem | null)[] = [];
Expand Down
74 changes: 37 additions & 37 deletions src/game/scenes/screen/interface/builder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,48 +41,48 @@ export const Builder: React.FC = () => {

const showHint = (step: TutorialStep) => {
switch (step) {
case TutorialStep.BUILD_GENERATOR: {
return setHintBuilding({
variant: BuildingVariant.GENERATOR,
label: 'TUTORIAL_BUILD_GENERATOR',
});
}
case TutorialStep.BUILD_GENERATOR_SECOND: {
return setHintBuilding({
variant: BuildingVariant.GENERATOR,
label: 'TUTORIAL_BUILD_GENERATOR_SECOND',
});
}
case TutorialStep.BUILD_RADAR: {
return setHintBuilding({
variant: BuildingVariant.RADAR,
label: 'TUTORIAL_BUILD_RADAR',
});
}
case TutorialStep.BUILD_TOWER_FIRE: {
return setHintBuilding({
variant: BuildingVariant.TOWER_FIRE,
label: 'TUTORIAL_BUILD_TOWER_FIRE',
});
}
case TutorialStep.BUILD_AMMUNITION: {
return setHintBuilding({
variant: BuildingVariant.AMMUNITION,
label: 'TUTORIAL_BUILD_AMMUNITION',
});
}
case TutorialStep.BUILD_GENERATOR: {
return setHintBuilding({
variant: BuildingVariant.GENERATOR,
label: 'TUTORIAL_BUILD_GENERATOR',
});
}
case TutorialStep.BUILD_GENERATOR_SECOND: {
return setHintBuilding({
variant: BuildingVariant.GENERATOR,
label: 'TUTORIAL_BUILD_GENERATOR_SECOND',
});
}
case TutorialStep.BUILD_RADAR: {
return setHintBuilding({
variant: BuildingVariant.RADAR,
label: 'TUTORIAL_BUILD_RADAR',
});
}
case TutorialStep.BUILD_TOWER_FIRE: {
return setHintBuilding({
variant: BuildingVariant.TOWER_FIRE,
label: 'TUTORIAL_BUILD_TOWER_FIRE',
});
}
case TutorialStep.BUILD_AMMUNITION: {
return setHintBuilding({
variant: BuildingVariant.AMMUNITION,
label: 'TUTORIAL_BUILD_AMMUNITION',
});
}
}
};

const hideHint = (step: TutorialStep) => {
switch (step) {
case TutorialStep.BUILD_GENERATOR:
case TutorialStep.BUILD_GENERATOR_SECOND:
case TutorialStep.BUILD_RADAR:
case TutorialStep.BUILD_TOWER_FIRE:
case TutorialStep.BUILD_AMMUNITION: {
return setHintBuilding(null);
}
case TutorialStep.BUILD_GENERATOR:
case TutorialStep.BUILD_GENERATOR_SECOND:
case TutorialStep.BUILD_RADAR:
case TutorialStep.BUILD_TOWER_FIRE:
case TutorialStep.BUILD_AMMUNITION: {
return setHintBuilding(null);
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/game/scenes/screen/interface/skills/modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ export const Modal: React.FC<Props> = ({ onClose }) => {
</Groups>
</Container>
</Overlay>
</>
</>
);
};
24 changes: 12 additions & 12 deletions src/game/scenes/screen/interface/skills/modal/item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ export const Item: React.FC<Props> = ({ type }) => {
return (
<Container ref={refContainer} $active={data.currentLevel < PLAYER_MAX_SKILL_LEVEL }>
<Info>
<Icon>
<Texture name={PlayerSkillIcon[data.type]} />
</Icon>
<Head>
<Icon>
<Texture name={PlayerSkillIcon[data.type]} />
</Icon>
<Head>
<Label>{phrase(`SKILL_LABEL_${data.type}`)}</Label>
<Level>
{levels.map((_, level) => (
<Level.Progress
key={level}
$active={data.currentLevel && level < data.currentLevel}
/>
))}
</Level>
<Level>
{levels.map((_, level) => (
<Level.Progress
key={level}
$active={data.currentLevel && level < data.currentLevel}
/>
))}
</Level>
</Head>
</Info>
<Action>
Expand Down
6 changes: 3 additions & 3 deletions src/game/scenes/screen/interface/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export const Column = styled.div<{
position: relative;
${(props) => {
switch (props.$side) {
case 'left': return css`
case 'left': return css`
justify-self: start;
align-items: flex-start;
`;
case 'center': return css`
case 'center': return css`
justify-self: center;
align-items: center;
`;
case 'right': return css`
case 'right': return css`
justify-self: end;
align-items: flex-end;
`;
Expand Down
18 changes: 9 additions & 9 deletions src/game/scenes/screen/interface/unlocks/modal/item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@ import { PlayerSuperskillIcon } from '~scene/world/entities/player/types';
export const Item: React.FC<Feature> = ({ type, item }) => {
const name = useMemo(() => {
switch (type) {
case 'BUILDING': return phrase(`BUILDING_NAME_${item as BuildingVariant}`);
case 'SUPERSKILL': return phrase(`SUPERSKILL_NAME_${item as PlayerSuperskill}`);
case 'ASSISTANT': return item;
case 'BUILDING': return phrase(`BUILDING_NAME_${item as BuildingVariant}`);
case 'SUPERSKILL': return phrase(`SUPERSKILL_NAME_${item as PlayerSuperskill}`);
case 'ASSISTANT': return item;
}
}, [type, item]);

const description = useMemo<LangPhrase>(() => {
switch (type) {
case 'BUILDING': return `BUILDING_DESCRIPTION_${item as BuildingVariant}`;
case 'SUPERSKILL': return `SUPERSKILL_DESCRIPTION_${item as PlayerSuperskill}`;
case 'ASSISTANT': return 'ASSISTANT_UNLOCK';
case 'BUILDING': return `BUILDING_DESCRIPTION_${item as BuildingVariant}`;
case 'SUPERSKILL': return `SUPERSKILL_DESCRIPTION_${item as PlayerSuperskill}`;
case 'ASSISTANT': return 'ASSISTANT_UNLOCK';
}
}, [type, item]);

const icon = useMemo(() => {
switch (type) {
case 'BUILDING': return BuildingTexture[item as BuildingVariant];
case 'SUPERSKILL': return PlayerSuperskillIcon[item as PlayerSuperskill];
case 'ASSISTANT': return AssistantTexture[item as AssistantVariant];
case 'BUILDING': return BuildingTexture[item as BuildingVariant];
case 'SUPERSKILL': return PlayerSuperskillIcon[item as PlayerSuperskill];
case 'ASSISTANT': return AssistantTexture[item as AssistantVariant];
}
}, [type, item]);

Expand Down
6 changes: 3 additions & 3 deletions src/game/scenes/screen/interface/unlocks/modal/item/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,21 @@ export const IconContainer = styled.div<{
overflow: hidden;
${(props) => {
switch (props.$type) {
case 'BUILDING': return css`
case 'BUILDING': return css`
width: 68px;
height: 80px;
[role=texture] {
height: 100%;
}
`;
case 'SUPERSKILL': return css`
case 'SUPERSKILL': return css`
width: 64px;
height: 64px;
[role=texture] {
width: 100%;
}
`;
case 'ASSISTANT': return css`
case 'ASSISTANT': return css`
width: 48px;
height: 80px;
[role=texture] {
Expand Down
24 changes: 12 additions & 12 deletions src/game/scenes/system/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ export class System extends Scene {
}

switch (this.game.state) {
case GameState.FINISHED: {
this.game.stopGame();
break;
}
case GameState.PAUSED: {
this.game.resumeGame();
break;
}
case GameState.STARTED: {
this.game.pauseGame();
break;
}
case GameState.FINISHED: {
this.game.stopGame();
break;
}
case GameState.PAUSED: {
this.game.resumeGame();
break;
}
case GameState.STARTED: {
this.game.pauseGame();
break;
}
}
});
}
Expand Down
14 changes: 7 additions & 7 deletions src/game/scenes/system/interface/button/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ export const Container = styled.div<{
align-items: center;
${(props) => {
switch (props.$view) {
case 'primary': return css`
case 'primary': return css`
background: ${InterfaceBackgroundColor.WARN_GRADIENT};
&:hover {
background: ${InterfaceBackgroundColor.WARN};
}
`;
case 'confirm': return css`
case 'confirm': return css`
background: ${InterfaceBackgroundColor.SUCCESS_GRADIENT};
&:hover {
background: ${InterfaceBackgroundColor.SUCCESS};
}
`;
case 'decline': return css`
case 'decline': return css`
background: ${InterfaceBackgroundColor.ERROR_GRADIENT};
&:hover {
background: ${InterfaceBackgroundColor.ERROR};
}
`;
default: return css`
default: return css`
background: ${InterfaceBackgroundColor.BLACK};
&:hover {
background: ${InterfaceBackgroundColor.SUCCESS_GRADIENT};
Expand All @@ -45,17 +45,17 @@ export const Container = styled.div<{
}}
${(props) => {
switch (props.$size) {
case 'large': return css`
case 'large': return css`
font-size: 17px;
line-height: 17px;
padding: 11px 18px 14px 18px;
`;
case 'small': return css`
case 'small': return css`
font-size: 13px;
line-height: 13px;
padding: 9px 14px 12px 14px;
`;
default: return css`
default: return css`
font-size: 10px;
line-height: 10px;
padding: 6px 0 7px 0;
Expand Down
8 changes: 4 additions & 4 deletions src/game/scenes/system/interface/hint/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const Positioner = styled.div<{
position: absolute;
${(props) => {
switch (props.$side) {
case 'left': return css`
case 'left': return css`
padding-left: 10px;
transform: translate(0, -50%);
${Container} {
Expand All @@ -93,7 +93,7 @@ export const Positioner = styled.div<{
}
}
`;
case 'right': return css`
case 'right': return css`
padding-right: 10px;
transform: translate(-100%, -50%);
${Container} {
Expand All @@ -108,7 +108,7 @@ export const Positioner = styled.div<{
}
}
`;
case 'top': return css`
case 'top': return css`
padding-top: 10px;
transform: ${align[`top-${props.$align}`].transform};
${Container} {
Expand All @@ -124,7 +124,7 @@ export const Positioner = styled.div<{
}
}
`;
case 'bottom': return css`
case 'bottom': return css`
padding-bottom: 10px;
transform: ${align[`bottom-${props.$align}`].transform};
${Container} {
Expand Down
Loading

0 comments on commit 5e2efde

Please sign in to comment.