Download scripts/vsh/src/lint/index.ts from binhugg3/admin: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/spaces/binhugg3/admin/resolve/main/scripts/vsh/src/lint/index.ts
- Command line
-
hf download hf://spaces/binhugg3/admin/scripts/vsh/src/lint/index.ts
-
curl -L -o index.ts https://huggingface.co/spaces/binhugg3/admin/resolve/main/scripts/vsh/src/lint/index.ts
1.12 kB
| import type { CAC } from 'cac'; | |
| import { execaCommand } from '@vben/node-utils'; | |
| interface LintCommandOptions { | |
| /** | |
| * Format lint problem. | |
| */ | |
| format?: boolean; | |
| } | |
| async function runLint({ format }: LintCommandOptions) { | |
| // process.env.FORCE_COLOR = '3'; | |
| if (format) { | |
| await execaCommand(`stylelint "**/*.{vue,css,less.scss}" --cache --fix`, { | |
| stdio: 'inherit', | |
| }); | |
| await execaCommand(`eslint . --cache --fix`, { | |
| stdio: 'inherit', | |
| }); | |
| await execaCommand(`prettier . --write --cache --log-level warn`, { | |
| stdio: 'inherit', | |
| }); | |
| return; | |
| } | |
| await Promise.all([ | |
| execaCommand(`eslint . --cache`, { | |
| stdio: 'inherit', | |
| }), | |
| execaCommand(`prettier . --ignore-unknown --check --cache`, { | |
| stdio: 'inherit', | |
| }), | |
| execaCommand(`stylelint "**/*.{vue,css,less.scss}" --cache`, { | |
| stdio: 'inherit', | |
| }), | |
| ]); | |
| } | |
| function defineLintCommand(cac: CAC) { | |
| cac | |
| .command('lint') | |
| .usage('Batch execute project lint check.') | |
| .option('--format', 'Format lint problem.') | |
| .action(runLint); | |
| } | |
| export { defineLintCommand }; | |