Function printFiles
has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring.
function printFiles(fileStat, basePath) {
let text = '';
for (const file of fileStat) {
text += `### ${file.filepath}\n`;
text += `<table>\n`;
Function debounce
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
export function debounce<F extends AnyToAnyFnSignature>(fn: F, wait = 10, thisArg?: object): Debounced<F> {
let timeout: number | null = null;
let deferred: Deferred<ReturnType<F>> | null = null;
function debouncedSubject(...args: any[]): void {
Function loadScript
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
export function loadScript(id: string, src: string, attrs: LoadScriptAttributes = {}): Promise<Event> {
return new Promise((resolve, reject) => {
const script: HTMLScriptElement =
(document.getElementById(id) || createScript(id, src, attrs)) as HTMLScriptElement;
const state = script.getAttribute('state');
Function decorate
has 26 lines of code (exceeds 25 allowed). Consider refactoring.
export function decorate<Args extends any[], Fn extends AnyToAnyFnSignature>(
decorator: (fn: Fn, ...params: Args) => Fn,
...args: Args
) {
return function (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<Fn>): TypedPropertyDescriptor<Fn> {
Function attr
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
export const attr = <T = string>(config: AttrDescriptor<T> = {}): ESLAttributeDecorator => {
return (target: ESLDomElementTarget, propName: string): any => {
const attrName = buildAttrName(config.name || propName, !!config.dataAttr);
const inheritAttrName = typeof config.inherit === 'string' ? config.inherit : attrName;
Function parseKeysPath
has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
const parseKeysPath = (path: string): PathKeyDef[] => {
let start = 0;
const parts: PathKeyDef[] = [];
while (start < path.length) {
Function _onKeyDown
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
@listen({event: 'keydown', target: document})
protected _onKeyDown(e: KeyboardEvent): void | boolean {
if (!this.current || e.key !== TAB) return;
if (this.current.a11y === 'none' || this.current.a11y === 'autofocus') return;