Skip to content
huanghoujin-kavout edited this page Jan 30, 2018 · 11 revisions

FECS 命令参数

fecs

$ fecs --help

$ fecs --version

options

名称 别名 值类型 默认值 说明
help h boolean false 显示帮助信息
version v boolean false 显示 FECS 的版本信息

check

$ fecs [check] [pattern...] [options]

使用 ESLint 检查 JavaScript 代码的质量与风格。

使用 CSSHint 检查 CSS 代码的质量与风格。

使用 HTMLCS 检查 HTML 代码的质量与风格。

pattern

指定 glob 风格的文件查找模式,默认为当前工作目录下的所有 js/css/html,也可以直接指定到具体的文件路径。

options

名称 别名 值类型 默认值 说明
color c boolean true 是否使用颜色高亮
debug -- boolean false 是否允许直接抛出 FECS 的运行时错误
es -- number 6 指定 ecmascript 版本,默认 6 为混合模式,使用 babel-eslint 解释,自动检测代码指纹,当指定为 5 时使用 eslint 默认的 parser,指定为 7 时相当于确定为 esnext
format -- string -- 指定 check 命令的结果输出格式,支持 checkstylejsonxmlhtml,打开 silient 时也不影响输出
ignore -- string -- 指定需要忽略的文件模式,多个模式可以使用多个 --ignore 指定
lookup -- boolean false 是否考虑所有上级目录的配置
level -- number -- 过滤,只剩下指定级别的错误,选值 0、1 或 2
lines -- string -- 过滤,只剩下指定行的错误,以[]() 表示数学上的开区间和闭区间,也可以直接用 ><=的组合,允许多个条件组合,以 && 或 `
maxerr -- number 0 每个文件的最大错误数,默认为 0 表示不限制
maxsize -- number 0 每个文件的最大字节数,默认为 900K, 0 表示不限制
reporter -- string -- 指定 reporter,内置可选值只有 baidu,当包含 / 字符时从当前工作目录查找自定义的 reporter 实现,其它值按默认处理
rule -- boolean false 是否在错误信息最后显示对应的校验规则名称
rules -- string -- 过滤,只剩下指定的 rule 名,多个 rule 以 , 分隔
silent s boolean false 是否隐藏所有通过 console.log 输出的信息
sort -- boolean false 是否对信息按行列作升序排序
stream -- boolean false 是否使用 process.stdin 作为输入
type -- string js,css,html 指定要处理的文件类型,类型之间以 , 分隔

format

$ fecs format [pattern...] [options]

使用 fixmyjsjformatter 修复与格式化 JavaScript 代码。 使用 CSSBeautifyCSScomb 修复与格式化 CSS 代码。 使用 HTMLCS 修复与格式化 HTML 代码。

options

名称 别名 值类型 默认值 说明
debug -- boolean false 是否允许直接抛出 FECS 的运行时错误
fix -- boolean false 是否使用 eslint 的 fix
format -- string -- 指定 check 命令的结果输出格式,支持 JSON,XML 与 HTML,打开 silient 时也不影响输出
ignore -- string -- 指定需要忽略的文件模式,多个模式可以使用多个 --ignore 指定
lookup -- boolean false 是否考虑所有上级目录的配置
output o string ./output 指定格式化后的输出目录
replace -- boolean false 指定格式化后是否替换原文件
silent s boolean false 是否隐藏所有通过 console.log 输出的信息
stream -- boolean false 是否使用 process.stdin 作为输入
type -- string js,css,html 指定要处理的文件类型,类型之间以 , 分隔

index

名称 别名 值类型 默认值 说明
color c boolean true 是否使用颜色高亮
debug -- boolean false 是否允许直接抛出 FECS 的运行时错误
es -- number 6 指定 ecmascript 版本,默认 6 为混合模式,使用 babel-eslint 解释,自动检测代码指纹,当指定为 5 时使用 eslint 默认的 parser,指定为 7 时相当于确定为 esnext
fix -- boolean false 是否使用 eslint 的 fix
format -- string -- 指定 check 命令的结果输出格式,支持 JSON,XML 与 HTML,打开 silient 时也不影响输出
help h boolean false 显示帮助信息
ignore -- string -- 指定需要忽略的文件模式,多个模式可以使用多个 --ignore 指定
lookup -- boolean false 是否考虑所有上级目录的配置
level -- number -- 过滤,只剩下指定级别的错误,选值 0、1 或 2
lines -- string -- 过滤,只剩下指定行的错误,以[]() 表示数学上的开区间和闭区间,也可以直接用 ><
maxerr -- number 0 每个文件的最大错误数,默认为 0 表示不限制
maxsize -- number 0 每个文件的最大字节数,默认为 900K, 0 表示不限制
output o string ./output 指定格式化后的输出目录
replace -- boolean false 指定格式化后是否替换原文件
reporter -- string -- 指定 reporter,内置可选值只有 baidu,当包含 / 字符时从当前工作目录查找自定义的 reporter 实现,其它值按默认处理
rule -- boolean false 是否在错误信息最后显示对应的校验规则名称
rules -- string -- 过滤,只剩下指定的 rule 名,多个 rule 以 , 分隔
silent s boolean false 是否隐藏所有通过 console.log 输出的信息(仅影响 JavaScript 的格式化)
sort -- boolean false 是否对信息按行列作升序排序
stream -- boolean false 是否使用 process.stdin 作为输入
type -- string js,css,html 指定要处理的文件类型,类型之间以 , 分隔
version v boolean false 显示 FECS 的版本信息