(refactor): Move common options out of JS plugin (#4445)
* (refactor): Move common options out of JS plugin * Add Common category to playground
This commit is contained in:
1 parent
7bc5ec2dc6
commit
ec45dc9a4c
7 files changed
+41
-24
No files matched your search
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
const CATEGORY_COMMON = "Common";
|
||||
|
||||
// format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
|
||||
module.exports = {
|
||||
bracketSpacing: {
|
||||
since: "0.0.0",
|
||||
category: CATEGORY_COMMON,
|
||||
type: "boolean",
|
||||
default: true,
|
||||
description: "Print spaces between brackets.",
|
||||
oppositeDescription: "Do not print spaces between brackets."
|
||||
},
|
||||
singleQuote: {
|
||||
since: "0.0.0",
|
||||
category: CATEGORY_COMMON,
|
||||
type: "boolean",
|
||||
default: false,
|
||||
description: "Use single quotes instead of double quotes."
|
||||
}
|
||||
};
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
const jsOptions = require("../language-js/options");
|
||||
const commonOptions = require("../common/common-options");
|
||||
|
||||
// format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
|
||||
module.exports = {
|
||||
singleQuote: jsOptions.singleQuote
|
||||
singleQuote: commonOptions.singleQuote
|
||||
};
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
const jsOptions = require("../language-js/options");
|
||||
const commonOptions = require("../common/common-options");
|
||||
|
||||
// format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
|
||||
module.exports = {
|
||||
bracketSpacing: jsOptions.bracketSpacing
|
||||
bracketSpacing: commonOptions.bracketSpacing
|
||||
};
|
||||
@@ -1,5 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
const commonOptions = require("../common/common-options");
|
||||
|
||||
const CATEGORY_JAVASCRIPT = "JavaScript";
|
||||
|
||||
// format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
|
||||
@@ -21,14 +23,7 @@ module.exports = {
|
||||
}
|
||||
]
|
||||
},
|
||||
bracketSpacing: {
|
||||
since: "0.0.0",
|
||||
category: CATEGORY_JAVASCRIPT,
|
||||
type: "boolean",
|
||||
default: true,
|
||||
description: "Print spaces between brackets.",
|
||||
oppositeDescription: "Do not print spaces between brackets."
|
||||
},
|
||||
bracketSpacing: commonOptions.bracketSpacing,
|
||||
jsxBracketSameLine: {
|
||||
since: "0.17.0",
|
||||
category: CATEGORY_JAVASCRIPT,
|
||||
@@ -45,13 +40,7 @@ module.exports = {
|
||||
oppositeDescription:
|
||||
"Do not print semicolons, except at the beginning of lines which may need them."
|
||||
},
|
||||
singleQuote: {
|
||||
since: "0.0.0",
|
||||
category: CATEGORY_JAVASCRIPT,
|
||||
type: "boolean",
|
||||
default: false,
|
||||
description: "Use single quotes instead of double quotes."
|
||||
},
|
||||
singleQuote: commonOptions.singleQuote,
|
||||
trailingComma: {
|
||||
since: "0.0.0",
|
||||
category: CATEGORY_JAVASCRIPT,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
const jsOptions = require("../language-js/options");
|
||||
const commonOptions = require("../common/common-options");
|
||||
|
||||
const CATEGORY_MARKDOWN = "Markdown";
|
||||
|
||||
@@ -35,5 +35,5 @@ module.exports = {
|
||||
{ value: true, deprecated: "1.9.0", redirect: "always" }
|
||||
]
|
||||
},
|
||||
singleQuote: jsOptions.singleQuote
|
||||
singleQuote: commonOptions.singleQuote
|
||||
};
|
||||
@@ -659,7 +659,7 @@ exports[`CLI --support-info (stdout) 1`] = `
|
||||
\\"type\\": \\"choice\\"
|
||||
},
|
||||
{
|
||||
\\"category\\": \\"JavaScript\\",
|
||||
\\"category\\": \\"Common\\",
|
||||
\\"default\\": true,
|
||||
\\"description\\": \\"Print spaces between brackets.\\",
|
||||
\\"name\\": \\"bracketSpacing\\",
|
||||
@@ -823,7 +823,7 @@ exports[`CLI --support-info (stdout) 1`] = `
|
||||
\\"type\\": \\"boolean\\"
|
||||
},
|
||||
{
|
||||
\\"category\\": \\"JavaScript\\",
|
||||
\\"category\\": \\"Common\\",
|
||||
\\"default\\": false,
|
||||
\\"description\\": \\"Use single quotes instead of double quotes.\\",
|
||||
\\"name\\": \\"singleQuote\\",
|
||||
|
||||
@@ -15,7 +15,13 @@ import SidebarOptions from "./sidebar/SidebarOptions";
|
||||
import Option from "./sidebar/options";
|
||||
import { Checkbox } from "./sidebar/inputs";
|
||||
|
||||
const CATEGORIES_ORDER = ["Global", "JavaScript", "Markdown", "Special"];
|
||||
const CATEGORIES_ORDER = [
|
||||
"Global",
|
||||
"Common",
|
||||
"JavaScript",
|
||||
"Markdown",
|
||||
"Special"
|
||||
];
|
||||
const ENABLED_OPTIONS = [
|
||||
"parser",
|
||||
"printWidth",
|
||||
|
||||
Reference in new issue
Block a user