From d7854cd02c12348fc19d96758bb9653cfca809a2 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Sun, 18 Aug 2019 14:09:12 +0800 Subject: [PATCH] Make linter happy Signed-off-by: Yukai Huang --- public/js/lib/editor/markdown-lint/index.js | 13 +++++++------ webpack.common.js | 5 +++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/public/js/lib/editor/markdown-lint/index.js b/public/js/lib/editor/markdown-lint/index.js index 24400595..f8fbfc2e 100644 --- a/public/js/lib/editor/markdown-lint/index.js +++ b/public/js/lib/editor/markdown-lint/index.js @@ -1,13 +1,14 @@ +/* global CodeMirror */ import markdownlint from 'markdownlint' // load CM lint plugin explicitly -import 'script-loader!@hackmd/codemirror/addon/lint/lint' +import '@hackmd/codemirror/addon/lint/lint' import './lint.css' -(function(mod) { - mod(CodeMirror); -})(function(CodeMirror) { - function validator(text) { +(function (mod) { + mod(CodeMirror) +})(function (CodeMirror) { + function validator (text) { return lint(text).map(error => { const { ruleNames, @@ -17,7 +18,7 @@ import './lint.css' } = error const lineNumber = ln - 1 - let start = 0, end = -1 + let start = 0; let end = -1 if (errorRange) { [start, end] = errorRange.map(r => r - 1) } diff --git a/webpack.common.js b/webpack.common.js index cd5b5338..bd61b9bf 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -464,6 +464,11 @@ module.exports = { loader: 'url-loader', options: { limit: '10000', mimetype: 'image/gif' } }] + }, { + test: /@hackmd\/codemirror\/addon\/lint\/lint/, + use: [{ + loader: 'script-loader' + }] }] }, node: {