mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-19 20:17:06 +02:00
Prettify all JavaScript files (#964)
* Prettify all JavaScript files * Make trailingComma all * Delete v2/.prettierignore * Remove v2 Prettier commands in package.json
This commit is contained in:
parent
a1de6dab04
commit
9d4a5d5359
101 changed files with 441 additions and 473 deletions
|
@ -16,7 +16,7 @@ module.exports = function loadConfig(siteDir, deleteCache = true) {
|
|||
'tagline',
|
||||
'organizationName',
|
||||
'projectName',
|
||||
'baseUrl'
|
||||
'baseUrl',
|
||||
];
|
||||
const optionalFields = [
|
||||
'customDocsPath',
|
||||
|
@ -26,19 +26,19 @@ module.exports = function loadConfig(siteDir, deleteCache = true) {
|
|||
'configureWebpack',
|
||||
'chainWebpack',
|
||||
'docsUrl',
|
||||
'customFields'
|
||||
'customFields',
|
||||
];
|
||||
const missingFields = requiredFields.filter(field => !config[field]);
|
||||
if (missingFields && missingFields.length > 0) {
|
||||
throw new Error(
|
||||
`${missingFields.join(', ')} fields are missing in siteConfig.js`
|
||||
`${missingFields.join(', ')} fields are missing in siteConfig.js`,
|
||||
);
|
||||
}
|
||||
|
||||
/* Fill default value */
|
||||
const defaultConfig = {
|
||||
customDocsPath: 'docs',
|
||||
docsUrl: 'docs'
|
||||
docsUrl: 'docs',
|
||||
};
|
||||
Object.keys(defaultConfig).forEach(field => {
|
||||
if (!config[field]) {
|
||||
|
@ -55,11 +55,11 @@ module.exports = function loadConfig(siteDir, deleteCache = true) {
|
|||
/* We don't allow useless/ not meaningful field */
|
||||
const allowedFields = [...requiredFields, ...optionalFields, ...customFields];
|
||||
const uselessFields = Object.keys(config).filter(
|
||||
field => !allowedFields.includes(field)
|
||||
field => !allowedFields.includes(field),
|
||||
);
|
||||
if (uselessFields && uselessFields.length > 0) {
|
||||
throw new Error(
|
||||
`${uselessFields.join(', ')} fields are useless in siteConfig.js`
|
||||
`${uselessFields.join(', ')} fields are useless in siteConfig.js`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue