Update eslint and prettier
All checks were successful
Run Tests / test (pull_request) Successful in 2m39s
All checks were successful
Run Tests / test (pull_request) Successful in 2m39s
This commit is contained in:
parent
47d17730e0
commit
fcbb5ea783
20 changed files with 407 additions and 427 deletions
1
.eslintignore
Normal file
1
.eslintignore
Normal file
|
@ -0,0 +1 @@
|
|||
.eslintrc.cjs
|
|
@ -5,6 +5,11 @@ module.exports = {
|
|||
env: {
|
||||
node: true
|
||||
},
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ["@typescript-eslint"],
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.ts', '*.tsx'],
|
||||
extends: [
|
||||
"plugin:vue/vue3-essential",
|
||||
"@vue/eslint-config-typescript/recommended",
|
||||
|
@ -12,8 +17,10 @@ module.exports = {
|
|||
],
|
||||
parserOptions: {
|
||||
ecmaVersion: 2020,
|
||||
project: "tsconfig.json"
|
||||
project: "./tsconfig.json"
|
||||
},
|
||||
}
|
||||
],
|
||||
ignorePatterns: ["src/lib"],
|
||||
rules: {
|
||||
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
|
||||
|
|
672
package-lock.json
generated
672
package-lock.json
generated
File diff suppressed because it is too large
Load diff
11
package.json
11
package.json
|
@ -43,13 +43,14 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@ivanv/vue-collapse-transition": "^1.0.2",
|
||||
"@rushstack/eslint-patch": "^1.1.0",
|
||||
"@rushstack/eslint-patch": "^1.7.2",
|
||||
"@types/lz-string": "^1.5.0",
|
||||
"@vue/eslint-config-prettier": "^7.0.0",
|
||||
"@vue/eslint-config-typescript": "^10.0.0",
|
||||
"eslint": "^8.6.0",
|
||||
"@typescript-eslint/parser": "^7.2.0",
|
||||
"@vue/eslint-config-prettier": "^9.0.0",
|
||||
"@vue/eslint-config-typescript": "^13.0.0",
|
||||
"eslint": "^8.57.0",
|
||||
"jsdom": "^24.0.0",
|
||||
"prettier": "^2.5.1",
|
||||
"prettier": "^3.2.5",
|
||||
"typescript": "^5.4.2",
|
||||
"vitest": "^1.4.0",
|
||||
"vue-tsc": "^2.0.6"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
"title": "Profectus",
|
||||
"description": "A project made in Profectus",
|
||||
"id": "",
|
||||
"id": "321",
|
||||
"author": "",
|
||||
"discordName": "",
|
||||
"discordLink": "",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { computed } from "@vue/reactivity";
|
||||
import { isArray } from "@vue/shared";
|
||||
import { computed } from "vue";
|
||||
import Select from "components/fields/Select.vue";
|
||||
import AchievementComponent from "features/achievements/Achievement.vue";
|
||||
import { GenericDecorator } from "features/decorators/common";
|
||||
|
@ -275,7 +274,7 @@ export function createAchievement<T extends AchievementOptions>(
|
|||
const requirements = [
|
||||
createVisibilityRequirement(genericAchievement),
|
||||
createBooleanRequirement(() => !genericAchievement.earned.value),
|
||||
...(isArray(achievement.requirements)
|
||||
...(Array.isArray(achievement.requirements)
|
||||
? achievement.requirements
|
||||
: [achievement.requirements])
|
||||
];
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { isArray } from "@vue/shared";
|
||||
import ClickableComponent from "features/clickables/Clickable.vue";
|
||||
import {
|
||||
Component,
|
||||
|
@ -157,7 +156,7 @@ export function createAction<T extends ActionOptions>(
|
|||
}
|
||||
];
|
||||
const originalStyle = unref(style);
|
||||
if (isArray(originalStyle)) {
|
||||
if (Array.isArray(originalStyle)) {
|
||||
currStyle.push(...originalStyle);
|
||||
} else if (originalStyle != null) {
|
||||
currStyle.push(originalStyle);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { isArray } from "@vue/shared";
|
||||
import Toggle from "components/fields/Toggle.vue";
|
||||
import ChallengeComponent from "features/challenges/Challenge.vue";
|
||||
import { GenericDecorator } from "features/decorators/common";
|
||||
|
@ -348,7 +347,7 @@ export function createActiveChallenge(
|
|||
export function isAnyChallengeActive(
|
||||
challenges: GenericChallenge[] | Ref<GenericChallenge | null>
|
||||
): Ref<boolean> {
|
||||
if (isArray(challenges)) {
|
||||
if (Array.isArray(challenges)) {
|
||||
challenges = createActiveChallenge(challenges);
|
||||
}
|
||||
return computed(() => (challenges as Ref<GenericChallenge | null>).value != null);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { isArray } from "@vue/shared";
|
||||
import ClickableComponent from "features/clickables/Clickable.vue";
|
||||
import type {
|
||||
CoercableComponent,
|
||||
|
@ -162,7 +161,7 @@ export function createRepeatable<T extends RepeatableOptions>(
|
|||
canMaximize: true
|
||||
} as const;
|
||||
const visibilityRequirement = createVisibilityRequirement(repeatable as GenericRepeatable);
|
||||
if (isArray(repeatable.requirements)) {
|
||||
if (Array.isArray(repeatable.requirements)) {
|
||||
repeatable.requirements.unshift(visibilityRequirement);
|
||||
repeatable.requirements.push(limitRequirement);
|
||||
} else {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { isArray } from "@vue/shared";
|
||||
import { GenericDecorator } from "features/decorators/common";
|
||||
import type {
|
||||
CoercableComponent,
|
||||
|
@ -151,7 +150,7 @@ export function createUpgrade<T extends UpgradeOptions>(
|
|||
};
|
||||
|
||||
const visibilityRequirement = createVisibilityRequirement(upgrade as GenericUpgrade);
|
||||
if (isArray(upgrade.requirements)) {
|
||||
if (Array.isArray(upgrade.requirements)) {
|
||||
upgrade.requirements.unshift(visibilityRequirement);
|
||||
} else {
|
||||
upgrade.requirements = [visibilityRequirement, upgrade.requirements];
|
||||
|
|
|
@ -48,6 +48,7 @@ export interface InternalFormula<T extends [FormulaSource] | FormulaSource[]> {
|
|||
invertIntegral?(value: DecimalSource): DecimalSource;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
||||
export abstract class InternalFormula<T extends [FormulaSource] | FormulaSource[]> {
|
||||
readonly inputs: T;
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { isArray } from "@vue/shared";
|
||||
import { globalBus } from "game/events";
|
||||
import type { GenericLayer } from "game/layers";
|
||||
import { addingLayers, persistentRefs } from "game/layers";
|
||||
|
@ -339,7 +338,7 @@ globalBus.on("addLayer", (layer: GenericLayer, saveData: Record<string, unknown>
|
|||
// Show warning for persistent values inside arrays
|
||||
// TODO handle arrays better
|
||||
if (foundPersistentInChild) {
|
||||
if (isArray(value) && !isArray(obj)) {
|
||||
if (Array.isArray(value) && !Array.isArray(obj)) {
|
||||
console.warn(
|
||||
"Found array that contains persistent values when adding layer. Keep in mind changing the order of elements in the array will mess with existing player saves.",
|
||||
ProxyState in obj
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { isArray } from "@vue/shared";
|
||||
import {
|
||||
CoercableComponent,
|
||||
isVisible,
|
||||
|
@ -270,7 +269,7 @@ export function createBooleanRequirement(
|
|||
* @param requirements The 1+ requirements to check
|
||||
*/
|
||||
export function requirementsMet(requirements: Requirements): boolean {
|
||||
if (isArray(requirements)) {
|
||||
if (Array.isArray(requirements)) {
|
||||
return requirements.every(requirementsMet);
|
||||
}
|
||||
const reqsMet = unref(requirements.requirementMet);
|
||||
|
@ -282,7 +281,7 @@ export function requirementsMet(requirements: Requirements): boolean {
|
|||
* @param requirements The 1+ requirements to check
|
||||
*/
|
||||
export function maxRequirementsMet(requirements: Requirements): DecimalSource {
|
||||
if (isArray(requirements)) {
|
||||
if (Array.isArray(requirements)) {
|
||||
return requirements.map(maxRequirementsMet).reduce(Decimal.min);
|
||||
}
|
||||
const reqsMet = unref(requirements.requirementMet);
|
||||
|
@ -300,13 +299,13 @@ export function maxRequirementsMet(requirements: Requirements): DecimalSource {
|
|||
* @param amount The amount of levels earned to be displayed
|
||||
*/
|
||||
export function displayRequirements(requirements: Requirements, amount: DecimalSource = 1) {
|
||||
if (isArray(requirements)) {
|
||||
if (Array.isArray(requirements)) {
|
||||
requirements = requirements.filter(r => isVisible(r.visibility));
|
||||
if (requirements.length === 1) {
|
||||
requirements = requirements[0];
|
||||
}
|
||||
}
|
||||
if (isArray(requirements)) {
|
||||
if (Array.isArray(requirements)) {
|
||||
requirements = requirements.filter(r => "partialDisplay" in r);
|
||||
const withCosts = requirements.filter(r => unref(r.requiresPay));
|
||||
const withoutCosts = requirements.filter(r => !unref(r.requiresPay));
|
||||
|
@ -344,7 +343,7 @@ export function displayRequirements(requirements: Requirements, amount: DecimalS
|
|||
* @param amount How many levels to pay for
|
||||
*/
|
||||
export function payRequirements(requirements: Requirements, amount: DecimalSource = 1) {
|
||||
if (isArray(requirements)) {
|
||||
if (Array.isArray(requirements)) {
|
||||
requirements.filter(r => unref(r.requiresPay)).forEach(r => r.pay?.(amount));
|
||||
} else if (unref(requirements.requiresPay)) {
|
||||
requirements.pay?.(amount);
|
||||
|
|
|
@ -8,9 +8,8 @@ export type OptionalKeys<T> = {
|
|||
export type OmitOptional<T> = Pick<T, RequiredKeys<T>>;
|
||||
export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
|
||||
|
||||
export type ArrayElements<T extends ReadonlyArray<unknown>> = T extends ReadonlyArray<infer S>
|
||||
? S
|
||||
: never;
|
||||
export type ArrayElements<T extends ReadonlyArray<unknown>> =
|
||||
T extends ReadonlyArray<infer S> ? S : never;
|
||||
|
||||
// Reference:
|
||||
// https://stackoverflow.com/questions/7225407/convert-camelcasetext-to-sentence-case-text
|
||||
|
@ -36,5 +35,6 @@ export enum Direction {
|
|||
Down = "Down",
|
||||
Left = "Left",
|
||||
Right = "Right",
|
||||
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
||||
Default = "Up"
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@ import Decimal from "util/bignum";
|
|||
export const ProxyState = Symbol("ProxyState");
|
||||
export const ProxyPath = Symbol("ProxyPath");
|
||||
|
||||
export type ProxiedWithState<T> = NonNullable<T> extends Record<PropertyKey, unknown>
|
||||
export type ProxiedWithState<T> =
|
||||
NonNullable<T> extends Record<PropertyKey, unknown>
|
||||
? NonNullable<T> extends Decimal
|
||||
? T
|
||||
: {
|
||||
|
@ -16,7 +17,8 @@ export type ProxiedWithState<T> = NonNullable<T> extends Record<PropertyKey, unk
|
|||
}
|
||||
: T;
|
||||
|
||||
export type Proxied<T> = NonNullable<T> extends Record<PropertyKey, unknown>
|
||||
export type Proxied<T> =
|
||||
NonNullable<T> extends Record<PropertyKey, unknown>
|
||||
? NonNullable<T> extends Persistent<infer S>
|
||||
? NonPersistent<S>
|
||||
: NonNullable<T> extends Decimal
|
||||
|
|
|
@ -245,8 +245,11 @@ export function trackHover(element: VueFeature): Ref<boolean> {
|
|||
}
|
||||
|
||||
export function kebabifyObject(object: Record<string, unknown>) {
|
||||
return Object.keys(object).reduce((acc, curr) => {
|
||||
return Object.keys(object).reduce(
|
||||
(acc, curr) => {
|
||||
acc[camelToKebab(curr)] = object[curr];
|
||||
return acc;
|
||||
}, {} as Record<string, unknown>);
|
||||
},
|
||||
{} as Record<string, unknown>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue