mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
Add eslint and run linter in workflow (#1819)
Some checks are pending
Project CI / build (24.x) (push) Waiting to run
Some checks are pending
Project CI / build (24.x) (push) Waiting to run
This commit is contained in:
parent
f850cbda76
commit
3cbc18f42b
23 changed files with 974 additions and 36 deletions
|
|
@ -173,7 +173,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
// Overriden to only disable text inputs by default.
|
||||
// Everything else is done by checking @root.editable in the sheet
|
||||
const form = this.form;
|
||||
for (const input of form.querySelectorAll("input:not([type=search]), .editor.prosemirror")) {
|
||||
for (const input of form.querySelectorAll('input:not([type=search]), .editor.prosemirror')) {
|
||||
input.disabled = disabled;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -488,11 +488,10 @@ export default function DHApplicationMixin(Base) {
|
|||
icon: 'fa-solid fa-explosion',
|
||||
visible: target => {
|
||||
const doc = getDocFromElementSync(target);
|
||||
return (
|
||||
doc?.isOwner &&
|
||||
const hasDamage =
|
||||
!foundry.utils.isEmpty(doc?.system?.attack?.damage.parts) ||
|
||||
!foundry.utils.isEmpty(doc?.damage?.parts)
|
||||
);
|
||||
!foundry.utils.isEmpty(doc?.damage?.parts);
|
||||
return doc?.isOwner && hasDamage;
|
||||
},
|
||||
callback: async (target, event) => {
|
||||
const doc = await getDocFromElement(target),
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export default class FeatureSheet extends DHBaseItemSheet {
|
|||
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
|
||||
}
|
||||
};
|
||||
//Might be wrong location but testing out if here is okay.
|
||||
//Might be wrong location but testing out if here is okay.
|
||||
/**@override */
|
||||
async _prepareContext(options) {
|
||||
const context = await super._prepareContext(options);
|
||||
|
|
|
|||
|
|
@ -75,12 +75,17 @@ export const typeConfig = {
|
|||
{
|
||||
key: 'type',
|
||||
label: 'DAGGERHEART.GENERAL.type',
|
||||
format: type => type ? `TYPES.Item.${type}` : '-'
|
||||
format: type => (type ? `TYPES.Item.${type}` : '-')
|
||||
},
|
||||
{
|
||||
key: 'system.secondary',
|
||||
label: 'DAGGERHEART.UI.ItemBrowser.subtype',
|
||||
format: isSecondary => (isSecondary ? 'DAGGERHEART.ITEMS.Weapon.secondaryWeapon.short' : isSecondary === false ? 'DAGGERHEART.ITEMS.Weapon.primaryWeapon.short' : '-')
|
||||
format: isSecondary =>
|
||||
isSecondary
|
||||
? 'DAGGERHEART.ITEMS.Weapon.secondaryWeapon.short'
|
||||
: isSecondary === false
|
||||
? 'DAGGERHEART.ITEMS.Weapon.primaryWeapon.short'
|
||||
: '-'
|
||||
},
|
||||
{
|
||||
key: 'system.tier',
|
||||
|
|
@ -260,12 +265,12 @@ export const typeConfig = {
|
|||
{
|
||||
key: 'system.type',
|
||||
label: 'DAGGERHEART.GENERAL.type',
|
||||
format: type => type ? `DAGGERHEART.CONFIG.DomainCardTypes.${type}` : '-'
|
||||
format: type => (type ? `DAGGERHEART.CONFIG.DomainCardTypes.${type}` : '-')
|
||||
},
|
||||
{
|
||||
key: 'system.domain',
|
||||
label: 'DAGGERHEART.GENERAL.Domain.single',
|
||||
format: domain => domain ? CONFIG.DH.DOMAIN.allDomains()[domain].label : '-'
|
||||
format: domain => (domain ? CONFIG.DH.DOMAIN.allDomains()[domain].label : '-')
|
||||
},
|
||||
{
|
||||
key: 'system.level',
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ export const gameSettings = {
|
|||
SpotlightRequestQueue: 'SpotlightRequestQueue',
|
||||
CompendiumBrowserSettings: 'CompendiumBrowserSettings',
|
||||
SpotlightTracker: 'SpotlightTracker',
|
||||
ActiveParty: 'ActiveParty',
|
||||
ActiveParty: 'ActiveParty'
|
||||
};
|
||||
|
||||
export const actionAutomationChoices = {
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
|
||||
/** Returns true if the current user is the owner of the containing item */
|
||||
get isOwner() {
|
||||
return this.item?.isOwner ?? true;
|
||||
return this.item?.isOwner ?? true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export default class DhCharacter extends DhCreature {
|
|||
settingSheet: DHCharacterSettings,
|
||||
isNPC: false,
|
||||
hasInventory: true,
|
||||
quantifiable: ["loot", "consumable"]
|
||||
quantifiable: ['loot', 'consumable']
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ export default class DhCharacter extends DhCreature {
|
|||
choices: CONFIG.DH.GENERAL.dieFaces,
|
||||
initial: null,
|
||||
label: 'DAGGERHEART.ACTORS.Character.defaultDisadvantageDice'
|
||||
}),
|
||||
})
|
||||
})
|
||||
})
|
||||
};
|
||||
|
|
@ -449,7 +449,7 @@ export default class DhCharacter extends DhCreature {
|
|||
|
||||
/* All items are valid on characters */
|
||||
isItemValid() {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ export default class DhCompanion extends DhCreature {
|
|||
choices: CONFIG.DH.GENERAL.dieFaces,
|
||||
initial: null,
|
||||
label: 'DAGGERHEART.ACTORS.Character.defaultDisadvantageDice'
|
||||
}),
|
||||
})
|
||||
})
|
||||
}),
|
||||
attack: new ActionField({
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default class DhParty extends BaseDataActor {
|
|||
static get metadata() {
|
||||
return foundry.utils.mergeObject(super.metadata, {
|
||||
hasInventory: true,
|
||||
quantifiable: ["weapon", "armor", "loot", "consumable"]
|
||||
quantifiable: ['weapon', 'armor', 'loot', 'consumable']
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,9 +40,7 @@ export default class DHSummonField extends fields.ArrayField {
|
|||
const roll = new Roll(itemAbleRollParse(summon.count, this.actor, this.item));
|
||||
await roll.evaluate();
|
||||
const count = roll.total;
|
||||
if (!roll.isDeterministic && game.modules.get('dice-so-nice')?.active)
|
||||
rolls.push(roll);
|
||||
|
||||
if (!roll.isDeterministic && game.modules.get('dice-so-nice')?.active) rolls.push(roll);
|
||||
|
||||
const actor = await DHSummonField.getWorldActor(await foundry.utils.fromUuid(summon.actorUUID));
|
||||
/* Extending summon data in memory so it's available in actionField.toChat. Think it's harmless, but ugly. Could maybe find a better way. */
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ export default class DualityRoll extends D20Roll {
|
|||
this.rallyChoices = this.setRallyChoices();
|
||||
this.guaranteedCritical = options.guaranteedCritical;
|
||||
|
||||
const advantageFaces = data.rules?.roll?.defaultAdvantageDice ? Number.parseInt(data.rules.roll.defaultAdvantageDice) : 6
|
||||
const advantageFaces = data.rules?.roll?.defaultAdvantageDice
|
||||
? Number.parseInt(data.rules.roll.defaultAdvantageDice)
|
||||
: 6;
|
||||
this.advantageFaces = Number.isNaN(advantageFaces) ? 6 : advantageFaces;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -200,7 +200,6 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
|||
static effectSafeEval(expression) {
|
||||
let result;
|
||||
try {
|
||||
// eslint-disable-next-line no-new-func
|
||||
const evl = new Function('sandbox', `with (sandbox) { return ${expression}}`);
|
||||
result = evl(Roll.MATH_PROXY);
|
||||
} catch (err) {
|
||||
|
|
|
|||
|
|
@ -602,7 +602,7 @@ export default class DhpActor extends Actor {
|
|||
rollData.system = this.system.getRollData();
|
||||
rollData.prof = this.system.proficiency ?? 1;
|
||||
rollData.cast = this.system.spellcastModifier ?? 1;
|
||||
|
||||
|
||||
return rollData;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ export default class DhActorCollection extends foundry.documents.collections.Act
|
|||
get party() {
|
||||
const id = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.ActiveParty);
|
||||
const actor = game.actors.get(id);
|
||||
return actor?.type === "party" ? actor : null;
|
||||
return actor?.type === 'party' ? actor : null;
|
||||
}
|
||||
|
||||
/** Ensure companions are initialized after all other subtypes. */
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ export const registerKeyBindings = () => {
|
|||
game.keybindings.register(CONFIG.DH.id, CONFIG.DH.SETTINGS.keybindings.partySheet, {
|
||||
name: _loc('DAGGERHEART.SETTINGS.Keybindings.partySheet.name'),
|
||||
hint: _loc('DAGGERHEART.SETTINGS.Keybindings.partySheet.hint'),
|
||||
editable: [{ key: "KeyP" }],
|
||||
editable: [{ key: 'KeyP' }],
|
||||
onDown: () => {
|
||||
const controlled = canvas.ready ? canvas.tokens.controlled : [];
|
||||
const selectedParty = controlled.find((c) => c.actor?.type === 'party')?.actor;
|
||||
const selectedParty = controlled.find(c => c.actor?.type === 'party')?.actor;
|
||||
const party = selectedParty ?? game.actors.party;
|
||||
if (!party) return;
|
||||
|
||||
|
|
@ -215,6 +215,6 @@ const registerNonConfigSettings = () => {
|
|||
scope: 'world',
|
||||
config: false,
|
||||
type: String,
|
||||
default: null,
|
||||
default: null
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue