简体   繁体   中英

Correct YAML for Eslint - Value should NOT have more than 1 items - no-multiple-empty-lines

I am using Eslint on an existing project and the eslintrc is a YAML file; a format I'm not that familiar with. I am trying to set the rule no-multiple-empty-lines and having some success, but I get this error once I try to add multiple values to the rule as per documentation.

The rule: https://eslint.org/docs/rules/no-multiple-empty-lines gets three options which can be set max , maxBOF , and maxEOF

So I am trying to set it as such:

 rules: no-multiple-empty-lines: - error - max: 1 - maxBOF: 0 

The error I am getting is:

.eslintrc.yaml: Configuration for rule "no-multiple-empty-lines" is invalid: Value [{"maxBOF":0},{"max":1}] should NOT have more than 1 items.

From my understanding the first line is error/warn but the second is the options.

How do I set multiple options correctly on the second indent so that I can have both maxBOF and max without throwing an error?

The correct way to set multiple options is without additional - , you can pass a map to a list as I found here: Idiot's Guide to YAML

 rules: no-multiple-empty-lines: - error - max: 1 maxBOF: 0 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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