Pass eslint

This commit is contained in:
eight04 2021-12-12 23:38:17 +08:00
parent 92573307cd
commit 63e48099ad
8 changed files with 48 additions and 42 deletions

View File

@ -1,2 +0,0 @@
vendor/
vendor-overwrites/

2
.gitignore vendored
View File

@ -4,5 +4,7 @@ pull_locales_login.rb
node_modules/
yarn.lock
*.zip
*.log
*.swp
.eslintcache
.transifexrc

View File

@ -5,6 +5,7 @@
/* global prefs */
/* global preinit */
/* global t */// localization.js
/* global requireOrdered */// polyfill
'use strict';
let cm;

View File

@ -57,5 +57,11 @@
},
"webExt": {
"sourceDir": "dist"
}
},
"eslintIgnore": [
"dist/vendor/**",
"dist/vendor-overwrites/**",
"dist/chunks/*",
"dist/codemirror/*"
]
}

View File

@ -1,19 +1,19 @@
import cjs from "rollup-plugin-cjs-es";
import resolve from "@rollup/plugin-node-resolve";
import iife from "rollup-plugin-iife";
import { terser } from "rollup-plugin-terser";
import output from "rollup-plugin-write-output";
import cjs from 'rollup-plugin-cjs-es';
import resolve from '@rollup/plugin-node-resolve';
import iife from 'rollup-plugin-iife';
import {terser} from 'rollup-plugin-terser';
import output from 'rollup-plugin-write-output';
import escapeRe from 'escape-string-regexp';
export default {
input: {
"codemirror/base": "src/codemirror/base.mjs",
"codemirror/edit": "src/codemirror/edit.mjs"
'codemirror/base': 'src/codemirror/base.mjs',
'codemirror/edit': 'src/codemirror/edit.mjs',
},
output: {
dir: "dist",
chunkFileNames: 'chunks/[name]-[hash].js'
dir: 'dist',
chunkFileNames: 'chunks/[name]-[hash].js',
},
plugins: [
resolve(),
@ -24,17 +24,17 @@ export default {
{
test: /codemirror\/edit\.js/,
target: 'dist/edit.html',
handle: (content, {htmlScripts}) => replaceLine(content, '<!-- codemirror-edit -->', htmlScripts)
handle: (content, {htmlScripts}) => replaceLine(content, '<!-- codemirror-edit -->', htmlScripts),
},
{
test: /codemirror\/base\.js/,
target: 'dist/install-usercss/install-usercss.js',
handle: (content, {scripts}) => replaceLine(content, '// codemirror-base',
JSON.stringify(scripts.map(resolvePath('/install-usercss/install-usercss.js'))))
}
])
JSON.stringify(scripts.map(resolvePath('/install-usercss/install-usercss.js')))),
},
]),
],
preserveEntrySignatures: false
preserveEntrySignatures: false,
};
function resolvePath(base) {
@ -46,5 +46,5 @@ function resolvePath(base) {
}
function replaceLine(content, marker, repl) {
return content.replace(new RegExp(`.*${escapeRe(marker)}`), `${repl} ${marker}`);
return content.replace(new RegExp(`\\S.*${escapeRe(marker)}`), `${repl} ${marker}`);
}

View File

@ -1,14 +1,13 @@
import CodeMirror from "codemirror/lib/codemirror.js";
import "codemirror/mode/css/css.js";
import "codemirror/keymap/sublime.js";
import "codemirror/addon/search/searchcursor.js";
import "codemirror/addon/search/matchesonscrollbar.js";
import "codemirror/addon/fold/foldcode.js";
import "codemirror/addon/fold/foldgutter.js";
import "codemirror/addon/fold/brace-fold.js";
import "codemirror/addon/fold/indent-fold.js";
import "codemirror/addon/fold/comment-fold.js";
import "codemirror/addon/selection/active-line.js";
import CodeMirror from 'codemirror/lib/codemirror.js';
import 'codemirror/mode/css/css.js';
import 'codemirror/keymap/sublime.js';
import 'codemirror/addon/search/searchcursor.js';
import 'codemirror/addon/search/matchesonscrollbar.js';
import 'codemirror/addon/fold/foldcode.js';
import 'codemirror/addon/fold/foldgutter.js';
import 'codemirror/addon/fold/brace-fold.js';
import 'codemirror/addon/fold/indent-fold.js';
import 'codemirror/addon/fold/comment-fold.js';
import 'codemirror/addon/selection/active-line.js';
window.CodeMirror = CodeMirror;

View File

@ -1,10 +1,10 @@
import "./base.mjs";
import "codemirror/mode/stylus/stylus.js";
import "codemirror/addon/dialog/dialog.js";
import "codemirror/addon/scroll/annotatescrollbar.js";
import "codemirror/addon/comment/comment.js";
import "codemirror/addon/edit/closebrackets.js";
import "codemirror/addon/edit/matchbrackets.js";
import "codemirror/addon/lint/lint.js";
import "codemirror/addon/hint/show-hint.js";
import "codemirror/addon/hint/css-hint.js";
import './base.mjs';
import 'codemirror/mode/stylus/stylus.js';
import 'codemirror/addon/dialog/dialog.js';
import 'codemirror/addon/scroll/annotatescrollbar.js';
import 'codemirror/addon/comment/comment.js';
import 'codemirror/addon/edit/closebrackets.js';
import 'codemirror/addon/edit/matchbrackets.js';
import 'codemirror/addon/lint/lint.js';
import 'codemirror/addon/hint/show-hint.js';
import 'codemirror/addon/hint/css-hint.js';