UNPKG

1.6 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 "no-tabs"({ options }) {
43 if (options.length === 0) {
44 return false;
45 }
46
47 const firstOption = options[0];
48 return Boolean(firstOption && firstOption.allowIndentationTabs);
49 },
50
51 "vue/html-self-closing"({ options }) {
52 if (options.length === 0) {
53 return false;
54 }
55
56 const firstOption = options[0];
57 return Boolean(
58 firstOption && firstOption.html && firstOption.html.void === "any"
59 // Enable when Prettier supports SVG: https://github.com/prettier/prettier/issues/5322
60 // && firstOption.svg === "any"
61 );
62 },
63};