eslint fixes
This commit is contained in:
parent
ad56a22277
commit
6ad9208119
14
src/docs.mts
14
src/docs.mts
|
@ -36,10 +36,9 @@ import { globby } from 'globby';
|
||||||
import { JSDOM } from 'jsdom';
|
import { JSDOM } from 'jsdom';
|
||||||
import type { Code, Root } from 'mdast';
|
import type { Code, Root } from 'mdast';
|
||||||
import { join, dirname } from 'path';
|
import { join, dirname } from 'path';
|
||||||
// @ts-ignore
|
|
||||||
import prettier from 'prettier';
|
import prettier from 'prettier';
|
||||||
import { remark } from 'remark';
|
import { remark } from 'remark';
|
||||||
// @ts-ignore
|
// @ts-ignore No typescript declaration file
|
||||||
import flatmap from 'unist-util-flatmap';
|
import flatmap from 'unist-util-flatmap';
|
||||||
|
|
||||||
const SOURCE_DOCS_DIR = 'src/docs';
|
const SOURCE_DOCS_DIR = 'src/docs';
|
||||||
|
@ -90,9 +89,8 @@ const changeToFinalDocDir = (file: string): string => {
|
||||||
* @param {boolean} wasCopied Whether or not the file was copied
|
* @param {boolean} wasCopied Whether or not the file was copied
|
||||||
*/
|
*/
|
||||||
const logWasOrShouldBeTransformed = (filename: string, wasCopied: boolean) => {
|
const logWasOrShouldBeTransformed = (filename: string, wasCopied: boolean) => {
|
||||||
let changeMsg: string;
|
const changeMsg = wasCopied ? LOGMSG_TRANSFORMED : LOGMSG_TO_BE_TRANSFORMED;
|
||||||
let logMsg: string;
|
let logMsg: string;
|
||||||
changeMsg = wasCopied ? LOGMSG_TRANSFORMED : LOGMSG_TO_BE_TRANSFORMED;
|
|
||||||
logMsg = ` File ${changeMsg}: ${filename}`;
|
logMsg = ` File ${changeMsg}: ${filename}`;
|
||||||
if (wasCopied) {
|
if (wasCopied) {
|
||||||
logMsg += LOGMSG_COPIED;
|
logMsg += LOGMSG_COPIED;
|
||||||
|
@ -106,15 +104,11 @@ const logWasOrShouldBeTransformed = (filename: string, wasCopied: boolean) => {
|
||||||
* messages to the console.
|
* messages to the console.
|
||||||
*
|
*
|
||||||
* @param {string} filename Name of the file that will be verified
|
* @param {string} filename Name of the file that will be verified
|
||||||
* @param {string} [transformedContent] New contents for the file
|
|
||||||
* @param {boolean} [doCopy=false] Whether we should copy that transformedContents to the final
|
* @param {boolean} [doCopy=false] Whether we should copy that transformedContents to the final
|
||||||
* documentation directory. Default is `false`
|
* documentation directory. Default is `false`
|
||||||
|
* @param {string} [transformedContent] New contents for the file
|
||||||
*/
|
*/
|
||||||
const copyTransformedContents = (
|
const copyTransformedContents = (filename: string, doCopy = false, transformedContent?: string) => {
|
||||||
filename: string,
|
|
||||||
doCopy: boolean = false,
|
|
||||||
transformedContent?: string
|
|
||||||
) => {
|
|
||||||
const fileInFinalDocDir = changeToFinalDocDir(filename);
|
const fileInFinalDocDir = changeToFinalDocDir(filename);
|
||||||
const existingBuffer = existsSync(fileInFinalDocDir)
|
const existingBuffer = existsSync(fileInFinalDocDir)
|
||||||
? readFileSync(fileInFinalDocDir)
|
? readFileSync(fileInFinalDocDir)
|
||||||
|
|
Loading…
Reference in New Issue