wikiplus-highlight 2.21.0 → 2.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.json CHANGED
@@ -3,12 +3,23 @@
3
3
  "browser": true,
4
4
  "es6": true
5
5
  },
6
- "extends": "eslint:recommended",
6
+ "plugins": [
7
+ "promise",
8
+ "es-x",
9
+ "regexp",
10
+ "unicorn",
11
+ "jsdoc"
12
+ ],
13
+ "extends": [
14
+ "eslint:recommended",
15
+ "plugin:promise/recommended",
16
+ "plugin:es-x/no-new-in-es2019",
17
+ "plugin:regexp/recommended",
18
+ "plugin:unicorn/recommended"
19
+ ],
7
20
  "parserOptions": {
8
21
  "ecmaVersion": 9,
9
- "ecmaFeatures": {
10
- "impliedStrict": true
11
- }
22
+ "sourceType": "script"
12
23
  },
13
24
  "globals": {
14
25
  "mw": "readonly",
@@ -21,20 +32,50 @@
21
32
  "*.min.js"
22
33
  ],
23
34
  "rules": {
24
- "array-callback-return": [
35
+ "array-callback-return": 2,
36
+ "no-await-in-loop": 2,
37
+ "no-cond-assign": [
38
+ 2,
39
+ "always"
40
+ ],
41
+ "no-constant-binary-expression": 2,
42
+ "no-constructor-return": 2,
43
+ "no-empty-character-class": 0,
44
+ "no-fallthrough": 2,
45
+ "no-import-assign": 0,
46
+ "no-inner-declarations": [
47
+ 2,
48
+ "both"
49
+ ],
50
+ "no-irregular-whitespace": [
25
51
  2,
26
52
  {
27
- "checkForEach": true
53
+ "skipStrings": false
28
54
  }
29
55
  ],
30
- "no-await-in-loop": 2,
31
- "no-constructor-return": 2,
32
- "no-fallthrough": 1,
33
56
  "no-promise-executor-return": 2,
34
57
  "no-self-compare": 2,
35
58
  "no-template-curly-in-string": 2,
59
+ "no-undef": [
60
+ 2,
61
+ {
62
+ "typeof": true
63
+ }
64
+ ],
36
65
  "no-unmodified-loop-condition": 2,
37
66
  "no-unreachable-loop": 2,
67
+ "no-unsafe-negation": [
68
+ 2,
69
+ {
70
+ "enforceForOrderingRelations": true
71
+ }
72
+ ],
73
+ "no-unused-vars": [
74
+ 2,
75
+ {
76
+ "ignoreRestSiblings": true
77
+ }
78
+ ],
38
79
  "no-use-before-define": [
39
80
  2,
40
81
  {
@@ -42,9 +83,30 @@
42
83
  "variables": false
43
84
  }
44
85
  ],
45
- "require-atomic-updates": 2,
86
+ "require-atomic-updates": [
87
+ 2,
88
+ {
89
+ "allowProperties": true
90
+ }
91
+ ],
92
+ "use-isnan": [
93
+ 2,
94
+ {
95
+ "enforceForIndexOf": true
96
+ }
97
+ ],
98
+ "valid-typeof": [
99
+ 2,
100
+ {
101
+ "requireStringLiterals": true
102
+ }
103
+ ],
104
+ "accessor-pairs": 2,
105
+ "arrow-body-style": 2,
46
106
  "block-scoped-var": 2,
107
+ "camelcase": 2,
47
108
  "class-methods-use-this": 2,
109
+ "consistent-return": 2,
48
110
  "consistent-this": 2,
49
111
  "curly": 2,
50
112
  "default-case": 2,
@@ -52,13 +114,25 @@
52
114
  "default-param-last": 2,
53
115
  "dot-notation":2,
54
116
  "eqeqeq": 2,
117
+ "func-name-matching": [
118
+ 2,
119
+ {
120
+ "considerPropertyDescriptor": true
121
+ }
122
+ ],
55
123
  "func-names": [
56
124
  2,
57
125
  "never"
58
126
  ],
127
+ "func-style": 2,
128
+ "grouped-accessor-pairs": [
129
+ 2,
130
+ "getBeforeSet"
131
+ ],
132
+ "guard-for-in": 2,
59
133
  "multiline-comment-style": 2,
60
134
  "new-cap": [
61
- 1,
135
+ 2,
62
136
  {
63
137
  "capIsNew": false
64
138
  }
@@ -66,6 +140,7 @@
66
140
  "no-alert": 2,
67
141
  "no-array-constructor": 2,
68
142
  "no-bitwise": 2,
143
+ "no-caller": 2,
69
144
  "no-else-return": 2,
70
145
  "no-empty": [
71
146
  2,
@@ -73,28 +148,71 @@
73
148
  "allowEmptyCatch": true
74
149
  }
75
150
  ],
151
+ "no-empty-function": [
152
+ 2,
153
+ {
154
+ "allow": [
155
+ "arrowFunctions"
156
+ ]
157
+ }
158
+ ],
76
159
  "no-eval": 2,
77
160
  "no-extend-native": 2,
161
+ "no-extra-bind": 2,
162
+ "no-extra-boolean-cast": [
163
+ 2,
164
+ {
165
+ "enforceForLogicalOperands": true
166
+ }
167
+ ],
78
168
  "no-floating-decimal": 2,
169
+ "no-implicit-coercion": 2,
170
+ "no-implicit-globals": 2,
79
171
  "no-implied-eval": 2,
172
+ "no-invalid-this": [
173
+ 2,
174
+ {
175
+ "capIsConstructor": false
176
+ }
177
+ ],
80
178
  "no-lone-blocks": 2,
81
179
  "no-lonely-if": 2,
82
180
  "no-loop-func": 2,
83
181
  "no-multi-assign": 2,
84
182
  "no-multi-str": 2,
85
- "no-nested-ternary": 1,
183
+ "no-nested-ternary": 2,
86
184
  "no-new": 2,
87
185
  "no-new-func": 2,
88
186
  "no-new-object": 2,
89
187
  "no-new-wrappers": 2,
90
188
  "no-octal-escape": 2,
91
- "no-param-reassign": 1,
92
- "no-return-assign": 2,
189
+ "no-param-reassign": 2,
190
+ "no-return-assign": [
191
+ 2,
192
+ "always"
193
+ ],
93
194
  "no-return-await": 2,
94
195
  "no-script-url": 2,
95
- "no-sequences": 2,
196
+ "no-sequences": [
197
+ 2,
198
+ {
199
+ "allowInParentheses": false
200
+ }
201
+ ],
96
202
  "no-shadow": 2,
203
+ "no-throw-literal": 2,
97
204
  "no-undef-init": 2,
205
+ "no-underscore-dangle": [
206
+ 2,
207
+ {
208
+ "allow": [
209
+ "_"
210
+ ],
211
+ "enforceInMethodNames": true,
212
+ "enforceInClassFields": true,
213
+ "allowFunctionParams": false
214
+ }
215
+ ],
98
216
  "no-unneeded-ternary": [
99
217
  2,
100
218
  {
@@ -102,6 +220,7 @@
102
220
  }
103
221
  ],
104
222
  "no-unused-expressions": 2,
223
+ "no-useless-call": 2,
105
224
  "no-useless-computed-key": [
106
225
  2,
107
226
  {
@@ -110,7 +229,6 @@
110
229
  ],
111
230
  "no-useless-concat": 2,
112
231
  "no-useless-constructor": 2,
113
- "no-useless-rename": 2,
114
232
  "no-useless-return": 2,
115
233
  "no-var": 2,
116
234
  "no-void": 2,
@@ -119,8 +237,23 @@
119
237
  "operator-assignment": 2,
120
238
  "prefer-arrow-callback": 2,
121
239
  "prefer-const": 2,
122
- "prefer-destructuring": 2,
240
+ "prefer-destructuring": [
241
+ 2,
242
+ {
243
+ "VariableDeclarator": {
244
+ "array": true,
245
+ "object": true,
246
+ "enforceForRenamedProperties": "literal"
247
+ },
248
+ "AssignmentExpression": {
249
+ "array": true,
250
+ "object": true
251
+ }
252
+ }
253
+ ],
123
254
  "prefer-exponentiation-operator": 2,
255
+ "prefer-numeric-literals": 2,
256
+ "prefer-object-has-own": 2,
124
257
  "prefer-object-spread": 2,
125
258
  "prefer-regex-literals": [
126
259
  2,
@@ -130,7 +263,7 @@
130
263
  ],
131
264
  "prefer-rest-params": 2,
132
265
  "prefer-spread": 2,
133
- "prefer-template": 1,
266
+ "prefer-template": 2,
134
267
  "quote-props": [
135
268
  2,
136
269
  "as-needed"
@@ -140,17 +273,30 @@
140
273
  "as-needed"
141
274
  ],
142
275
  "require-await": 2,
276
+ "require-unicode-regexp": 2,
143
277
  "spaced-comment": 2,
278
+ "strict": 2,
144
279
  "symbol-description": 2,
280
+ "vars-on-top": 2,
145
281
  "yoda": 2,
282
+ "array-bracket-newline": [
283
+ 2,
284
+ {
285
+ "multiline": true
286
+ }
287
+ ],
146
288
  "array-bracket-spacing": 2,
289
+ "array-element-newline": [
290
+ 2,
291
+ "consistent"
292
+ ],
147
293
  "arrow-parens": [
148
294
  2,
149
295
  "as-needed"
150
296
  ],
151
297
  "arrow-spacing": 2,
152
- "block-spacing": 2,
153
298
  "brace-style": 2,
299
+ "block-spacing": 2,
154
300
  "comma-dangle": [
155
301
  2,
156
302
  "always-multiline"
@@ -164,6 +310,14 @@
164
310
  ],
165
311
  "eol-last": 2,
166
312
  "func-call-spacing": 2,
313
+ "function-call-argument-newline": [
314
+ 2,
315
+ "consistent"
316
+ ],
317
+ "function-paren-newline": [
318
+ 2,
319
+ "consistent"
320
+ ],
167
321
  "indent": [
168
322
  2,
169
323
  "tab",
@@ -174,21 +328,60 @@
174
328
  "key-spacing": 2,
175
329
  "keyword-spacing": 2,
176
330
  "linebreak-style": 2,
331
+ "lines-around-comment": [
332
+ 2,
333
+ {
334
+ "allowBlockStart": true,
335
+ "ignorePattern": "^\\* @"
336
+ }
337
+ ],
338
+ "lines-between-class-members": [
339
+ 2,
340
+ "always",
341
+ {
342
+ "exceptAfterSingleLine": true
343
+ }
344
+ ],
177
345
  "multiline-ternary": [
178
346
  2,
179
347
  "always-multiline"
180
348
  ],
181
349
  "new-parens": 2,
350
+ "newline-per-chained-call": [
351
+ 2,
352
+ {
353
+ "ignoreChainWithDepth": 4
354
+ }
355
+ ],
182
356
  "no-extra-parens": 2,
183
- "no-multi-spaces": 2,
357
+ "no-multi-spaces": [
358
+ 2,
359
+ {
360
+ "exceptions": {}
361
+ }
362
+ ],
184
363
  "no-multiple-empty-lines": [
185
364
  2,
186
365
  {
187
- "max": 1
366
+ "max": 1,
367
+ "maxBOF": 0
188
368
  }
189
369
  ],
190
370
  "no-trailing-spaces": 2,
191
371
  "no-whitespace-before-property": 2,
372
+ "object-curly-newline": [
373
+ 2,
374
+ {
375
+ "consistent": true
376
+ }
377
+ ],
378
+ "object-curly-spacing": 2,
379
+ "object-property-newline": [
380
+ 2,
381
+ {
382
+ "allowAllPropertiesOnSameLine": true
383
+ }
384
+ ],
192
385
  "operator-linebreak": [
193
386
  2,
194
387
  "before"
@@ -226,6 +419,257 @@
226
419
  "wrap-iife": [
227
420
  2,
228
421
  "inside"
229
- ]
422
+ ],
423
+ "promise/always-return": [
424
+ 2,
425
+ {
426
+ "ignoreLastCallback": true
427
+ }
428
+ ],
429
+ "promise/catch-or-return": [
430
+ 2,
431
+ {
432
+ "allowThen": true
433
+ }
434
+ ],
435
+ "promise/no-multiple-resolved": 2,
436
+ "promise/prefer-await-to-then": 2,
437
+ "es-x/no-regexp-lookbehind-assertions": 2,
438
+ "regexp/no-contradiction-with-assertion": 2,
439
+ "regexp/no-dupe-disjunctions": [
440
+ 2,
441
+ {
442
+ "report": "interesting"
443
+ }
444
+ ],
445
+ "regexp/no-empty-character-class": 2,
446
+ "regexp/no-misleading-unicode-character": 2,
447
+ "regexp/no-missing-g-flag": 2,
448
+ "regexp/no-super-linear-backtracking": 2,
449
+ "regexp/no-super-linear-move": 2,
450
+ "regexp/no-extra-lookaround-assertions": 2,
451
+ "regexp/no-octal": 2,
452
+ "regexp/no-standalone-backslash": 2,
453
+ "regexp/no-useless-character-class": [
454
+ 2,
455
+ {
456
+ "ignores": []
457
+ }
458
+ ],
459
+ "regexp/prefer-escape-replacement-dollar-char": 2,
460
+ "regexp/prefer-quantifier": 2,
461
+ "regexp/prefer-regexp-exec": 2,
462
+ "regexp/prefer-regexp-test": 2,
463
+ "regexp/use-ignore-case": 2,
464
+ "regexp/hexadecimal-escape": 2,
465
+ "regexp/letter-case": [
466
+ 2,
467
+ {
468
+ "unicodeEscape": "uppercase",
469
+ "hexadecimalEscape": "uppercase",
470
+ "controlEscape": "uppercase"
471
+ }
472
+ ],
473
+ "regexp/prefer-character-class": [
474
+ 2,
475
+ {
476
+ "minAlternatives": 2
477
+ }
478
+ ],
479
+ "regexp/prefer-lookaround": 2,
480
+ "unicorn/better-regex": 0,
481
+ "unicorn/catch-error-name": [
482
+ 2,
483
+ {
484
+ "name": "e"
485
+ }
486
+ ],
487
+ "unicorn/consistent-destructuring": [
488
+ 2,
489
+ {
490
+ "exceptions": [
491
+ "mw.loader",
492
+ "mw.config",
493
+ "mw.util",
494
+ "mw.messages",
495
+ "mw.addWikiEditor",
496
+ "mw.libs",
497
+ "$.wikiEditor"
498
+ ]
499
+ }
500
+ ],
501
+ "unicorn/escape-case": 0,
502
+ "unicorn/expiring-todo-comments": 0,
503
+ "unicorn/filename-case": 0,
504
+ "unicorn/import-style": 0,
505
+ "unicorn/no-array-callback-reference": 0,
506
+ "unicorn/no-await-expression-member": 0,
507
+ "unicorn/no-empty-file": 0,
508
+ "unicorn/no-for-loop": 0,
509
+ "unicorn/no-hex-escape": 0,
510
+ "unicorn/no-nested-ternary": 0,
511
+ "unicorn/no-new-array": 0,
512
+ "unicorn/no-new-buffer": 0,
513
+ "unicorn/no-null": 0,
514
+ "unicorn/no-process-exit": 0,
515
+ "unicorn/no-static-only-class": 0,
516
+ "unicorn/no-thenable": 0,
517
+ "unicorn/no-typeof-undefined": [
518
+ 2,
519
+ {
520
+ "checkGlobalVariables": true
521
+ }
522
+ ],
523
+ "unicorn/no-unreadable-array-destructuring": 0,
524
+ "unicorn/no-unused-properties": 2,
525
+ "unicorn/no-useless-undefined": 0,
526
+ "unicorn/numeric-separators-style": 0,
527
+ "unicorn/prefer-array-flat": 0,
528
+ "unicorn/prefer-array-flat-map": 0,
529
+ "unicorn/prefer-export-from": 0,
530
+ "unicorn/prefer-math-trunc": 0,
531
+ "unicorn/prefer-modern-math-apis": 0,
532
+ "unicorn/prefer-module": 0,
533
+ "unicorn/prefer-node-protocol": 0,
534
+ "unicorn/prefer-number-properties": 0,
535
+ "unicorn/prefer-object-from-entries": 0,
536
+ "unicorn/prefer-optional-catch-binding": 0,
537
+ "unicorn/prefer-regexp-test": 0,
538
+ "unicorn/prefer-set-has": 0,
539
+ "unicorn/prefer-set-size": 0,
540
+ "unicorn/prefer-spread": [
541
+ 2,
542
+ {
543
+ "concat": "certain"
544
+ }
545
+ ],
546
+ "unicorn/prefer-string-slice": 0,
547
+ "unicorn/prefer-string-trim-start-end": 0,
548
+ "unicorn/prefer-top-level-await": 0,
549
+ "unicorn/prefer-type-error": 0,
550
+ "unicorn/prevent-abbreviations": 0,
551
+ "unicorn/relative-url-style": [
552
+ 2,
553
+ "always"
554
+ ],
555
+ "unicorn/require-array-join-separator": 0,
556
+ "unicorn/require-number-to-fixed-digits-argument": 0,
557
+ "unicorn/switch-case-braces": [
558
+ 2,
559
+ "avoid"
560
+ ],
561
+ "unicorn/template-indent": 0,
562
+ "jsdoc/check-alignment": 1,
563
+ "jsdoc/check-indentation": 1,
564
+ "jsdoc/check-property-names": 1,
565
+ "jsdoc/check-tag-names": [
566
+ 1,
567
+ {
568
+ "definedTags": [
569
+ "template"
570
+ ]
571
+ }
572
+ ],
573
+ "jsdoc/check-types": 1,
574
+ "jsdoc/multiline-blocks": 1,
575
+ "jsdoc/newline-after-description": [
576
+ 1,
577
+ "never"
578
+ ],
579
+ "jsdoc/no-bad-blocks": [
580
+ 1,
581
+ {
582
+ "preventAllMultiAsteriskBlocks": true
583
+ }
584
+ ],
585
+ "jsdoc/no-multi-asterisks": 1,
586
+ "jsdoc/require-asterisk-prefix": 1,
587
+ "jsdoc/require-description": [
588
+ 1,
589
+ {
590
+ "contexts": [
591
+ "FunctionDeclaration",
592
+ "VariableDeclarator > FunctionExpression",
593
+ "MethodDefinition > FunctionExpression",
594
+ "VariableDeclarator > ArrowFunctionExpression"
595
+ ],
596
+ "exemptedBy": [
597
+ "type"
598
+ ],
599
+ "checkConstructors": false,
600
+ "checkSetters": false
601
+ }
602
+ ],
603
+ "jsdoc/require-hyphen-before-param-description": [
604
+ 1,
605
+ "never"
606
+ ],
607
+ "jsdoc/require-jsdoc": [
608
+ 1,
609
+ {
610
+ "require": {
611
+ "ArrowFunctionExpression": true,
612
+ "ClassDeclaration": true,
613
+ "FunctionDeclaration": true,
614
+ "FunctionExpression": true,
615
+ "MethodDefinition": true
616
+ },
617
+ "exemptEmptyConstructors": true,
618
+ "checkGetters": true,
619
+ "checkSetters": "no-getter"
620
+ }
621
+ ],
622
+ "jsdoc/require-param-description": [
623
+ 1,
624
+ {
625
+ "contexts": [
626
+ "FunctionDeclaration",
627
+ "VariableDeclarator > FunctionExpression",
628
+ "MethodDefinition > FunctionExpression",
629
+ "VariableDeclarator > ArrowFunctionExpression"
630
+ ],
631
+ "exceptions": [
632
+ "cm"
633
+ ]
634
+ }
635
+ ],
636
+ "jsdoc/require-param-name": [
637
+ 1,
638
+ {
639
+ "contexts": [
640
+ "FunctionDeclaration",
641
+ "VariableDeclarator > FunctionExpression",
642
+ "MethodDefinition > FunctionExpression",
643
+ "VariableDeclarator > ArrowFunctionExpression"
644
+ ]
645
+ }
646
+ ],
647
+ "jsdoc/require-param-type": 1,
648
+ "jsdoc/require-param": [
649
+ 1,
650
+ {
651
+ "exceptions": [
652
+ "_"
653
+ ],
654
+ "contexts": [
655
+ "FunctionDeclaration",
656
+ "VariableDeclarator > FunctionExpression",
657
+ "MethodDefinition > FunctionExpression",
658
+ "VariableDeclarator > ArrowFunctionExpression"
659
+ ]
660
+ }
661
+ ],
662
+ "jsdoc/require-property": 1,
663
+ "jsdoc/require-property-description": 1,
664
+ "jsdoc/require-property-name": 1,
665
+ "jsdoc/require-property-type": 1,
666
+ "jsdoc/require-returns-check": [
667
+ 1,
668
+ {
669
+ "exemptAsync": false
670
+ }
671
+ ],
672
+ "jsdoc/require-returns-type": 1,
673
+ "jsdoc/require-throws": 1
230
674
  }
231
675
  }
package/README.md CHANGED
@@ -11,13 +11,13 @@
11
11
  在*个人 JS 页*添加以下代码:
12
12
 
13
13
  ```javascript
14
- mw.loader.load('//cdn.jsdelivr.net/npm/wikiplus-highlight@2.21.0');
14
+ mw.loader.load('//cdn.jsdelivr.net/npm/wikiplus-highlight@2.22.2');
15
15
  ```
16
16
 
17
17
 
18
18
 
19
19
  ```javascript
20
- mw.loader.load('//unpkg.com/wikiplus-highlight@2.21.0/dist/main.min.js');
20
+ mw.loader.load('//unpkg.com/wikiplus-highlight@2.22.2/dist/main.min.js');
21
21
  ```
22
22
 
23
23
  ### 稳定版本