UNPKG

1.38 kBJavaScriptView Raw
1"use strict";
2
3// These validator functions answer the question “Is the config valid?” – return
4// `false` if the options DO conflict with Prettier, and `true` if they don’t.
5
6module.exports = {
7 curly(options) {
8 if (options.length === 0) {
9 return true;
10 }
11
12 const firstOption = options[0];
13 return firstOption !== "multi-line" && firstOption !== "multi-or-nest";
14 },
15
16 "lines-around-comment"(options) {
17 if (options.length === 0) {
18 return false;
19 }
20
21 const firstOption = options[0];
22 return Boolean(
23 firstOption &&
24 firstOption.allowBlockStart &&
25 firstOption.allowBlockEnd &&
26 firstOption.allowObjectStart &&
27 firstOption.allowObjectEnd &&
28 firstOption.allowArrayStart &&
29 firstOption.allowArrayEnd
30 );
31 },
32
33 "no-confusing-arrow"(options) {
34 if (options.length === 0) {
35 return false;
36 }
37
38 const firstOption = options[0];
39 return firstOption ? firstOption.allowParens === false : false;
40 },
41
42 "vue/html-self-closing"(options) {
43 if (options.length === 0) {
44 return false;
45 }
46
47 const firstOption = options[0];
48 return Boolean(
49 firstOption && firstOption.html && firstOption.html.void === "any"
50 // Enable when Prettier supports SVG: https://github.com/prettier/prettier/issues/5322
51 // && firstOption.svg === "any"
52 );
53 },
54};