Update README and package, re-add money formatter (#1286)

This commit is contained in:
Matthew 2024-05-23 12:29:18 -04:00 committed by GitHub
parent bac6c22973
commit f7a7b23dd1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 4414 additions and 1750 deletions

3
.gitignore vendored
View File

@ -24,9 +24,6 @@ dist-ssr
*.sln
*.sw?
# Docummentation
docs/*
public/images/trainer/convert/*
public/images/battle_anims/input/*.png
public/images/pokemon/input/*.png

View File

@ -8,7 +8,7 @@ If you have the motivation and experience with Typescript/Javascript (or are wil
### 💻 Environment Setup
#### Prerequisites
- node: 18.3.0
- node: 20.13.1
- npm: [how to install](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
#### Running Locally
@ -16,6 +16,9 @@ If you have the motivation and experience with Typescript/Javascript (or are wil
- *if you run into any errors, reach out in the **#dev-corner** channel in discord*
2. Run `npm run start:dev` to locally run the project in `localhost:8000`
#### Linting
We're using ESLint as our common linter and formatter. It will run automatically during the pre-commit hook but if you would like to manually run it, use the `npm run eslint` script.
### ❔ FAQ
**How do I test a new _______?**

40
docs/linting.md Normal file
View File

@ -0,0 +1,40 @@
# ESLint
## Key Features
1. **Automation**:
- A pre-commit hook has been added to automatically run ESLint on the added or modified files, ensuring code quality before commits.
2. **Manual Usage**:
- If you prefer not to use the pre-commit hook, you can manually run ESLint to automatically fix issues using the command:
```sh
npx eslint --fix . or npm run eslint
```
- Running this command will lint all files in the repository.
3. **GitHub Action**:
- A GitHub Action has been added to automatically run ESLint on every push and pull request, ensuring code quality in the CI/CD pipeline.
## Summary of ESLint Rules
1. **General Rules**:
- **Equality**: Use `===` and `!==` instead of `==` and `!=` (`eqeqeq`).
- **Indentation**: Enforce 2-space indentation (`indent`).
- **Quotes**: Use doublequotes for strings (`quotes`).
- **Variable Declarations**:
- Disallow `var`; use `let` or `const` (`no-var`).
- Prefer `const` for variables that are never reassigned (`prefer-const`).
- **Unused Variables**: Allow unused function parameters but enforce error for other unused variables (`@typescript-eslint/no-unused-vars`).
- **End of Line**: Ensure at least one newline at the end of files (`eol-last`).
- **Curly Braces**: Enforce the use of curly braces for all control statements (`curly`).
- **Brace Style**: Use one true brace style (`1tbs`) for TypeScript-specific syntax (`@typescript-eslint/brace-style`).
2. **TypeScript-Specific Rules**:
- **Semicolons**:
- Enforce semicolons for TypeScript-specific syntax (`@typescript-eslint/semi`).
- Disallow unnecessary semicolons (`@typescript-eslint/no-extra-semi`).
## Benefits
- **Consistency**: Ensures consistent coding style across the project.
- **Code Quality**: Helps catch potential errors and improve overall code quality.
- **Readability**: Makes the codebase easier to read and maintain.

6111
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@
"phaser3-rex-plugins": "^1.1.84"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.0.0"
},
"imports": {
"#app": "./src/main.js",

View File

@ -1251,7 +1251,7 @@ export default class BattleScene extends SceneBase {
}
updateMoneyText(): void {
this.moneyText.setText(`${this.money.toLocaleString("en-US")}`);
this.moneyText.setText(`${Utils.formatLargeNumber(this.money, 1000)}`);
this.moneyText.setVisible(true);
}

View File

@ -1084,6 +1084,7 @@ export class GameData {
if (!valid) {
return this.scene.ui.showText(`Your ${dataName} data could not be loaded. It may be corrupted.`, null, () => this.scene.ui.showText(null, 0), Utils.fixedInt(1500));
}
this.scene.ui.revertMode();
this.scene.ui.showText(`Your ${dataName} data will be overridden and the page will reload. Proceed?`, null, () => {
this.scene.ui.setOverlayMode(Mode.CONFIRM, () => {
localStorage.setItem(dataKey, encrypt(dataStr, bypassLogin));