Add eslint workflow action and CONTRIBUTING.md that says to lint first

This commit is contained in:
thepaperpilot 2024-02-17 20:16:00 -06:00
parent 68e6e3f37a
commit d12b5a15fb
11 changed files with 48 additions and 7 deletions

View file

@ -19,3 +19,4 @@ jobs:
- run: npm ci
- run: npm run build --if-present
- run: npm test
- run: npm run lint

View file

@ -19,3 +19,4 @@ jobs:
- run: npm ci
- run: npm run build --if-present
- run: npm test
- run: npm run lint

View file

@ -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,

31
CONTRIBUTING.md Normal file
View file

@ -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).

View file

@ -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",

View file

@ -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";

View file

@ -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");

View file

@ -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,

View file

@ -1,4 +1,4 @@
import { Decorator, GenericDecorator } from "features/decorators/common";
import { GenericDecorator } from "features/decorators/common";
import type {
CoercableComponent,
GenericComponent,

View file

@ -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)) {

View file

@ -222,7 +222,9 @@ export function createCostRequirement<T extends CostRequirementOptions>(
Decimal.gte(
req.resource.value,
unref(req.cost as ProcessedComputable<DecimalSource>)
) ? 1 : 0
)
? 1
: 0
);
}