简体   繁体   English

json文件的Eslint规则

[英]Eslint rules for json files

I try to implement eslint rules for json files, like I have rule: "quotes": ["error", "single"] but I don't want this rule to concern json files, only ts/tsx/js/jsx files.我尝试为 json 文件实施 eslint 规则,就像我有规则:“quotes”:[“error”,“single”] 但我不希望此规则涉及 json 文件,仅涉及 ts/tsx/js/jsx 文件. how can I specify rules for special formats?如何指定特殊格式的规则?

I try to remove json format from src but it's not a solution我尝试从 src 中删除 json 格式,但这不是解决方案

https://eslint.org/docs/latest/user-guide/command-line-interface#-ext suggests: https://eslint.org/docs/latest/user-guide/command-line-interface#-ext建议:

# Use both .js and .ts
npx eslint . --ext .js --ext .ts

# Also use both .js and .ts
npx eslint . --ext .js,.ts

so in your case:所以在你的情况下:

npx eslint ./src --ext .ts,.tsx,.js,.jsx 

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

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