UNPKG

@fenixengine/eslint-config-rpgmaker

Version:

An eslint config for RPG Maker MV and RPG Maker MZ used for FeniX and LTN Games' plugins

113 lines (84 loc) 2.57 kB
'use strict'; // Not neccessary inside of modules // Not allowed (import unresolved) import { Window_Options } from './rpg_core'; import { readFile } from 'fs'; // Not Allowed (rrequire unresolved) not-fs does not exist const writeFile = require('not-fs').writeFile; await readFile('file.txt'); // Not Allowed modules.exports = {}; // Allowed but warns console.log('Hello World! You should remove me for production!'); // Allowed const myObj = { a: 1, b: 2 }; myObj.a = 3; // Not Allowed (Spaces required after and before brackets) const anotherObj = {a: 1, b: 2}; myObj.a = 3; // Allowed (Spaces required before function paren) function testFunction () { }; testFunction(); // Not Allowed ((Spaces required before function paren)) function test2function() { }; test2function(); // allowed (eval is hevily used in RPG Maker) eval('1 + 1'); const myPromise = new Promise((resolve, reject) => { const isTrue = false; if (isTrue) { resolve(); } else { reject(); } }); function processData () {} // Not allowed myPromise.then((data) => { processData(data); // You must return soemthing }); // Must have a catch() myPromise.then((data) => { return processData(data); // You must return soemthing }).catch((error) => { console.error(error); }); function fetchData () { return new Promise((resolve, reject) => { // Unnecessary new Promise fetch('/api/data') .then((response) => response.json()) .then((data) => resolve(data)) .catch((error) => reject(error)); }); } fetchData(); // Not Allowed (No super in constructor) class MyWindow extends Window_Base { constructor () {} } new MyWindow(); // Not Allowed (must have trailing comma) const myObjectWithoutDangles = { a: 1, b: 2, c: 3 // no trailing comma }; myObjectWithoutDangles.a; // Allowed (Trailing comma) const myObjectWithDangles = { a: 1, b: 2, c: 3, d: 4, // trailing comma }; myObjectWithDangles.b; // allowed const randomFunc = (num) => { return num + 1; }; randomFunc(); // not allowed (must have parens around params) const randomFunc2 = num => { return num + 1; }; randomFunc2(); // All RPG Maker, Borwser and Node globals are available Window_Base.prototype.processOk = function () { }; Scene_Base.prototype.anotherMethod = function () { }; Document.prototype.anotherMethod = function () { }; document.addEventListener('click', function () { }); window.screen.addEventListener('click', function () { });