diff --git a/.eslintrc.yml b/.eslintrc.yml index 09a1029..40bba46 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -39,6 +39,58 @@ rules: import/extensions: - warn - always +globals: + "$": readonly + ActiveEffect: readonly + ActiveEffectConfig: readonly + Actor: readonly + Actors: readonly + ActorSheet: readonly + Babele: readonly + CONFIG: readonly + CONST: readonly + ChatMessage: readonly + Combat: readonly + Combatant: readonly + ContextMenu: readonly + Dialog: readonly + DocumentSheetConfig: readonly + Folder: readonly + FormApplication: readonly + FormDataExtended: readonly + Handlebars: readonly + Hooks: readonly + ImagePopout: readonly + Item: readonly + Items: readonly + ItemSheet: readonly + Macro: readonly + Roll: readonly + Ruler: readonly + Scene: readonly + TextEditor: readonly + TokenDocument: readonly + canvas: readonly + debugger: readonly + document: readonly + dragRuler: readonly + duplicate: readonly + foundry: readonly + fromUuid: readonly + fromUuidSync: readonly + game: readonly + getProperty: readonly + globals: readonly + hasProperty: readonly + isNewerVersion: readonly + loadTemplates: readonly + mergeObject: readonly + parseUuid: readonly + randomID: readonly + renderTemplate: readonly + setProperty: readonly + ui: readonly + window: readonly settings: import/extensions: - ".js" diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 05cc275..20c7e6c 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -1,5 +1,3 @@ -/* globals $ game Roll ChatMessage AudioHelper ActorSheet mergeObject Dialog TextEditor ActiveEffect ui duplicate fromUuidSync renderTemplate randomID */ - import DG from "../config.js"; import { DGPercentileRoll, diff --git a/module/actor/actor.js b/module/actor/actor.js index f6f22de..bf96c97 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -1,5 +1,3 @@ -/* global Actor Item mergeObject game */ - /** * Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system. * @extends {Actor} diff --git a/module/deltagreen.js b/module/deltagreen.js index 2487f8f..284666d 100644 --- a/module/deltagreen.js +++ b/module/deltagreen.js @@ -1,5 +1,3 @@ -/* globals $ Hooks game CONFIG Actors Items ActorSheet ItemSheet duplicate */ - // Import Modules import DeltaGreenActor from "./actor/actor.js"; import DeltaGreenActorSheet from "./actor/actor-sheet.js"; diff --git a/module/item/item-sheet.js b/module/item/item-sheet.js index e2fbeb9..46c11c2 100644 --- a/module/item/item-sheet.js +++ b/module/item/item-sheet.js @@ -1,5 +1,3 @@ -/* global ItemSheet mergeObject TextEditor */ - /** * Extend the basic ItemSheet with some very simple modifications * @extends {ItemSheet} diff --git a/module/item/item.js b/module/item/item.js index 740d577..e0479da 100644 --- a/module/item/item.js +++ b/module/item/item.js @@ -1,5 +1,3 @@ -/* globals Item */ - import { DGDamageRoll, DGLethalityRoll } from "../roll/roll.js"; /** diff --git a/module/other/macro-functions.js b/module/other/macro-functions.js index b488615..0f0f8bd 100644 --- a/module/other/macro-functions.js +++ b/module/other/macro-functions.js @@ -1,5 +1,3 @@ -/* global game Macro ChatMessage ui */ - import * as DGRolls from "../roll/roll.js"; /* -------------------------------------------- */ diff --git a/module/other/register-helpers.js b/module/other/register-helpers.js index 02f3775..1356dde 100644 --- a/module/other/register-helpers.js +++ b/module/other/register-helpers.js @@ -1,5 +1,3 @@ -/* global Handlebars CONFIG game */ - import DGUtils from "./utility-functions.js"; export default function registerHandlebarsHelpers() { diff --git a/module/other/stat-parser-macro.js b/module/other/stat-parser-macro.js index ac67934..7da8d3a 100644 --- a/module/other/stat-parser-macro.js +++ b/module/other/stat-parser-macro.js @@ -1,7 +1,5 @@ -/* global Dialog Actor */ - -function GetNotesFromInput(inputText){ - const matchStr = '(?:ATTACKS:[\\S\\s]*?\\.\\n)([\\S\\s]*)'; +function GetNotesFromInput(inputText) { + const matchStr = "(?:ATTACKS:[\\S\\s]*?\\.\\n)([\\S\\s]*)"; const re = new RegExp(matchStr, "gi"); const results = inputText.match(re); let notes = ""; @@ -9,7 +7,7 @@ function GetNotesFromInput(inputText){ try { if (results != null && results.length > 0) { notes = results[0]; - notes = notes.replace("\n", " ") + notes = notes.replace("\n", " "); } } catch (ex) { console.log("GetNotesFromInput Error"); @@ -111,11 +109,19 @@ async function RegexParseNpcStatBlock(inputStr, actorType) { if (tempStr.length > 0) { actorData.name = tempStr[0]; - + // set the alternate description/profession/etc. // if this doesn't exist, the next line should be the attributes starting with strength // so if the second line starts with "STR" then just leave it be. - if (tempStr.length > 1 && tempStr[1].substring(0, 3) != "STR" && tempStr[1].substring(0, 3) != "CON" && tempStr[1].substring(0, 3) != "DEX" && tempStr[1].substring(0, 3) != "INT" && tempStr[1].substring(0, 3) != "POW" && tempStr[1].substring(0, 3) != "CHA") { + if ( + tempStr.length > 1 && + tempStr[1].substring(0, 3) != "STR" && + tempStr[1].substring(0, 3) != "CON" && + tempStr[1].substring(0, 3) != "DEX" && + tempStr[1].substring(0, 3) != "INT" && + tempStr[1].substring(0, 3) != "POW" && + tempStr[1].substring(0, 3) != "CHA" + ) { shortDescription = tempStr[1]; } } else { @@ -388,7 +394,7 @@ async function RegexParseNpcStatBlock(inputStr, actorType) { actorData.data.typedSkills[`tskill_${index.toString()}`] = element; } - if(actorType === "npc" || actorType === "unnatural"){ + if (actorType === "npc" || actorType === "unnatural") { actorData.data.notes = GetNotesFromInput(inputStr); } diff --git a/module/other/utility-functions.js b/module/other/utility-functions.js index 75db6c5..dabf602 100644 --- a/module/other/utility-functions.js +++ b/module/other/utility-functions.js @@ -1,5 +1,3 @@ -/* globals game */ - export default class DGUtils { /** * Attempt to localize a keyword, and gracefully fallback to something else if the key does not exist. diff --git a/module/roll/roll.js b/module/roll/roll.js index fb2db05..9d6df3a 100644 --- a/module/roll/roll.js +++ b/module/roll/roll.js @@ -1,5 +1,4 @@ /* eslint-disable max-classes-per-file */ -/* globals game Roll ChatMessage AudioHelper renderTemplate Dialog */ import DGUtils from "../other/utility-functions.js"; diff --git a/module/settings.js b/module/settings.js index da73354..3b500df 100644 --- a/module/settings.js +++ b/module/settings.js @@ -1,5 +1,3 @@ -/* global game */ - export default function registerSystemSettings() { game.settings.register("deltagreen", "characterSheetStyle", { name: "Character Sheet Style", diff --git a/module/templates.js b/module/templates.js index 7baa2eb..feb7415 100644 --- a/module/templates.js +++ b/module/templates.js @@ -1,5 +1,3 @@ -/* global loadTemplates */ - /** * Define a set of template paths to pre-load * Pre-loaded templates are compiled and cached for fast access when rendering