chore: add new lint rules
This commit is contained in:
parent
1ec3e638a5
commit
f63f02045e
5 changed files with 8 additions and 5 deletions
|
@ -656,6 +656,7 @@ rules:
|
||||||
unicorn/catch-error-name: [0]
|
unicorn/catch-error-name: [0]
|
||||||
unicorn/consistent-destructuring: [2]
|
unicorn/consistent-destructuring: [2]
|
||||||
unicorn/consistent-empty-array-spread: [2]
|
unicorn/consistent-empty-array-spread: [2]
|
||||||
|
unicorn/consistent-existence-index-check: [2]
|
||||||
unicorn/consistent-function-scoping: [2]
|
unicorn/consistent-function-scoping: [2]
|
||||||
unicorn/custom-error-definition: [0]
|
unicorn/custom-error-definition: [0]
|
||||||
unicorn/empty-brace-spaces: [2]
|
unicorn/empty-brace-spaces: [2]
|
||||||
|
@ -732,10 +733,12 @@ rules:
|
||||||
unicorn/prefer-dom-node-text-content: [2]
|
unicorn/prefer-dom-node-text-content: [2]
|
||||||
unicorn/prefer-event-target: [2]
|
unicorn/prefer-event-target: [2]
|
||||||
unicorn/prefer-export-from: [0]
|
unicorn/prefer-export-from: [0]
|
||||||
|
unicorn/prefer-global-this: [0]
|
||||||
unicorn/prefer-includes: [2]
|
unicorn/prefer-includes: [2]
|
||||||
unicorn/prefer-json-parse-buffer: [0]
|
unicorn/prefer-json-parse-buffer: [0]
|
||||||
unicorn/prefer-keyboard-event-key: [2]
|
unicorn/prefer-keyboard-event-key: [2]
|
||||||
unicorn/prefer-logical-operator-over-ternary: [2]
|
unicorn/prefer-logical-operator-over-ternary: [2]
|
||||||
|
unicorn/prefer-math-min-max: [2]
|
||||||
unicorn/prefer-math-trunc: [2]
|
unicorn/prefer-math-trunc: [2]
|
||||||
unicorn/prefer-modern-dom-apis: [0]
|
unicorn/prefer-modern-dom-apis: [0]
|
||||||
unicorn/prefer-modern-math-apis: [2]
|
unicorn/prefer-modern-math-apis: [2]
|
||||||
|
|
|
@ -363,7 +363,7 @@ class ComboMarkdownEditor {
|
||||||
const lineStart = Math.max(0, value.lastIndexOf('\n', start - 1) + 1);
|
const lineStart = Math.max(0, value.lastIndexOf('\n', start - 1) + 1);
|
||||||
// Find the end and extract the line.
|
// Find the end and extract the line.
|
||||||
const lineEnd = value.indexOf('\n', start);
|
const lineEnd = value.indexOf('\n', start);
|
||||||
const line = value.slice(lineStart, lineEnd < 0 ? value.length : lineEnd);
|
const line = value.slice(lineStart, lineEnd === -1 ? value.length : lineEnd);
|
||||||
// Match any whitespace at the start + any repeatable prefix + exactly one space after.
|
// Match any whitespace at the start + any repeatable prefix + exactly one space after.
|
||||||
const prefix = line.match(/^\s*((\d+)[.)]\s|[-*+]\s+(\[[ x]\]\s?)?|(>\s+)+)?/);
|
const prefix = line.match(/^\s*((\d+)[.)]\s|[-*+]\s+(\[[ x]\]\s?)?|(>\s+)+)?/);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Source {
|
||||||
|
|
||||||
deregister(port) {
|
deregister(port) {
|
||||||
const portIdx = this.clients.indexOf(port);
|
const portIdx = this.clients.indexOf(port);
|
||||||
if (portIdx < 0) {
|
if (portIdx === -1) {
|
||||||
return this.clients.length;
|
return this.clients.length;
|
||||||
}
|
}
|
||||||
this.clients.splice(portIdx, 1);
|
this.clients.splice(portIdx, 1);
|
||||||
|
|
|
@ -3,13 +3,13 @@ import {encode, decode} from 'uint8-to-base64';
|
||||||
// transform /path/to/file.ext to file.ext
|
// transform /path/to/file.ext to file.ext
|
||||||
export function basename(path = '') {
|
export function basename(path = '') {
|
||||||
const lastSlashIndex = path.lastIndexOf('/');
|
const lastSlashIndex = path.lastIndexOf('/');
|
||||||
return lastSlashIndex < 0 ? path : path.substring(lastSlashIndex + 1);
|
return lastSlashIndex === -1 ? path : path.substring(lastSlashIndex + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// transform /path/to/file.ext to .ext
|
// transform /path/to/file.ext to .ext
|
||||||
export function extname(path = '') {
|
export function extname(path = '') {
|
||||||
const lastPointIndex = path.lastIndexOf('.');
|
const lastPointIndex = path.lastIndexOf('.');
|
||||||
return lastPointIndex < 0 ? '' : path.substring(lastPointIndex);
|
return lastPointIndex === -1 ? '' : path.substring(lastPointIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// test whether a variable is an object
|
// test whether a variable is an object
|
||||||
|
|
|
@ -155,7 +155,7 @@ export function autosize(textarea, {viewportMarginBottom = 0} = {}) {
|
||||||
const isBorderBox = computedStyle.boxSizing === 'border-box';
|
const isBorderBox = computedStyle.boxSizing === 'border-box';
|
||||||
const borderAddOn = isBorderBox ? topBorderWidth + bottomBorderWidth : 0;
|
const borderAddOn = isBorderBox ? topBorderWidth + bottomBorderWidth : 0;
|
||||||
|
|
||||||
const adjustedViewportMarginBottom = bottom < viewportMarginBottom ? bottom : viewportMarginBottom;
|
const adjustedViewportMarginBottom = Math.min(bottom, viewportMarginBottom);
|
||||||
const curHeight = parseFloat(computedStyle.height);
|
const curHeight = parseFloat(computedStyle.height);
|
||||||
const maxHeight = curHeight + bottom - adjustedViewportMarginBottom;
|
const maxHeight = curHeight + bottom - adjustedViewportMarginBottom;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue