From d12b5a15fbfe397757f7e4980ae880a750fc2247 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sat, 17 Feb 2024 20:16:00 -0600 Subject: [PATCH] Add eslint workflow action and CONTRIBUTING.md that says to lint first --- .forgejo/workflows/test.yaml | 1 + .github/workflows/test.yml | 1 + .vscode/settings.json | 2 +- CONTRIBUTING.md | 31 +++++++++++++++++++++++++++++++ package.json | 4 +++- src/App.vue | 2 +- src/features/action.tsx | 2 +- src/features/tooltips/tooltip.ts | 2 +- src/features/trees/tree.ts | 2 +- src/game/formulas/operations.ts | 4 ++++ src/game/requirements.tsx | 4 +++- 11 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/.forgejo/workflows/test.yaml b/.forgejo/workflows/test.yaml index 33df8d8..7c48ad6 100644 --- a/.forgejo/workflows/test.yaml +++ b/.forgejo/workflows/test.yaml @@ -19,3 +19,4 @@ jobs: - run: npm ci - run: npm run build --if-present - run: npm test + - run: npm run lint diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c41d085..8d6b548 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,3 +19,4 @@ jobs: - run: npm ci - run: npm run build --if-present - run: npm test + - run: npm run lint diff --git a/.vscode/settings.json b/.vscode/settings.json index d46602a..65fe597 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "vitest.commandLine": "npx vitest", "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "editor.defaultFormatter": "esbenp.prettier-vscode", "git.ignoreLimitWarning": true, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..818ba84 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,31 @@ +# Contributing to Profectus + +Thank you for considering contributing to Profectus! We appreciate your interest in improving our project. Please take a moment to review the following guidelines to streamline the contribution process. + +## Getting Started + +For detailed instructions on setting up local development environment, please refer to the [Setup Guide](https://moddingtree.com/guide/getting-started/setup). + +## Contributing + +Make sure to open your PR on Incremental Social - the GitHub repo is just a mirror! + +### Code Review + +All PRs must be reviewed and approved by at least one of the project maintainers before merging. Please be patient during the review process and be open to feedback. + +### Testing + +Ensure that your changes pass all existing tests and, if applicable, add new tests to cover the changes you've made. Run `npm run test` to run all the tests. + +## Code Style + +We use ESLint and Prettier to enforce consistent code style throughout the project. Before submitting a PR, run `npm run lint:fix` to automatically fix any linting issues. + +## Issue Reporting + +If you encounter a bug or have a suggestion for improvement, please open an issue on Incremental Social. Provide as much detail as possible, including an example repo or steps to reproduce the issue if applicable. + +## License + +By contributing to Profectus, you agree that your contributions will be licensed under the project's [LICENSE](./LICENSE). diff --git a/package.json b/package.json index 3c1c415..f0ce56b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,9 @@ "preview": "vite preview", "test": "vitest run", "testw": "vitest", - "serve": "vite preview --host" + "serve": "vite preview --host", + "lint": "eslint src --max-warnings 0", + "lint:fix": "eslint --fix --max-warnings 0 src" }, "dependencies": { "@fontsource/material-icons": "^4.5.4", diff --git a/src/App.vue b/src/App.vue index 6a365ef..40e21de 100644 --- a/src/App.vue +++ b/src/App.vue @@ -19,7 +19,7 @@ import Error from "components/Error.vue"; import { jsx } from "features/feature"; import state from "game/state"; import { coerceComponent, render } from "util/vue"; -import { CSSProperties, watch } from "vue"; +import { CSSProperties } from "vue"; import { computed, toRef, unref } from "vue"; import Game from "./components/Game.vue"; import GameOverScreen from "./components/GameOverScreen.vue"; diff --git a/src/features/action.tsx b/src/features/action.tsx index 1fbb8d3..2919a9e 100644 --- a/src/features/action.tsx +++ b/src/features/action.tsx @@ -31,7 +31,7 @@ import { coerceComponent, isCoercableComponent, render } from "util/vue"; import { computed, Ref, ref, unref } from "vue"; import { BarOptions, createBar, GenericBar } from "./bars/bar"; import { ClickableOptions } from "./clickables/clickable"; -import { Decorator, GenericDecorator } from "./decorators/common"; +import { GenericDecorator } from "./decorators/common"; /** A symbol used to identify {@link Action} features. */ export const ActionType = Symbol("Action"); diff --git a/src/features/tooltips/tooltip.ts b/src/features/tooltips/tooltip.ts index 54d782c..8d65efd 100644 --- a/src/features/tooltips/tooltip.ts +++ b/src/features/tooltips/tooltip.ts @@ -1,6 +1,6 @@ import type { CoercableComponent, GenericComponent, Replace, StyleValue } from "features/feature"; import { Component, GatherProps, setDefault } from "features/feature"; -import { deletePersistent, Persistent, persistent } from "game/persistence"; +import { persistent } from "game/persistence"; import { Direction } from "util/common"; import type { Computable, diff --git a/src/features/trees/tree.ts b/src/features/trees/tree.ts index 4e43bbf..f47d690 100644 --- a/src/features/trees/tree.ts +++ b/src/features/trees/tree.ts @@ -1,4 +1,4 @@ -import { Decorator, GenericDecorator } from "features/decorators/common"; +import { GenericDecorator } from "features/decorators/common"; import type { CoercableComponent, GenericComponent, diff --git a/src/game/formulas/operations.ts b/src/game/formulas/operations.ts index 586319e..7210cfb 100644 --- a/src/game/formulas/operations.ts +++ b/src/game/formulas/operations.ts @@ -552,7 +552,9 @@ export function tetrate( export function invertTetrate( value: DecimalSource, base: FormulaSource, + // eslint-disable-next-line @typescript-eslint/no-unused-vars height: FormulaSource, + // eslint-disable-next-line @typescript-eslint/no-unused-vars payload: FormulaSource ) { if (hasVariable(base)) { @@ -576,6 +578,7 @@ export function invertIteratedExp( value: DecimalSource, lhs: FormulaSource, height: FormulaSource, + // eslint-disable-next-line @typescript-eslint/no-unused-vars payload: FormulaSource ) { if (hasVariable(lhs)) { @@ -626,6 +629,7 @@ export function invertLayeradd( value: DecimalSource, lhs: FormulaSource, diff: FormulaSource, + // eslint-disable-next-line @typescript-eslint/no-unused-vars base: FormulaSource ) { if (hasVariable(lhs)) { diff --git a/src/game/requirements.tsx b/src/game/requirements.tsx index ea82a64..363fccd 100644 --- a/src/game/requirements.tsx +++ b/src/game/requirements.tsx @@ -222,7 +222,9 @@ export function createCostRequirement( Decimal.gte( req.resource.value, unref(req.cost as ProcessedComputable) - ) ? 1 : 0 + ) + ? 1 + : 0 ); }