Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 1x 1x 1x 1x 1x 1x 1x 1x 4x 1x 1x 1x 1x 1x 1x 1x 1x | import { log } from 'helpers-fn' import { execPrettier } from 'lint-fn' import { any, endsWith, flip, switcher } from 'rambdax' import { prettyHtml } from './pretty-html' import { sortPackageJson } from './sort-package-json/sort-package-json' const lintMethods = { sortPackageJson, prettyHtml, usePrettier, } const lintOnlyList = [ '.html', '.scss', '.css', 'package.json' ] export function isLintOnlyMode(filePath: string){ return any(flip(endsWith)(filePath), lintOnlyList) } async function usePrettier(filePath: string){ const printWidth = filePath.endsWith('.html') ? 40 : 35 const injectOptions = `--print-width ${ printWidth }` await execPrettier({ filePath, injectOptions, }) log(`${ filePath } linted with Prettier`, 'info') } export async function lintOnlyMode(filePath: string){ console.log('lintOnlyMode', filePath) const lintMethodKey = switcher<string>(filePath) .is((x: string) => x.endsWith('package.json'), 'sortPackageJson') .is((x: string) => x.endsWith('.html'), 'prettyHtml') .default('usePrettier') const lintMethod = (lintMethods as any)[ lintMethodKey ] const lintResult = await lintMethod(filePath) return lintResult } |