Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Lint next.config.js #11514

Merged
merged 1 commit into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions docs/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// @ts-check
const path = require('path');
// @ts-ignore
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
// const withTM = require('next-transpile-modules')(['@mui/monorepo']);
// @ts-expect-error This expected error should be gone once we update the monorepo
const withDocsInfra = require('@mui/monorepo/docs/nextConfigDocsInfra');
const pkg = require('../package.json');
const dataGridPkg = require('../packages/grid/x-data-grid/package.json');
Expand All @@ -16,18 +19,18 @@ module.exports = withDocsInfra({
// Avoid conflicts with the other Next.js apps hosted under https://mui.com/
assetPrefix: process.env.DEPLOY_ENV === 'development' ? undefined : '/x',
env: {
// docs-infra
LIB_VERSION: pkg.version,
SOURCE_CODE_REPO: 'https://github.com/mui/mui-x',
SOURCE_GITHUB_BRANCH: 'next', // #default-branch-switch
GITHUB_TEMPLATE_DOCS_FEEDBACK: '6.docs-feedback.yml',
// MUI X related
DATA_GRID_VERSION: dataGridPkg.version,
DATE_PICKERS_VERSION: datePickersPkg.version,
CHARTS_VERSION: chartsPkg.version,
TREE_VIEW_VERSION: treeViewPkg.version,
FEEDBACK_URL: process.env.FEEDBACK_URL,
CONTEXT: process.env.CONTEXT,
// #default-branch-switch
SOURCE_GITHUB_BRANCH: 'next',
SOURCE_CODE_REPO: 'https://github.com/mui/mui-x',
GITHUB_TEMPLATE_DOCS_FEEDBACK: '6.docs-feedback.yml',
},
// @ts-ignore
webpack: (config, options) => {
const plugins = config.plugins.slice();

Expand Down Expand Up @@ -111,16 +114,19 @@ module.exports = withDocsInfra({
const pages = findPages();
const map = {};

// @ts-ignore
function traverse(pages2, userLanguage) {
const prefix = userLanguage === 'en' ? '' : `/${userLanguage}`;

// @ts-ignore
pages2.forEach((page) => {
// The experiments pages are only meant for experiments, they shouldn't leak to production.
if (page.pathname.includes('/experiments/') && process.env.DEPLOY_ENV === 'production') {
return;
}

if (!page.children) {
// @ts-ignore
map[`${prefix}${page.pathname.replace(/^\/api-docs\/(.*)/, '/api/$1')}`] = {
page: page.pathname,
query: {
Expand Down
1 change: 1 addition & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"pages/**/*.ts*",
"data/**/*",
"src/modules/components/**/*",
"next.config.js",
"../node_modules/@mui/material/themeCssVarsAugmentation",
"../node_modules/dayjs/plugin/utc.d.ts",
"../node_modules/dayjs/plugin/timezone.d.ts",
Expand Down