diff --git a/packages/create-fes-app/templates/app/h5/.prettierrc b/packages/create-fes-app/templates/app/h5/.prettierrc new file mode 100644 index 00000000..29ed0c41 --- /dev/null +++ b/packages/create-fes-app/templates/app/h5/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "trailingComma": "none" +} \ No newline at end of file diff --git a/packages/create-fes-app/templates/app/pc/.prettierrc b/packages/create-fes-app/templates/app/pc/.prettierrc new file mode 100644 index 00000000..29ed0c41 --- /dev/null +++ b/packages/create-fes-app/templates/app/pc/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "trailingComma": "none" +} \ No newline at end of file diff --git a/packages/fes-plugin-layout/src/node/helper.js b/packages/fes-plugin-layout/src/node/helper.js index a14a01e6..4c39f8f6 100644 --- a/packages/fes-plugin-layout/src/node/helper.js +++ b/packages/fes-plugin-layout/src/node/helper.js @@ -6,7 +6,7 @@ const matchName = (config, name) => { for (let i = 0; i < config.length; i++) { const item = config[i]; if (item.meta && item.meta.name === name) { - res = item.meta || {}; + res = item.meta; res.path = item.path; break; } @@ -68,10 +68,10 @@ export function getIconsFromMenu(data) { return []; } let icons = []; - (data || []).forEach((item = { path: '/' }) => { + data.forEach((item = { path: '/' }) => { if (item.icon) { const { icon } = item; - if (icon && icon.type === 'icon') { + if (icon.type === 'icon') { icons.push(icon.name); } } diff --git a/packages/fes-plugin-qiankun/src/main/modifyRoutes.js b/packages/fes-plugin-qiankun/src/main/modifyRoutes.js index e113728b..62f691d7 100644 --- a/packages/fes-plugin-qiankun/src/main/modifyRoutes.js +++ b/packages/fes-plugin-qiankun/src/main/modifyRoutes.js @@ -45,7 +45,7 @@ function modifyRoutesWithAttachMode({ export default function modifyRoutes({ api, namespace }) { api.modifyRoutes((routes) => { const { router, base } = api.config; - const masterHistoryType = (router && router?.mode) || defaultHistoryType; + const masterHistoryType = (router && router.mode) || defaultHistoryType; modifyRoutesWithAttachMode({ routes, diff --git a/packages/fes-preset-built-in/src/plugins/commands/build/index.js b/packages/fes-preset-built-in/src/plugins/commands/build/index.js index 94ec4a75..ef07f0e0 100644 --- a/packages/fes-preset-built-in/src/plugins/commands/build/index.js +++ b/packages/fes-preset-built-in/src/plugins/commands/build/index.js @@ -39,7 +39,7 @@ export default function (api) { try { // clear output path before exec build if (process.env.CLEAR_OUTPUT !== 'none') { - if (paths.absOutputPath && existsSync(paths.absOutputPath || '')) { + if (paths.absOutputPath && existsSync(paths.absOutputPath)) { logger.debug(`Clear OutputPath: ${paths.absNodeModulesPath}`); rimraf.sync(paths.absOutputPath); } diff --git a/packages/fes-preset-built-in/src/plugins/misc/route/index.js b/packages/fes-preset-built-in/src/plugins/misc/route/index.js index 7e3311af..73cfb844 100644 --- a/packages/fes-preset-built-in/src/plugins/misc/route/index.js +++ b/packages/fes-preset-built-in/src/plugins/misc/route/index.js @@ -163,7 +163,7 @@ const rank = function (routes) { rank(item.children); } }); - routes = routes.sort((a, b) => b.count - a.count); + routes.sort((a, b) => b.count - a.count); }; const getRoutes = function ({ config, absPagesPath }) {