简体   繁体   English

如何获取.eslintrc.js忽略所有无js文件

[英]How to get .eslintrc.js ignore all none js files

How to configure .eslintr.js to ignore all non-js files? 如何配置.eslintr.js以忽略所有非js文件?

I started a .eslintignore file with the rule !**/*.js but doesn't work. 我使用规则!**/*.js .eslintignore启动了.eslintignore文件,但无效。

You're close. 你很亲密 In the .eslintignore section for negating ( ! ) (emphasis mine): .eslintignore部分中用于排除( ! (强调我的意思):

Lines preceded by ! 行前加! are negated patterns that re-include a pattern that was ignored by an earlier pattern. 是否定的模式,它们重新包含了先前模式忽略的模式。

So, ignore everything (you can use blob, or a specific directory, etc.) and then un-ignore js files: 因此,忽略所有内容(可以使用blob或特定目录等),然后忽略js文件:

src/
!src/**/*.js

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

相关问题 如何使用 allow: 带有 eslintrc.js 的选项 - How to use allow: options with eslintrc.js .eslintrc.js键,带“-”(破折号) - .eslintrc.js keys with “-” (dash) React Native 中的“.eslintrc.js”是什么? - What is “.eslintrc.js” in React Native? 错误:.eslintrc.js 中的 ESLint 配置无效:-意外的顶级属性“文件” - Error: ESLint configuration in .eslintrc.js is invalid: - Unexpected top-level property "files" 必须使用import加载ES Module.eslintrc.js - Must use import to load ES Module .eslintrc.js 在 .eslintrc.js 文件中使用导出默认值而不是 module.exports - Use export default in .eslintrc.js file instead of module.exports env.es6=true 和 parserOptions.ecmaVersion=6 at.eslintrc.js 有什么区别? - What the difference between env.es6=true and parserOptions.ecmaVersion=6 at .eslintrc.js? npm init nuxt-app 结果出现问题“无法加载在‘.eslintrc.js » @nuxtjs/eslint-config’中声明的插件‘unicorn’” - npm init nuxt-app results a problem "Failed to load plugin 'unicorn' declared in '.eslintrc.js » @nuxtjs/eslint-config'" Grunt Concat Task,如何忽略所有.min.js文件? - Grunt Concat Task, how to ignore all .min.js files? TSLint:如何忽略 JS 文件? - TSLint: how to ignore JS files?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM