chore: reformat with 2 spaces and single quotes #115
1577 changed files with 70010 additions and 70042 deletions
|
@ -1,11 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
module.exports = {
|
||||
semi: true,
|
||||
trailingComma: "all",
|
||||
singleQuote: false,
|
||||
printWidth: 120,
|
||||
tabWidth: 4,
|
||||
};
|
11
.prettierrc.js
Normal file
11
.prettierrc.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
export default {
|
||||
semi: true,
|
||||
trailingComma: "all",
|
||||
singleQuote: false,
|
||||
printWidth: 120,
|
||||
tabWidth: 2,
|
||||
};
|
|
@ -62,9 +62,7 @@ describe("evaluateCheck with a single die", () => {
|
|||
|
||||
it("should roll a die even when the checkTargetNumber is 0 and fail on values > 1 and < 20", () => {
|
||||
for (let i = 2; i < 20; i++) {
|
||||
expect(evaluateCheck([i], 0)).toEqual([
|
||||
{ result: i, checkTargetNumber: 0, active: false, discarded: true },
|
||||
]);
|
||||
expect(evaluateCheck([i], 0)).toEqual([{ result: i, checkTargetNumber: 0, active: false, discarded: true }]);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -82,9 +80,7 @@ describe("evaluateCheck with a single die", () => {
|
|||
|
||||
it("should roll a die even when the checkTargetNumber is < 0 and fail on values > 1 and < 20", () => {
|
||||
for (let i = 2; i < 20; i++) {
|
||||
expect(evaluateCheck([i], -1)).toEqual([
|
||||
{ result: i, checkTargetNumber: -1, active: false, discarded: true },
|
||||
]);
|
||||
expect(evaluateCheck([i], -1)).toEqual([{ result: i, checkTargetNumber: -1, active: false, discarded: true }]);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -150,9 +150,7 @@ function buildCombinedTestCases(): CombinedTestCase[] {
|
|||
for (const sorcererTestCase of testCases.sorcerer.filter(isRelevantPermutationTestCase)) {
|
||||
for (const wizardTestCase of testCases.wizard.filter(isRelevantPermutationTestCase)) {
|
||||
const expected =
|
||||
healerTestCase.expected !== null ||
|
||||
sorcererTestCase.expected !== null ||
|
||||
wizardTestCase.expected !== null
|
||||
healerTestCase.expected !== null || sorcererTestCase.expected !== null || wizardTestCase.expected !== null
|
||||
? Math.min(
|
||||
healerTestCase.expected ?? Infinity,
|
||||
sorcererTestCase.expected ?? Infinity,
|
||||
|
|
|
@ -87,8 +87,7 @@ describe("Validator", () => {
|
|||
|
||||
it("allows a complicated valid expression", () => {
|
||||
// given
|
||||
const predicate = (identifier: string) =>
|
||||
[...safeOperators, ...literals, "floor", "random"].includes(identifier);
|
||||
const predicate = (identifier: string) => [...safeOperators, ...literals, "floor", "random"].includes(identifier);
|
||||
const validator = new Validator(predicate);
|
||||
const input = "typeof (floor(random() * 5) / 2) === 'number' ? 42 : 'foo'";
|
||||
|
||||
|
|
|
@ -74,11 +74,7 @@ export class DS4ActorSheet extends ActorSheet {
|
|||
* @protected
|
||||
*/
|
||||
addTooltipsToData(context) {
|
||||
const valueGroups = [
|
||||
context.data.system.attributes,
|
||||
context.data.system.traits,
|
||||
context.data.system.combatValues,
|
||||
];
|
||||
const valueGroups = [context.data.system.attributes, context.data.system.traits, context.data.system.combatValues];
|
||||
|
||||
valueGroups.forEach((valueGroup) => {
|
||||
Object.values(valueGroup).forEach((attribute) => {
|
||||
|
@ -349,9 +345,7 @@ export class DS4ActorSheet extends ActorSheet {
|
|||
return value;
|
||||
}
|
||||
default: {
|
||||
throw new TypeError(
|
||||
"Binding of item property to this type of HTML element not supported; given: " + element,
|
||||
);
|
||||
throw new TypeError("Binding of item property to this type of HTML element not supported; given: " + element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,9 @@ export class DS4CreatureActorSheet extends DS4ActorSheet {
|
|||
/** @override */
|
||||
async getData(options = {}) {
|
||||
const context = await super.getData(options);
|
||||
context.data.system.baseInfo.description = await TextEditor.enrichHTML(
|
||||
context.data.system.baseInfo.description,
|
||||
{ async: true },
|
||||
);
|
||||
context.data.system.baseInfo.description = await TextEditor.enrichHTML(context.data.system.baseInfo.description, {
|
||||
async: true,
|
||||
});
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,8 +68,7 @@ function findIndexOfSmallestNonCoup(dice: number[], maximumCoupResult: number):
|
|||
.map((die, index): [number, number] => [die, index])
|
||||
.filter((indexedDie) => indexedDie[0] > maximumCoupResult)
|
||||
.reduce(
|
||||
(smallestIndexedDie, indexedDie) =>
|
||||
indexedDie[0] < smallestIndexedDie[0] ? indexedDie : smallestIndexedDie,
|
||||
(smallestIndexedDie, indexedDie) => (indexedDie[0] < smallestIndexedDie[0] ? indexedDie : smallestIndexedDie),
|
||||
[Infinity, -1],
|
||||
)[1];
|
||||
}
|
||||
|
|
|
@ -59,9 +59,7 @@ class CheckFactory {
|
|||
* Execute this check factory.
|
||||
* @returns {Promise<ChatMessage | undefined>} A promise that resolves to the created chat message for the roll */
|
||||
async execute() {
|
||||
const innerFormula = ["ds", this.createCheckTargetNumberModifier(), this.createCoupFumbleModifier()].filterJoin(
|
||||
"",
|
||||
);
|
||||
const innerFormula = ["ds", this.createCheckTargetNumberModifier(), this.createCoupFumbleModifier()].filterJoin("");
|
||||
const formula = this.#options.useSlayingDice ? `{${innerFormula}}x` : innerFormula;
|
||||
const roll = Roll.create(formula);
|
||||
const speaker = this.#options.speaker ?? ChatMessage.getSpeaker();
|
||||
|
@ -209,14 +207,9 @@ async function askForInteractiveRollData(checkTargetNumber, options = {}, { temp
|
|||
},
|
||||
{
|
||||
activateAdditionalListeners: (html, app) => {
|
||||
const checkModifierCustomFormGroup = html
|
||||
.find(`#check-modifier-custom-${id}`)
|
||||
.parent(".form-group");
|
||||
const checkModifierCustomFormGroup = html.find(`#check-modifier-custom-${id}`).parent(".form-group");
|
||||
html.find(`#check-modifier-${id}`).on("change", (event) => {
|
||||
if (
|
||||
event.currentTarget.value === "custom" &&
|
||||
checkModifierCustomFormGroup.hasClass("ds4-hidden")
|
||||
) {
|
||||
if (event.currentTarget.value === "custom" && checkModifierCustomFormGroup.hasClass("ds4-hidden")) {
|
||||
checkModifierCustomFormGroup.removeClass("ds4-hidden");
|
||||
app.setPosition({ height: "auto" });
|
||||
} else if (!checkModifierCustomFormGroup.hasClass("ds4-hidden")) {
|
||||
|
|
|
@ -32,9 +32,7 @@ export function isTrait(value: unknown): value is Trait {
|
|||
}
|
||||
|
||||
type DS4ActorDataSourceDataCombatValues = {
|
||||
[Key in keyof typeof DS4.i18n.combatValues]: Key extends "hitPoints"
|
||||
? ResourceData<number>
|
||||
: ModifiableData<number>;
|
||||
[Key in keyof typeof DS4.i18n.combatValues]: Key extends "hitPoints" ? ResourceData<number> : ModifiableData<number>;
|
||||
};
|
||||
|
||||
type CombatValue = keyof DS4ActorDataSourceDataCombatValues;
|
||||
|
|
|
@ -39,9 +39,7 @@ export class DS4Actor extends Actor {
|
|||
maximumCoupResult: 1,
|
||||
};
|
||||
|
||||
Object.values(this.system.attributes).forEach(
|
||||
(attribute) => (attribute.total = attribute.base + attribute.mod),
|
||||
);
|
||||
Object.values(this.system.attributes).forEach((attribute) => (attribute.total = attribute.base + attribute.mod));
|
||||
|
||||
Object.values(this.system.traits).forEach((trait) => (trait.total = trait.base + trait.mod));
|
||||
}
|
||||
|
@ -184,8 +182,7 @@ export class DS4Actor extends Actor {
|
|||
this,
|
||||
this.actorEffects,
|
||||
(change) =>
|
||||
!this.derivedDataProperties.includes(change.key) &&
|
||||
!this.finalDerivedDataProperties.includes(change.key),
|
||||
!this.derivedDataProperties.includes(change.key) && !this.finalDerivedDataProperties.includes(change.key),
|
||||
).forEach(this.newStatuses.add.bind(this.newStatuses));
|
||||
}
|
||||
|
||||
|
@ -360,8 +357,7 @@ export class DS4Actor extends Actor {
|
|||
disableTraps: system.attributes.mind.total + system.traits.dexterity.total,
|
||||
featOfStrength: system.attributes.body.total + system.traits.strength.total,
|
||||
flirt: system.attributes.mind.total + system.traits.aura.total,
|
||||
haggle:
|
||||
system.attributes.mind.total + Math.max(system.traits.intellect.total, system.traits.intellect.total),
|
||||
haggle: system.attributes.mind.total + Math.max(system.traits.intellect.total, system.traits.intellect.total),
|
||||
hide: system.attributes.mobility.total + system.traits.agility.total,
|
||||
identifyMagic: system.attributes.mind.total + system.traits.intellect.total,
|
||||
jump: system.attributes.mobility.total + system.traits.agility.total,
|
||||
|
|
|
@ -49,8 +49,7 @@ export class DS4Spell extends DS4Item {
|
|||
const spellType = this.system.spellType;
|
||||
const opponentDefense = this.system.opponentDefense;
|
||||
const checkTargetNumber =
|
||||
ownerSystemData.combatValues[spellType].total +
|
||||
(hasComplexModifier ? 0 : this.system.spellModifier.numerical);
|
||||
ownerSystemData.combatValues[spellType].total + (hasComplexModifier ? 0 : this.system.spellModifier.numerical);
|
||||
const speaker = ChatMessage.getSpeaker({ actor: this.actor, ...options.speaker });
|
||||
const flavor =
|
||||
opponentDefense !== undefined && opponentDefense !== 0
|
||||
|
|
|
@ -207,10 +207,7 @@ export class Lexer {
|
|||
only0s = endPos === pos ? true : only0s;
|
||||
}
|
||||
|
||||
if (
|
||||
this.input[endPos] === "_" &&
|
||||
(this.input[endPos - 1] === "_" || this.input[endPos - 1] === "." || only0s)
|
||||
) {
|
||||
if (this.input[endPos] === "_" && (this.input[endPos - 1] === "_" || this.input[endPos - 1] === "." || only0s)) {
|
||||
return [{ type: "invalid", pos }, pos];
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ function bumpVersion(release) {
|
|||
|
||||
console.log(`Bumping version number to '${targetVersion}'`);
|
||||
packageJson.version = targetVersion;
|
||||
fs.writeJSONSync("package.json", packageJson, { spaces: 4 });
|
||||
fs.writeJSONSync("package.json", packageJson, { spaces: 2 });
|
||||
manifest.version = targetVersion;
|
||||
manifest.url = repositoryURL;
|
||||
manifest.manifest = getManifestUrl(getChannel(targetVersion));
|
||||
|
@ -90,7 +90,7 @@ function bumpVersion(release) {
|
|||
manifest.changelog = getChangelogURL(targetVersion);
|
||||
manifest.readme = getReadmeURL(targetVersion);
|
||||
manifest.license = getLicenseURL(targetVersion);
|
||||
fs.writeJSONSync(manifestPath, manifest, { spaces: 4 });
|
||||
fs.writeJSONSync(manifestPath, manifest, { spaces: 2 });
|
||||
}
|
||||
|
||||
const argv = yargs(hideBin(process.argv)).usage("Usage: $0").option("release", {
|
||||
|
|
Loading…
Reference in a new issue