* Update some JS dependencies - Update selective dependencies that are compatible with webpack 4. We can not upgrade to webpack 5 yet because `license-webpack-plugin` is incompatible. - Enable a few new eslint rules and fix new issues * fix comment Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net>tags/v1.15.0-dev
@@ -99,7 +99,7 @@ rules: | |||||
import/no-amd: [0] | import/no-amd: [0] | ||||
import/no-anonymous-default-export: [0] | import/no-anonymous-default-export: [0] | ||||
import/no-commonjs: [0] | import/no-commonjs: [0] | ||||
import/no-cycle: [0] | |||||
import/no-cycle: [2, {ignoreExternal: true}] | |||||
import/no-default-export: [0] | import/no-default-export: [0] | ||||
import/no-deprecated: [0] | import/no-deprecated: [0] | ||||
import/no-dynamic-require: [0] | import/no-dynamic-require: [0] | ||||
@@ -117,7 +117,7 @@ rules: | |||||
import/no-self-import: [2] | import/no-self-import: [2] | ||||
import/no-unassigned-import: [0] | import/no-unassigned-import: [0] | ||||
import/no-unresolved: [2, {commonjs: true}] | import/no-unresolved: [2, {commonjs: true}] | ||||
import/no-unused-modules: [0] | |||||
import/no-unused-modules: [2, {unusedExports: true}] | |||||
import/no-useless-path-segments: [2, {commonjs: true}] | import/no-useless-path-segments: [2, {commonjs: true}] | ||||
import/no-webpack-loader-syntax: [2] | import/no-webpack-loader-syntax: [2] | ||||
import/order: [0] | import/order: [0] | ||||
@@ -211,7 +211,7 @@ rules: | |||||
no-mixed-operators: [0] | no-mixed-operators: [0] | ||||
no-mixed-spaces-and-tabs: [2] | no-mixed-spaces-and-tabs: [2] | ||||
no-multi-assign: [0] | no-multi-assign: [0] | ||||
no-multi-spaces: [2, {ignoreEOLComments: true, exceptions: {Property: true, VariableDeclarator: true}}] | |||||
no-multi-spaces: [2, {ignoreEOLComments: true, exceptions: {Property: true}}] | |||||
no-multi-str: [2] | no-multi-str: [2] | ||||
no-negated-condition: [0] | no-negated-condition: [0] | ||||
no-nested-ternary: [0] | no-nested-ternary: [0] | ||||
@@ -336,6 +336,7 @@ rules: | |||||
unicorn/explicit-length-check: [0] | unicorn/explicit-length-check: [0] | ||||
unicorn/filename-case: [0] | unicorn/filename-case: [0] | ||||
unicorn/import-index: [0] | unicorn/import-index: [0] | ||||
unicorn/import-style: [0] | |||||
unicorn/new-for-builtins: [2] | unicorn/new-for-builtins: [2] | ||||
unicorn/no-abusive-eslint-disable: [0] | unicorn/no-abusive-eslint-disable: [0] | ||||
unicorn/no-array-instanceof: [0] | unicorn/no-array-instanceof: [0] | ||||
@@ -356,11 +357,13 @@ rules: | |||||
unicorn/no-useless-undefined: [0] | unicorn/no-useless-undefined: [0] | ||||
unicorn/no-zero-fractions: [2] | unicorn/no-zero-fractions: [2] | ||||
unicorn/number-literal-case: [0] | unicorn/number-literal-case: [0] | ||||
unicorn/numeric-separators-style: [0] | |||||
unicorn/prefer-add-event-listener: [2] | unicorn/prefer-add-event-listener: [2] | ||||
unicorn/prefer-array-find: [2] | unicorn/prefer-array-find: [2] | ||||
unicorn/prefer-dataset: [2] | unicorn/prefer-dataset: [2] | ||||
unicorn/prefer-event-key: [2] | unicorn/prefer-event-key: [2] | ||||
unicorn/prefer-includes: [2] | unicorn/prefer-includes: [2] | ||||
unicorn/prefer-math-trunc: [2] | |||||
unicorn/prefer-modern-dom-apis: [0] | unicorn/prefer-modern-dom-apis: [0] | ||||
unicorn/prefer-negative-index: [2] | unicorn/prefer-negative-index: [2] | ||||
unicorn/prefer-node-append: [0] | unicorn/prefer-node-append: [0] | ||||
@@ -374,6 +377,7 @@ rules: | |||||
unicorn/prefer-spread: [0] | unicorn/prefer-spread: [0] | ||||
unicorn/prefer-starts-ends-with: [2] | unicorn/prefer-starts-ends-with: [2] | ||||
unicorn/prefer-string-slice: [0] | unicorn/prefer-string-slice: [0] | ||||
unicorn/prefer-ternary: [0] | |||||
unicorn/prefer-text-content: [2] | unicorn/prefer-text-content: [2] | ||||
unicorn/prefer-trim-start-end: [2] | unicorn/prefer-trim-start-end: [2] | ||||
unicorn/prefer-type-error: [0] | unicorn/prefer-type-error: [0] | ||||
@@ -5,37 +5,37 @@ | |||||
"node": ">= 10.13.0" | "node": ">= 10.13.0" | ||||
}, | }, | ||||
"dependencies": { | "dependencies": { | ||||
"@babel/core": "7.11.6", | |||||
"@babel/plugin-transform-runtime": "7.11.5", | |||||
"@babel/preset-env": "7.11.5", | |||||
"@babel/runtime": "7.11.2", | |||||
"@babel/core": "7.12.3", | |||||
"@babel/plugin-transform-runtime": "7.12.1", | |||||
"@babel/preset-env": "7.12.1", | |||||
"@babel/runtime": "7.12.1", | |||||
"@claviska/jquery-minicolors": "2.3.5", | "@claviska/jquery-minicolors": "2.3.5", | ||||
"@primer/octicons": "11.0.0", | "@primer/octicons": "11.0.0", | ||||
"add-asset-webpack-plugin": "1.0.0", | "add-asset-webpack-plugin": "1.0.0", | ||||
"babel-loader": "8.1.0", | "babel-loader": "8.1.0", | ||||
"clipboard": "2.0.6", | "clipboard": "2.0.6", | ||||
"core-js": "3.6.5", | "core-js": "3.6.5", | ||||
"css-loader": "4.3.0", | |||||
"css-minimizer-webpack-plugin": "1.1.3", | |||||
"css-loader": "5.0.0", | |||||
"css-minimizer-webpack-plugin": "1.1.5", | |||||
"dropzone": "5.7.2", | "dropzone": "5.7.2", | ||||
"escape-goat": "3.0.0", | "escape-goat": "3.0.0", | ||||
"fast-glob": "3.2.4", | "fast-glob": "3.2.4", | ||||
"file-loader": "6.1.0", | |||||
"file-loader": "6.1.1", | |||||
"fomantic-ui": "2.8.7", | "fomantic-ui": "2.8.7", | ||||
"font-awesome": "4.7.0", | "font-awesome": "4.7.0", | ||||
"jquery": "3.5.1", | "jquery": "3.5.1", | ||||
"jquery.are-you-sure": "1.9.0", | "jquery.are-you-sure": "1.9.0", | ||||
"less": "3.12.2", | "less": "3.12.2", | ||||
"less-loader": "7.0.1", | |||||
"less-loader": "7.0.2", | |||||
"license-webpack-plugin": "2.3.0", | "license-webpack-plugin": "2.3.0", | ||||
"mermaid": "8.8.0", | |||||
"mini-css-extract-plugin": "0.11.1", | |||||
"monaco-editor": "0.20.0", | |||||
"monaco-editor-webpack-plugin": "1.9.0", | |||||
"raw-loader": "4.0.1", | |||||
"sortablejs": "1.10.2", | |||||
"swagger-ui": "3.32.5", | |||||
"terser-webpack-plugin": "4.1.0", | |||||
"mermaid": "8.8.2", | |||||
"mini-css-extract-plugin": "1.1.1", | |||||
"monaco-editor": "0.21.2", | |||||
"monaco-editor-webpack-plugin": "2.0.0", | |||||
"raw-loader": "4.0.2", | |||||
"sortablejs": "1.12.0", | |||||
"swagger-ui": "3.35.2", | |||||
"terser-webpack-plugin": "4.2.3", | |||||
"tributejs": "5.1.3", | "tributejs": "5.1.3", | ||||
"vue": "2.6.12", | "vue": "2.6.12", | ||||
"vue-bar-graph": "1.2.0", | "vue-bar-graph": "1.2.0", | ||||
@@ -44,20 +44,20 @@ | |||||
"vue-template-compiler": "2.6.12", | "vue-template-compiler": "2.6.12", | ||||
"webpack": "4.44.1", | "webpack": "4.44.1", | ||||
"webpack-cli": "3.3.12", | "webpack-cli": "3.3.12", | ||||
"webpack-fix-style-only-entries": "0.5.1", | |||||
"webpack-fix-style-only-entries": "0.6.0", | |||||
"workbox-routing": "5.1.4", | "workbox-routing": "5.1.4", | ||||
"workbox-strategies": "5.1.4", | "workbox-strategies": "5.1.4", | ||||
"worker-loader": "3.0.2", | |||||
"worker-loader": "3.0.5", | |||||
"wrap-ansi": "7.0.0" | "wrap-ansi": "7.0.0" | ||||
}, | }, | ||||
"devDependencies": { | "devDependencies": { | ||||
"eslint": "7.8.1", | |||||
"eslint-plugin-import": "2.22.0", | |||||
"eslint-plugin-unicorn": "21.0.0", | |||||
"stylelint": "13.7.0", | |||||
"eslint": "7.11.0", | |||||
"eslint-plugin-import": "2.22.1", | |||||
"eslint-plugin-unicorn": "23.0.0", | |||||
"stylelint": "13.7.2", | |||||
"stylelint-config-standard": "20.0.0", | "stylelint-config-standard": "20.0.0", | ||||
"svgo": "1.3.2", | "svgo": "1.3.2", | ||||
"updates": "10.3.6" | |||||
"updates": "11.3.0" | |||||
}, | }, | ||||
"browserslist": [ | "browserslist": [ | ||||
"defaults", | "defaults", | ||||
@@ -15,7 +15,7 @@ export const emojiKeys = Object.keys(tempMap).sort((a, b) => { | |||||
return a.localeCompare(b); | return a.localeCompare(b); | ||||
}); | }); | ||||
export const emojiMap = {}; | |||||
const emojiMap = {}; | |||||
for (const key of emojiKeys) { | for (const key of emojiKeys) { | ||||
emojiMap[key] = tempMap[key]; | emojiMap[key] = tempMap[key]; | ||||
} | } | ||||
@@ -25,6 +25,7 @@ import ActivityTopAuthors from './components/ActivityTopAuthors.vue'; | |||||
import {initNotificationsTable, initNotificationCount} from './features/notification.js'; | import {initNotificationsTable, initNotificationCount} from './features/notification.js'; | ||||
import {createCodeEditor} from './features/codeeditor.js'; | import {createCodeEditor} from './features/codeeditor.js'; | ||||
import {svg, svgs} from './svg.js'; | import {svg, svgs} from './svg.js'; | ||||
import {stripTags} from './utils.js'; | |||||
const {AppSubUrl, StaticUrlPrefix, csrf} = window.config; | const {AppSubUrl, StaticUrlPrefix, csrf} = window.config; | ||||
@@ -1325,25 +1326,26 @@ function initWikiForm() { | |||||
element: $editArea[0], | element: $editArea[0], | ||||
forceSync: true, | forceSync: true, | ||||
previewRender(plainText, preview) { // Async method | previewRender(plainText, preview) { // Async method | ||||
// FIXME: still send render request when return back to edit mode | |||||
const render = function () { | |||||
sideBySideChanges = 0; | |||||
if (sideBySideTimeout !== null) { | |||||
clearTimeout(sideBySideTimeout); | |||||
sideBySideTimeout = null; | |||||
} | |||||
$.post($editArea.data('url'), { | |||||
_csrf: csrf, | |||||
mode: 'gfm', | |||||
context: $editArea.data('context'), | |||||
text: plainText, | |||||
wiki: true | |||||
}, (data) => { | |||||
preview.innerHTML = `<div class="markdown ui segment">${data}</div>`; | |||||
renderMarkdownContent(); | |||||
}); | |||||
}; | |||||
setTimeout(() => { | setTimeout(() => { | ||||
// FIXME: still send render request when return back to edit mode | |||||
const render = function () { | |||||
sideBySideChanges = 0; | |||||
if (sideBySideTimeout !== null) { | |||||
clearTimeout(sideBySideTimeout); | |||||
sideBySideTimeout = null; | |||||
} | |||||
$.post($editArea.data('url'), { | |||||
_csrf: csrf, | |||||
mode: 'gfm', | |||||
context: $editArea.data('context'), | |||||
text: plainText, | |||||
wiki: true | |||||
}, (data) => { | |||||
preview.innerHTML = `<div class="markdown ui segment">${data}</div>`; | |||||
renderMarkdownContent(); | |||||
}); | |||||
}; | |||||
if (!simplemde.isSideBySideActive()) { | if (!simplemde.isSideBySideActive()) { | ||||
render(); | render(); | ||||
} else { | } else { | ||||
@@ -3367,10 +3369,6 @@ function initTopicbar() { | |||||
success: false, | success: false, | ||||
results: [], | results: [], | ||||
}; | }; | ||||
const stripTags = function (text) { | |||||
return text.replace(/<[^>]*>?/gm, ''); | |||||
}; | |||||
const query = stripTags(this.urlData.query.trim()); | const query = stripTags(this.urlData.query.trim()); | ||||
let found_query = false; | let found_query = false; | ||||
const current_topics = []; | const current_topics = []; | ||||
@@ -24,13 +24,7 @@ export function uniq(arr) { | |||||
return Array.from(new Set(arr)); | return Array.from(new Set(arr)); | ||||
} | } | ||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | |||||
// generate a random string | |||||
export function random(length) { | |||||
let str = ''; | |||||
for (let i = 0; i < length; i++) { | |||||
str += chars.charAt(Math.floor(Math.random() * chars.length)); | |||||
} | |||||
return str; | |||||
// strip <tags> from a string | |||||
export function stripTags(text) { | |||||
return text.replace(/<[^>]*>?/gm, ''); | |||||
} | } |