Add src/dist to prettier/eslint ignores, apply lint, webpack adjustments

This commit is contained in:
Max Leiter 2022-05-06 18:19:44 -07:00
parent 1da8291790
commit a06bc904ae
No known key found for this signature in database
GPG key ID: A3512F2F2F17EBDA
177 changed files with 65 additions and 350 deletions

View file

@ -1,2 +1,3 @@
public/
coverage/
src/dist/

View file

@ -1,3 +1,5 @@
const projects = ["./tsconfig.json", "./client/tsconfig.json", "./src/tsconfig.json"];
module.exports = {
root: true,
overrides: [
@ -10,7 +12,8 @@ module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json", "./client/tsconfig.json", "./src/tsconfig.json"],
// extraFileExtensions: [".vue"],
extraFileExtensions: [".vue"],
projects: projects,
},
plugins: ["@typescript-eslint"],
extends: [
@ -58,7 +61,7 @@ module.exports = {
"<template>": "espree",
},
tsconfigRootDir: __dirname,
project: ["./tsconfig.json", "./client/tsconfig.json", "./src/tsconfig.json"],
project: projects,
},
plugins: ["vue"],
extends: [

View file

@ -3,7 +3,7 @@ public/
test/fixtures/.thelounge/logs/
test/fixtures/.thelounge/certificates/
test/fixtures/.thelounge/storage/
src/dist/
*.log
*.png
*.svg

View file

@ -6,5 +6,4 @@ module.exports = {
// "@vue/babel-preset-jsx",
],
targets: "> 0.25%, not dead",
// plugins: [["@babel/transform-typescript", {allowNamespaces: true}]],
};

View file

@ -6,7 +6,7 @@
// Second argument says it's recursive, third makes sure we only load templates.
const requireViews = require.context(".", false, /\.vue$/);
export default requireViews.keys().reduce((acc, path) => {
export default requireViews.keys().reduce((acc: Record<string, any>, path) => {
acc["message-" + path.substring(2, path.length - 4)] = requireViews(path).default;
return acc;

View file

@ -195,7 +195,7 @@
}
</style>
<script>
<script lang="ts">
import Mousetrap from "mousetrap";
import Draggable from "vuedraggable";
import {filter as fuzzyFilter} from "fuzzy";
@ -209,6 +209,9 @@ import isIgnoredKeybind from "../js/helpers/isIgnoredKeybind";
import distance from "../js/helpers/distance";
import eventbus from "../js/eventbus";
import NetworkModel from "../../src/models/network";
import ChannelMode from "../../src/models/chan";
export default {
name: "NetworkList",
components: {

View file

@ -1,5 +1,3 @@
"use strict";
import storage from "./localStorage";
import location from "./location";

View file

@ -1,5 +1,3 @@
"use strict";
import constants from "./constants";
import Mousetrap from "mousetrap";

View file

@ -1,5 +1,3 @@
"use strict";
export default function (chat) {
// Disable in Firefox as it already copies flex text correctly
if (typeof window.InstallTrigger !== "undefined") {

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
// Taken from views/index.js
// This creates a version of `require()` in the context of the current

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";
import {switchToChannel} from "../router";

View file

@ -1,5 +1,3 @@
"use strict";
import store from "../store";
import {router} from "../router";

View file

@ -1,5 +1,3 @@
"use strict";
const colorCodeMap = [
["00", "White"],
["01", "Black"],

View file

@ -3,11 +3,8 @@ const events = new Map();
class EventBus {
/**
* Register an event handler for the given type.
*
* @param {String} type Type of event to listen for.
* @param {Function} handler Function to call in response to given event.
*/
on(type, handler) {
on(type: string, handler: Function) {
if (events.has(type)) {
events.get(type).push(handler);
} else {
@ -21,11 +18,11 @@ class EventBus {
* @param {String} type Type of event to unregister `handler` from.
* @param {Function} handler Handler function to remove.
*/
off(type, handler) {
off(type: string, handler: Function) {
if (events.has(type)) {
events.set(
type,
events.get(type).filter((item) => item !== handler)
events.get(type).filter((item: Function) => item !== handler)
);
}
}
@ -36,12 +33,12 @@ class EventBus {
* @param {String} type The event type to invoke.
* @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler.
*/
emit(type, ...evt) {
emit(type: string, ...evt: any) {
if (events.has(type)) {
events
.get(type)
.slice()
.map((handler) => {
.map((handler: (...evt: any[]) => void) => {
handler(...evt);
});
}

View file

@ -1,5 +1,3 @@
"use strict";
import storage from "../localStorage";
export default (network, isCollapsed) => {

View file

@ -1,5 +1,3 @@
"use strict";
// Generates a string from "color-1" to "color-32" based on an input string
export default (str) => {
let hash = 0;

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import eventbus from "../eventbus";

View file

@ -1,5 +1,3 @@
"use strict";
const sizes = ["Bytes", "KiB", "MiB", "GiB", "TiB", "PiB"];
export default (size: number) => {

View file

@ -1,5 +1,3 @@
"use strict";
import {ParsedStyle} from "./parseStyle";
// Return true if any section of "a" or "b" parts (defined by their start/end

View file

@ -1,5 +1,3 @@
"use strict";
const matchFormatting =
/\x02|\x1D|\x1F|\x16|\x0F|\x11|\x1E|\x03(?:[0-9]{1,2}(?:,[0-9]{1,2})?)?|\x04(?:[0-9a-f]{6}(?:,[0-9a-f]{6})?)?/gi;

View file

@ -1,5 +1,3 @@
"use strict";
import {ParsedStyle} from "./parseStyle";
// Create plain text entries corresponding to areas of the text that match no

View file

@ -1,5 +1,3 @@
"use strict";
// Escapes the RegExp special characters "^", "$", "", ".", "*", "+", "?", "(",
// ")", "[", "]", "{", "}", and "|" in string.
// See https://lodash.com/docs/#escapeRegExp

View file

@ -1,5 +1,3 @@
"use strict";
const emojiRegExp = require("emoji-regex")();
function findEmoji(text) {

View file

@ -1,5 +1,3 @@
"use strict";
import LinkifyIt, {Match} from "linkify-it";
type OurMatch = Match & {

View file

@ -1,5 +1,3 @@
"use strict";
const nickRegExp = /([\w[\]\\`^{|}-]+)/g;
function findNames(text, users) {

View file

@ -1,5 +1,3 @@
"use strict";
import anyIntersection from "./anyIntersection";
import fill from "./fill";

View file

@ -1,5 +1,3 @@
"use strict";
// Styling control codes
const BOLD = "\x02";
const COLOR = "\x03";

View file

@ -1,5 +1,3 @@
"use strict";
import store from "../store";
export default (network, channel) => {

View file

@ -1,5 +1,3 @@
"use strict";
export default (event: MouseEvent | Mousetrap.ExtendedKeyboardEvent) => {
if (
(event.target as HTMLElement).tagName !== "TEXTAREA" &&

View file

@ -1,5 +1,3 @@
"use strict";
import distance from "./distance";
// onTwoFingerSwipe will be called with a cardinal direction ("n", "e", "s" or

View file

@ -1,5 +1,3 @@
"use strict";
import dayjs from "dayjs";
export default (time: Date | number) => dayjs(time).format("D MMMM YYYY, HH:mm:ss");

View file

@ -1,5 +1,3 @@
"use strict";
import parseStyle from "./ircmessageparser/parseStyle";
import findChannels from "./ircmessageparser/findChannels";
import {findLinks} from "./ircmessageparser/findLinks";

View file

@ -1,5 +1,3 @@
"use strict";
export default (stringUri) => {
const data = {};

View file

@ -1,5 +1,3 @@
"use strict";
export default (count) => {
if (count < 1000) {
return count.toString();

View file

@ -1,5 +1,3 @@
"use strict";
import Mousetrap from "mousetrap";
import store from "./store";

View file

@ -10,11 +10,12 @@
(function () {
const msg = document.getElementById("loading-page-message");
msg.textContent = "Loading the app…";
document
.getElementById("loading-reload")
.addEventListener("click", () => location.reload(true));
if (msg) {
msg.textContent = "Loading the app…";
}
document.getElementById("loading-reload")?.addEventListener("click", () => location.reload());
const displayReload = () => {
const loadingReload = document.getElementById("loading-reload");
@ -26,7 +27,11 @@
const loadingSlowTimeout = setTimeout(() => {
const loadingSlow = document.getElementById("loading-slow");
loadingSlow.style.visibility = "visible";
if (loadingSlow) {
loadingSlow.style.visibility = "visible";
}
displayReload();
}, 5000);

View file

@ -1,5 +1,3 @@
"use strict";
// This is a simple localStorage wrapper because browser can throw errors
// in different situations, including:
// - Unable to store data if storage is full

View file

@ -1,5 +1,3 @@
"use strict";
// This is a thin wrapper around `window.location`, in order to contain the
// side-effects. Do not add logic to it as it cannot be tested, only mocked.
export default {

View file

@ -1,5 +1,3 @@
"use strict";
import constants from "./constants";
import Vue from "vue";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import storage from "../localStorage";
import {router, navigate} from "../router";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import upload from "../upload";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
import "./connection";
import "./auth";
import "./commands";

View file

@ -1,5 +1,3 @@
"use strict";
import Vue from "vue";
import socket from "../socket";
import storage from "../localStorage";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";
import {switchToChannel} from "../router";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
import Vue from "vue";
import socket from "../socket";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import cleanIrcMessage from "../helpers/ircmessageparser/cleanIrcMessage";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
import Vue from "vue";
import socket from "../socket";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";
import {switchToChannel} from "../router";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
import Vue from "vue";
import socket from "../socket";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";
import {switchToChannel} from "../router";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import {switchToChannel, navigate} from "../router";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import Auth from "../auth";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "../socket";
import store from "../store";

View file

@ -1,9 +1,7 @@
"use strict";
import io from "socket.io-client";
import io, {Socket} from "socket.io-client";
const socket = io({
transports: JSON.parse(document.body.dataset.transports),
transports: JSON.parse(document.body.dataset.transports || "['polling', 'websocket']"),
path: window.location.pathname + "socket.io/",
autoConnect: false,
reconnection: !document.body.classList.contains("public"),
@ -14,4 +12,10 @@ if (process.env.NODE_ENV === "development") {
window.socket = socket;
}
declare global {
interface Window {
socket: Socket;
}
}
export default socket;

View file

@ -1,5 +1,3 @@
"use strict";
import {update as updateCursor} from "undate";
import socket from "./socket";

View file

@ -1,5 +1,3 @@
"use strict";
import constants from "./constants";
import "../css/style.css";

View file

@ -1,5 +1,3 @@
"use strict";
import socket from "./socket";
import store from "./store";

View file

@ -19,13 +19,13 @@
"dev": "NODE_ENV=development ts-node --project src/tsconfig.json src/index.ts start --dev",
"format:prettier": "prettier --write \"**/*.*\"",
"lint:check-eslint": "eslint-config-prettier .eslintrc.cjs",
"lint:eslint": "eslint . --report-unused-disable-directives --color",
"lint:eslint": "eslint . --ext .js,.ts,.vue --report-unused-disable-directives --color",
"lint:prettier": "prettier --list-different \"**/*.*\"",
"lint:stylelint": "stylelint --color \"client/**/*.css\"",
"lint:tsc": "tsc --noEmit",
"start": "node src/dist/src/index start",
"test": "run-p --aggregate-output --continue-on-error lint:* test:*",
"test:mocha": "webpack --mode=development && nyc --nycrc-path=test/.nycrc-mocha.json mocha --colors --config=test/.mocharc.yml",
"test:mocha": "NODE_ENV=test webpack --mode=development && nyc --nycrc-path=test/.nycrc-mocha.json mocha --colors --config=test/.mocharc.yml",
"watch": "webpack --watch"
},
"keywords": [

View file

@ -1,5 +1,3 @@
"use strict";
import _ from "lodash";
import UAParser from "ua-parser-js";
import {v4 as uuidv4} from "uuid";

View file

@ -1,5 +1,3 @@
"use strict";
import _ from "lodash";
import colors from "chalk";
import crypto from "crypto";

View file

@ -1,5 +1,3 @@
"use strict";
import log from "../log";
import fs from "fs";
import path from "path";

View file

@ -1,5 +1,3 @@
"use strict";
import log from "../log";
import colors from "chalk";
import semver from "semver";

View file

@ -1,5 +1,3 @@
"use strict";
import {Command} from "commander";
import Utils from "./utils";
import packageManager from "../plugins/packages";

View file

@ -1,5 +1,3 @@
"use strict";
import log from "../log";
import colors from "chalk";
import fs from "fs";

View file

@ -1,5 +1,3 @@
"use strict";
import log from "../log";
import colors from "chalk";
import {Command} from "commander";

View file

@ -1,5 +1,3 @@
"use strict";
import log from "../log";
import colors from "chalk";
import {Command} from "commander";

View file

@ -1,5 +1,3 @@
"use strict";
import log from "../../log";
import colors from "chalk";
import {Command} from "commander";

View file

@ -1,5 +1,3 @@
"use strict";
import log from "../../log";
import {Command} from "commander";
import child from "child_process";

View file

@ -1,17 +1,22 @@
"use strict";
import config from "../../config";
import list from "./list";
import remove from "./remove";
import edit from "./edit";
import log from "../../log";
let add, reset;
(async () => {
if (config.values.ldap.enable) {
const importAddAndReest = async (): Promise<void> => {
if (!config.values.ldap.enable) {
add = (await import("./add")).default;
reset = (await import("./reset")).default;
}
})();
};
(async () => {
await importAddAndReest();
})().catch((e: any) => {
log.error("Unable to load plugins all command-line plugins:", e);
});
export default [list, remove, edit, add, reset];

View file

@ -1,5 +1,3 @@
"use strict";
import log from "../../log";
import colors from "chalk";
import {Command} from "commander";

View file

@ -1,5 +1,3 @@
"use strict";
import log from "../../log";
import colors from "chalk";
import {Command} from "commander";

View file

@ -1,5 +1,3 @@
"use strict";
import log from "../../log";
import colors from "chalk";
import {Command} from "commander";

View file

@ -1,5 +1,3 @@
"use strict";
import _ from "lodash";
import log from "../log";
import colors from "chalk";

View file

@ -1,5 +1,3 @@
"use strict";
import path from "path";
import fs, {Stats} from "fs";
import os from "os";

View file

@ -1,5 +1,3 @@
"use strict";
import pkg from "../package.json";
import _ from "lodash";
import path from "path";

View file

@ -1,5 +1,3 @@
"use strict";
import log from "./log";
import fs from "fs";
import net, {Socket} from "net";

View file

@ -1,7 +1,5 @@
#!/usr/bin/env ts-node
"use strict";
process.chdir(__dirname);
// Perform node version check before loading any other files or modules

View file

@ -1,5 +1,3 @@
"use strict";
import colors from "chalk";
import read from "read";

View file

@ -1,5 +1,3 @@
"use strict";
import _ from "lodash";
import log from "../log";
import Config from "../config";

View file

@ -1,5 +1,3 @@
"use strict";
import _ from "lodash";
import User from "./user";

View file

@ -1,5 +1,3 @@
"use strict";
import _ from "lodash";
import {v4 as uuidv4} from "uuid";
import IrcFramework, {Client as IRCClient} from "irc-framework";

View file

@ -1,5 +1,3 @@
"use strict";
type PrefixSymbol = string;
type PrefixObject = {

View file

@ -1,5 +1,3 @@
"use strict";
import _ from "lodash";
import Prefix from "./prefix";

View file

@ -1,5 +1,3 @@
"use strict";
import colors from "chalk";
import Client from "../client";
import ClientManager from "../clientManager";

View file

@ -1,4 +1,3 @@
"use strict";
import ldap, {SearchOptions} from "ldapjs";
import colors from "chalk";

View file

@ -1,5 +1,3 @@
"use strict";
import colors from "chalk";
import log from "../../log";
import Helper from "../../helper";

View file

@ -1,5 +1,3 @@
"use strict";
import got, {Response} from "got";
import colors from "chalk";
import log from "../log";

View file

@ -1,5 +1,3 @@
"use strict";
import path from "path";
import fs from "fs";
import crypto from "crypto";

Some files were not shown because too many files have changed in this diff Show more