chore(docutils): lint

- consolidate some eslint overrides
This commit is contained in:
Christopher Hiller
2023-05-19 13:03:07 -07:00
parent 426830d14a
commit 6aec50b074
5 changed files with 29 additions and 29 deletions
+9 -7
View File
@@ -10,12 +10,6 @@
"files": "packages/*/test/**/*",
"rules": {"func-names": "off"}
},
{
"files": ["packages/*/index.js", "packages/*/scripts/**/*.js", "test/*.js"],
"parserOptions": {
"sourceType": "script"
}
},
{
"files": [
"packages/appium/support.js",
@@ -27,9 +21,17 @@
}
},
{
"files": ["./test/setup.js", "./**/scripts/**/*.js", "./packages/*/index.js"],
"files": [
"./test/setup.js",
"./**/scripts/**/*.js",
"./packages/*/index.js",
"./packages/docutils/bin/appium-docs.js"
],
"rules": {
"@typescript-eslint/no-var-requires": "off"
},
"parserOptions": {
"sourceType": "script"
}
},
{
+2
View File
@@ -75,6 +75,7 @@ export function parseNav(nav: MkDocsYmlNav): ParsedNavData[] {
const queue: QueueItem[] = [{entries, keypath: ''}];
while (queue.length) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const {entries, keypath} = queue.shift()!;
for (const [key, item] of entries) {
if (_.isString(item)) {
@@ -153,6 +154,7 @@ function getRootHeaderKeypath(headerItems: ParsedNavData[], header: string) {
// these are the parts of the keypath of the first item, which will contain the header string. it
// dosn't matter whether we pick the first one or any one; they will all contain the same root
// keypath by definition.
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const rootHeaderKeypathParts = _.toPath(_.first(headerItems)!.keypath);
// this is the keypath up to the header string, inclusive.
+8 -10
View File
@@ -3,28 +3,26 @@
* @module
*/
import findUp from 'find-up';
import YAML from 'yaml';
import readPkg, {NormalizedPackageJson, PackageJson} from 'read-pkg';
import path from 'node:path';
import {JsonValue} from 'type-fest';
import {fs} from '@appium/support';
import findUp from 'find-up';
import * as JSON5 from 'json5';
import _ from 'lodash';
import path from 'node:path';
import _pkgDir from 'pkg-dir';
import {getLogger} from './logger';
import readPkg, {NormalizedPackageJson, PackageJson} from 'read-pkg';
import {JsonValue} from 'type-fest';
import {Application, TypeDocReader} from 'typedoc';
import YAML from 'yaml';
import {
NAME_TYPEDOC_JSON,
NAME_MKDOCS_YML,
NAME_PACKAGE_JSON,
NAME_MKDOCS,
NAME_NPM,
NAME_PACKAGE_JSON,
NAME_PYTHON,
NAME_MIKE,
NAME_TYPEDOC,
NAME_TYPEDOC_JSON,
} from './constants';
import {DocutilsError} from './error';
import {getLogger} from './logger';
import {MkDocsYml} from './model';
const log = getLogger('fs');
+9 -10
View File
@@ -6,20 +6,19 @@
* @module
*/
import figures from 'figures';
import logSymbols from 'log-symbols';
import chalk, {ForegroundColor, BackgroundColor} from 'chalk';
import chalk, {type BackgroundColor, type ForegroundColor} from 'chalk';
import consola, {
logType as LogType,
ConsolaReporterLogObject,
type Consola,
type ConsolaReporterLogObject,
FancyReporter,
FancyReporterOptions,
Consola,
ConsolaOptions,
LogLevel,
type FancyReporterOptions,
type LogLevel,
type logType as LogType,
} from 'consola';
import {DEFAULT_LOG_LEVEL, LogLevelMap} from './constants';
import figures from 'figures';
import _ from 'lodash';
import logSymbols from 'log-symbols';
import {DEFAULT_LOG_LEVEL, LogLevelMap} from './constants';
/**
* This is a reporter for `consola` which uses some extra/custom icons and colors.
+1 -2
View File
@@ -6,7 +6,6 @@
import _ from 'lodash';
import {SpawnOptions, spawn} from 'node:child_process';
import path from 'node:path';
import type {SubProcess} from 'teen_process';
/**
* Computes a relative path, prepending `./`
@@ -26,7 +25,7 @@ export function stopwatch(id: string) {
const start = Date.now();
stopwatch.cache.set(id, start);
return () => {
const result = Date.now() - stopwatch.cache.get(id)!;
const result = Date.now() - (stopwatch.cache.get(id) ?? 0);
stopwatch.cache.delete(id);
return result;
};