Browse Source

Update some JS dependencies (#13222)

* 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>
mj-v1.14.3
silverwind 2 years ago
committed by GitHub
parent
commit
58e1e5ba13
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      .eslintrc
  2. 1463
      package-lock.json
  3. 46
      package.json
  4. 2
      web_src/js/features/emoji.js
  5. 42
      web_src/js/index.js
  6. 12
      web_src/js/utils.js

10
.eslintrc

@ -99,7 +99,7 @@ rules:
import/no-amd: [0]
import/no-anonymous-default-export: [0]
import/no-commonjs: [0]
import/no-cycle: [0]
import/no-cycle: [2, {ignoreExternal: true}]
import/no-default-export: [0]
import/no-deprecated: [0]
import/no-dynamic-require: [0]
@ -117,7 +117,7 @@ rules:
import/no-self-import: [2]
import/no-unassigned-import: [0]
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-webpack-loader-syntax: [2]
import/order: [0]
@ -211,7 +211,7 @@ rules:
no-mixed-operators: [0]
no-mixed-spaces-and-tabs: [2]
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-negated-condition: [0]
no-nested-ternary: [0]
@ -336,6 +336,7 @@ rules:
unicorn/explicit-length-check: [0]
unicorn/filename-case: [0]
unicorn/import-index: [0]
unicorn/import-style: [0]
unicorn/new-for-builtins: [2]
unicorn/no-abusive-eslint-disable: [0]
unicorn/no-array-instanceof: [0]
@ -356,11 +357,13 @@ rules:
unicorn/no-useless-undefined: [0]
unicorn/no-zero-fractions: [2]
unicorn/number-literal-case: [0]
unicorn/numeric-separators-style: [0]
unicorn/prefer-add-event-listener: [2]
unicorn/prefer-array-find: [2]
unicorn/prefer-dataset: [2]
unicorn/prefer-event-key: [2]
unicorn/prefer-includes: [2]
unicorn/prefer-math-trunc: [2]
unicorn/prefer-modern-dom-apis: [0]
unicorn/prefer-negative-index: [2]
unicorn/prefer-node-append: [0]
@ -374,6 +377,7 @@ rules:
unicorn/prefer-spread: [0]
unicorn/prefer-starts-ends-with: [2]
unicorn/prefer-string-slice: [0]
unicorn/prefer-ternary: [0]
unicorn/prefer-text-content: [2]
unicorn/prefer-trim-start-end: [2]
unicorn/prefer-type-error: [0]

1463
package-lock.json
File diff suppressed because it is too large
View File

46
package.json

@ -5,37 +5,37 @@
"node": ">= 10.13.0"
},
"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",
"@primer/octicons": "11.0.0",
"add-asset-webpack-plugin": "1.0.0",
"babel-loader": "8.1.0",
"clipboard": "2.0.6",
"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",
"escape-goat": "3.0.0",
"fast-glob": "3.2.4",
"file-loader": "6.1.0",
"file-loader": "6.1.1",
"fomantic-ui": "2.8.7",
"font-awesome": "4.7.0",
"jquery": "3.5.1",
"jquery.are-you-sure": "1.9.0",
"less": "3.12.2",
"less-loader": "7.0.1",
"less-loader": "7.0.2",
"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",
"vue": "2.6.12",
"vue-bar-graph": "1.2.0",
@ -44,20 +44,20 @@
"vue-template-compiler": "2.6.12",
"webpack": "4.44.1",
"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-strategies": "5.1.4",
"worker-loader": "3.0.2",
"worker-loader": "3.0.5",
"wrap-ansi": "7.0.0"
},
"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",
"svgo": "1.3.2",
"updates": "10.3.6"
"updates": "11.3.0"
},
"browserslist": [
"defaults",

2
web_src/js/features/emoji.js

@ -15,7 +15,7 @@ export const emojiKeys = Object.keys(tempMap).sort((a, b) => {
return a.localeCompare(b);
});
export const emojiMap = {};
const emojiMap = {};
for (const key of emojiKeys) {
emojiMap[key] = tempMap[key];
}

42
web_src/js/index.js

@ -25,6 +25,7 @@ import ActivityTopAuthors from './components/ActivityTopAuthors.vue';
import {initNotificationsTable, initNotificationCount} from './features/notification.js';
import {createCodeEditor} from './features/codeeditor.js';
import {svg, svgs} from './svg.js';
import {stripTags} from './utils.js';
const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;
@ -1325,25 +1326,26 @@ function initWikiForm() {
element: $editArea[0],
forceSync: true,
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(() => {
// 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()) {
render();
} else {
@ -3367,10 +3369,6 @@ function initTopicbar() {
success: false,
results: [],
};
const stripTags = function (text) {
return text.replace(/<[^>]*>?/gm, '');
};
const query = stripTags(this.urlData.query.trim());
let found_query = false;
const current_topics = [];

12
web_src/js/utils.js

@ -24,13 +24,7 @@ export function uniq(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, '');
}
Loading…
Cancel
Save