How to configure package.json to run eslint script

不问归期 提交于 2019-12-02 17:53:36

eslint "**/*.js" to run on all js files in all the folders recursively (in the current folder)

You can also do: AnyFolder/**/*.js

And to ignore a folder: eslint "**/*.js" --ignore-pattern node_modules/

Know more at eslint/command-line-interface

eslint . --ext .js to lint files with the .js extension in the current directory and all subdirectories.

To include other file extensions, eslint . --ext .js,.jsx or eslint . --ext .js --ext .jsx.

The eslint documentation covers this option.

Saba Ahang

I'm not sure if the accepted answer is outdated, but by looking at the docs,

By default, it uses .js as the only file extension.

Also, according to a member's comment on the project's Github, using . equals running in all subdirectories. It seems to me that running eslint . should suffice (though it doesn't cover the new ES Module .mjs files).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!