add eslint rules

no-template-curly-in-string (+find and fix minor bug in redirect)
curly
no-multiple-empty-lines
merge-requests/341/head
Thomas Lynch 2 years ago
parent 115679a4de
commit d8f2e8292f
  1. 5
      .eslintrc.json
  2. 1
      controllers/forms.js
  3. 1
      gulp/res/js/password.js
  4. 1
      lib/converter/timeutils.js
  5. 1
      lib/middleware/misc/referrercheck.js
  6. 4
      lib/misc/randomrange.js
  7. 1
      lib/post/markdown/handler/linkmatch.test.js
  8. 1
      lib/post/name.test.js
  9. 1
      models/forms/actionhandler.js
  10. 2
      models/forms/editcustompage.js
  11. 1
      models/forms/moveposts.js
  12. 1
      models/pages/overboardcatalog.js
  13. 1
      worker.js

@ -44,6 +44,11 @@
"semi": [
"error",
"always"
],
"curly": ["error"],
"no-multiple-empty-lines": ["error", { "max": 1 }],
"no-template-curly-in-string": [
"error"
]
}
}

@ -31,7 +31,6 @@ const express = require('express')
addStaffController, deleteStaffController, editStaffController, editCustomPageController, editPostController,
editRoleController, newCaptchaForm, blockBypassForm, logoutForm, deleteSessionsController } = require(__dirname+'/forms/index.js');
//make new post
router.post('/board/:board/post', geoAndTor, fileMiddlewares.postsEarly, torPreBypassCheck, processIp, useSession, sessionRefresh, Boards.exists, calcPerms, banCheck, fileMiddlewares.posts,
makePostController.paramConverter, verifyCaptcha, numFiles, blockBypass.middleware, dnsblCheck, imageHashes, makePostController.controller);

@ -72,7 +72,6 @@ class syncedField {
}
}
}
window.addEventListener('settingsReady', () => {

@ -95,5 +95,4 @@ module.exports = {
return (`${end[0] > 0 ? end[0]+'s' : ''}${Math.trunc(end[1]/1000000)}ms `).padStart(9) + label;
},
};

@ -12,7 +12,6 @@ const updateReferers = () => {
updateReferers();
addCallback('config', updateReferers);
module.exports = (req, res, next) => {
if (req.method !== 'POST') {
return next();

@ -7,7 +7,9 @@ const { promisify } = require('util')
module.exports = async (min, max) => {
min = Math.floor(min);
max = Math.floor(max);
if (max <= min) return min;
if (max <= min) {
return min;
}
const mod = max - min + 1;
const div = (((0xffffffff - (mod-1)) / mod) | 0) + 1;
let g;

@ -38,5 +38,4 @@ describe('link markdown', () => {
});
}
});

@ -29,5 +29,4 @@ describe('name/trip/capcode handler', () => {
});
}
});

@ -104,7 +104,6 @@ module.exports = async (req, res, next) => {
messages.push(message);
}
if (deleting) {
//OP delete protection. for old OPs or with a lot of replies

@ -21,7 +21,7 @@ module.exports = async (req, res) => {
return dynamicResponse(req, res, 400, 'message', {
'title': 'Bad request',
'error': 'Custom page does not exist',
'redirect': req.headers.referer || '/${req.params.board}/manage/custompages.html'
'redirect': req.headers.referer || `/${req.params.board}/manage/custompages.html`
});
}

@ -84,7 +84,6 @@ module.exports = async (req, res) => {
}
}
//increase file/reply count in thread we are moving the posts to
const { replyposts, replyfiles } = res.locals.posts.reduce((acc, p) => {
acc.replyposts += 1;

@ -74,5 +74,4 @@ module.exports = async (req, res, next) => {
});
}
};

@ -27,4 +27,3 @@ const Mongo = require(__dirname+'/db/db.js')
})();

Loading…
Cancel
Save