ESLint 命令行

要在Node.js 上运行 ESLint,必须先安装 npm。

安装好npm后,可以运行下列命令:

npm i -g eslint

这表示从npm仓库安装了ESLint CLI。然后继续使用下列命令运行ESLint:

eslint [options] [file|dir|glob]*
示例:
eslint file1.js file2.js

或者:

eslint lib/**

如果想要使用 node 的 glob 语法,需要给参数加上引号,在 windows 系统运行时也可以使用双引号,像下面这样:

eslint "lib/**"

命令选项

使用 ESLint 命令时,我们可以通过eslint -h命令来查看所有的命令行选项:

eslint [options] file.js [file.js] [dir]

Basic configuration:
  --no-eslintrc                   Disable use of configuration from .eslintrc.*
  -c, --config path::String       Use this configuration, overriding .eslintrc.* config
                                  options if present
  --env [String]                  Specify environments
  --ext [String]                  Specify JavaScript file extensions - default: .js
  --global [String]               Define global variables
  --parser String                 Specify the parser to be used
  --parser-options Object         Specify parser options
  --resolve-plugins-relative-to path::String  A folder where plugins should be resolved
                                              from, CWD by default

Specifying rules and plugins:
  --rulesdir [path::String]       Use additiona
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值