简体   繁体   English

Eslint 忽略所有 exept js 文件

[英]Eslint ignore all exept js fles

How can I ignore all files in the directory scr/ except the .js files?如何忽略目录scr/中除.js文件之外的所有文件? (using a .eslintignore file) (使用.eslintignore文件)

I tried using我尝试使用

scr/*
!scr/*.js

A single star * only matches filenames, if you have directories you'll need to be using ** as part of the match:单个星*仅匹配文件名,如果您有目录,则需要使用**作为匹配的一部分:

# Exclude **/scr/
scr/
# ...but not **/scr/**/*.js
!scr/**/*.js

In this case it might be easier to target javascript files instead of trying to ignore all other files.在这种情况下,以 javascript 文件为目标可能比尝试忽略所有其他文件更容易。 Something like eslint scr/**/*.jseslint scr/**/*.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM