refactor: lint

main
Barış Soner Uşaklı 3 years ago
parent 44fc76af8f
commit e9110563c7

@ -0,0 +1,3 @@
{
"extends": "nodebb/lib"
}

@ -1,43 +1,38 @@
'use strict';
var meta = require.main.require('./src/meta');
var user = require.main.require('./src/user');
const meta = require.main.require('./src/meta');
const user = require.main.require('./src/user');
var library = {};
library.init = function(params, callback) {
var app = params.router;
var middleware = params.middleware;
const library = module.exports;
library.init = async function (params) {
const { app, middleware } = params;
app.get('/admin/plugins/persona', middleware.admin.buildHeader, renderAdmin);
app.get('/api/admin/plugins/persona', renderAdmin);
callback();
};
library.addAdminNavigation = function(header, callback) {
library.addAdminNavigation = async function (header) {
header.plugins.push({
route: '/plugins/persona',
icon: 'fa-paint-brush',
name: 'Persona Theme'
name: 'Persona Theme',
});
callback(null, header);
return header;
};
library.defineWidgetAreas = function(areas, callback) {
library.defineWidgetAreas = async function (areas) {
const locations = ['header', 'sidebar', 'footer'];
const templates = [
'categories.tpl', 'category.tpl', 'topic.tpl', 'users.tpl',
'unread.tpl', 'recent.tpl', 'popular.tpl', 'top.tpl', 'tags.tpl', 'tag.tpl'
'unread.tpl', 'recent.tpl', 'popular.tpl', 'top.tpl', 'tags.tpl', 'tag.tpl',
];
function capitalizeFirst(str) {
return str.charAt(0).toUpperCase() + str.slice(1)
return str.charAt(0).toUpperCase() + str.slice(1);
}
templates.forEach(template => {
locations.forEach(location => {
templates.forEach((template) => {
locations.forEach((location) => {
areas.push({
name: capitalizeFirst(template.split('.')[0]) + ' ' + capitalizeFirst(location),
name: `${capitalizeFirst(template.split('.')[0])} ${capitalizeFirst(location)}`,
template: template,
location: location,
});
@ -46,13 +41,12 @@ library.defineWidgetAreas = function(areas, callback) {
areas = areas.concat([
{
name: "Account Header",
template: "account/profile.tpl",
location: "header"
name: 'Account Header',
template: 'account/profile.tpl',
location: 'header',
},
]);
callback(null, areas);
return areas;
};
library.getThemeConfig = async function (config) {
@ -63,7 +57,7 @@ library.getThemeConfig = async function(config) {
return config;
};
function renderAdmin(req, res, next) {
function renderAdmin(req, res) {
res.render('admin/plugins/persona', {});
}

@ -10,6 +10,9 @@
"type": "git",
"url": "https://github.com/psychobunny/nodebb-theme-persona"
},
"scripts": {
"lint": "eslint ."
},
"keywords": [
"nodebb",
"theme",
@ -41,5 +44,10 @@
"dependencies": {
"pulling": "^2.0.0",
"striptags": "^3.2.0"
},
"devDependencies": {
"eslint": "^7.32.0",
"eslint-config-nodebb": "^0.0.2",
"eslint-plugin-import": "^2.24.2"
}
}

@ -0,0 +1,3 @@
{
"extends": "nodebb/public"
}
Loading…
Cancel
Save