Basic Usage
The following examples use MacOS as an example, please replace the corresponding files for other systems.
Example 1: Specify files file1.js
and file2.js
with the default configuration.
#!/bin/bash
./eslint-files-mac-darwin-amd64 -files="file1.js,file2.js"
Example 2: Specify folders src/views
and src/components
.
#!/bin/bash
./eslint-files-mac-darwin-amd64 -folders="/root/app/src/views,/root/app/src/components"
Complex Scenarios
- Specify ESLint configuration file
custom.eslintrc.js
; - Specify accompanying command
--fix
; - Specify files and folders;
- Specify file suffix;
- Add prefix and postfix execution commands.
#!/bin/bash
./eslint-files-mac-darwin-amd64 \
-files="file1.js,file2.js" \
-folders="src/views,src/components" \
-root="/root/app/" \
-esConf="custom.eslintrc.js" \
-esCom="--fix" \
-ext=".js,.ts,.jsx,.vue,.tsx" \
-befCom="echo 'Starting format';" \
-aftCom="echo 'Format completed';"
Parameter Description
Parameter | Description | Default | Example | Required |
---|---|---|---|---|
files |
Specify files, multiple files are separated by , . |
- | file1.js,file2.js |
Optional |
folders |
Specify folders, multiple folders are separated by , . |
- | src/views,src/components |
Optional |
esConf |
Specify ESLint configuration file. | - | custom.eslintrc.js |
Optional |
esCom |
Specify accompanying command. | - | --fix |
Optional |
root |
Specify root directory, used with folders . |
- | /root/app/ |
Optional |
ext |
Specify file suffix. | .js |
.js,.ts,.jsx,.vue |
Optional |
befCom |
Specify prefix execution command. | - | echo 'Starting format'; |
Optional |
aftCom |
Specify postfix execution command. | - | echo 'Format completed'; |
Optional |
filesRang |
Specify the range of files, count the processed and unprocessed files. | - | /root/app/ |
Optional |