From e7fb73f4d2c7dbd1de99bb15b6ed885de5fa9136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Fri, 15 Mar 2024 17:10:33 +0100 Subject: [PATCH] Adjusted linting process * Define globals in .eslintrc.js rather than in each script (only includes already used globals for now, but should include all globals available in Tiled). * Disable the quotes lint, since it's not clear why one style should be enforced. --- .eslintrc.js | 13 +++++++++---- find-layer-by-id.js | 2 -- find-object-by-id.js | 2 -- follow-warp.js | 2 -- rectangle-chain.js | 2 -- remove-unused-tilesets.js | 2 -- shortcuts.mjs | 2 -- tile-rectangle.js | 2 -- videogame-format.js | 2 -- 9 files changed, 9 insertions(+), 20 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 4247f91..f18f1d2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -16,13 +16,18 @@ module.exports = { "error", "unix" ], - "quotes": [ - "error", - "double" - ], "semi": [ "error", "always" ] + }, + "globals": { + "File": "readonly", + "FileInfo": "readonly", + "MapObject": "readonly", + "TextFile": "readonly", + "TileLayer": "readonly", + "TileMap": "readonly", + "tiled": "readonly" } }; diff --git a/find-layer-by-id.js b/find-layer-by-id.js index a2f224e..cb4baaf 100644 --- a/find-layer-by-id.js +++ b/find-layer-by-id.js @@ -8,8 +8,6 @@ * you know its ID. */ -/* global tiled */ - function findLayerById(thing, id) { for (let i = thing.layerCount - 1; i >= 0; i--) { const layer = thing.layerAt(i); diff --git a/find-object-by-id.js b/find-object-by-id.js index 07d9725..deba955 100644 --- a/find-object-by-id.js +++ b/find-object-by-id.js @@ -11,8 +11,6 @@ * function to work properly for isometric maps. */ -/* global tiled */ - function findObjectById(thing, id) { for (let i = thing.layerCount - 1; i >= 0; i--) { const layer = thing.layerAt(i); diff --git a/follow-warp.js b/follow-warp.js index 965d3d2..de618e5 100644 --- a/follow-warp.js +++ b/follow-warp.js @@ -12,8 +12,6 @@ * with some adjustments it probably could! */ -/* global tiled */ - /** * @param thing {TileMap | GroupLayer} * @param name {string} diff --git a/rectangle-chain.js b/rectangle-chain.js index 20d331b..8ed96ba 100644 --- a/rectangle-chain.js +++ b/rectangle-chain.js @@ -7,8 +7,6 @@ * the map. */ -/* global tiled, MapObject */ - tiled.registerTool("RectangleChain", { name: "Draw Rectangle Chain", icon: "rectangle-chain.svg", diff --git a/remove-unused-tilesets.js b/remove-unused-tilesets.js index 31247a6..16111b2 100644 --- a/remove-unused-tilesets.js +++ b/remove-unused-tilesets.js @@ -9,8 +9,6 @@ * automatically on save. */ -/* global tiled */ - /** * @param {TileMap} map */ diff --git a/shortcuts.mjs b/shortcuts.mjs index 2f90a39..afa8038 100644 --- a/shortcuts.mjs +++ b/shortcuts.mjs @@ -18,8 +18,6 @@ * the Preferences dialog. */ -/* global tiled */ - /** * @param {Tileset} tileset */ diff --git a/tile-rectangle.js b/tile-rectangle.js index c08e92f..c3a823b 100644 --- a/tile-rectangle.js +++ b/tile-rectangle.js @@ -10,8 +10,6 @@ * brush is repeated in all directions. */ -/* global tiled, TileLayer, TileMap */ - tiled.registerTool("PaintTileRectangle", { name: "Paint Tile Rectangle", icon: "tile-rectangle.svg", diff --git a/videogame-format.js b/videogame-format.js index 53e4432..e3354b9 100644 --- a/videogame-format.js +++ b/videogame-format.js @@ -8,8 +8,6 @@ * method from the videogame library (https://github.com/diogoeichert/videogame) */ -/* global tiled, FileInfo, TextFile */ - tiled.registerMapFormat("videogame", { name: "videogame map format", extension: "json",