eslint命令行参数

883 阅读2分钟
eslint [options] file.js [file.js] [dir]

Basic configuration: //基本配置
  --no-eslintrc                  Disable use of configuration from .eslintrc.* //禁止使用来自.eslintrc.*的配置文件
  -c, --config path::String      Use this configuration, overriding .eslintrc.* config options if present //如果存在.eslintrc.*,则使用且重写该配置文件
  --env [String]                 Specify environments //指定环境
  --ext [String]                 Specify JavaScript file extensions - default: .js //指定的JS文件扩展名,默认:.js
  --global [String]              Define global variables //定义全局变量
  --parser String                Specify the parser to be used //指定使用某种解析器
  --parser-options Object        Specify parser options //指定解析参数

Specifying rules and plugins: //指定规则和插件
  --rulesdir [path::String]      Use additional rules from this directory //从该路径使用额外的规则
  --plugin [String]              Specify plugins //指定插件
  --rule Object                  Specify rules//指定规则

Fixing problems://修正问题
  --fix                          Automatically fix problems//自动修复问题
  --fix-dry-run                  Automatically fix problems without saving the changes to the file system//自动修复问题而不保存对文件系统的更改

Ignoring files: //忽略文件
  --ignore-path path::String     Specify path of ignore file //指定忽略的文件
  --no-ignore                    Disable use of ignore files and patterns //禁止使用忽略文件和样式
  --ignore-pattern [String]      Pattern of files to ignore (in addition to those in .eslintignore) //要忽略的文件模式(除了在.eslintignore中的文件)

Using stdin: //unix]标准输入(设备)文件
  --stdin                        Lint code provided on <STDIN> - default: false
  --stdin-filename String        Specify filename to process STDIN as //指定用于处理stdin的文件名

Handling warnings://处理警告
  --quiet                        Report errors only - default: false //仅以错误报告出来
  --max-warnings Int             Number of warnings to trigger nonzero exit code - default: -1 //要触发非零退出代码的警告数-默认值:-1
 
Output:
  -o, --output-file path::String  Specify file to write report to //指定输出的文件路径
  -f, --format String            Use a specific output format - default: stylish //使用特定的输出格式-默认:stylish
  --color, --no-color            Force enabling/disabling of color

Inline configuration comments: //内联配置注释
  --no-inline-config             Prevent comments from changing config or rules //阻止注释更改配置或规则
  --report-unused-disable-directives  Adds reported errors for unused eslint-disable directives //为未使用的eslint disable指令添加报告的错误

Caching:
  --cache                        Only check changed files - default: false //仅仅检查改变过的文件
  --cache-file path::String      Path to the cache file. Deprecated: use --cache-location - default: .eslintcache//缓存文件的路径。已弃用:使用--缓存位置-默认值:.eslintcache
  --cache-location path::String  Path to the cache file or directory//缓存文件或文件夹的路径

Miscellaneous://其他
  --init                         Run config initialization wizard - default: false //运行配置初始化向导-默认值:false
  --debug                        Output debugging information//输出调试信息
  -h, --help                     Show help 
  -v, --version                  Output the version number
  --print-config path::String    Print the configuration for the given file//打印给定文件的配置