Skip to content

Commit

Permalink
Merge branch 'master' into fix-resize-right-pinned-column
Browse files Browse the repository at this point in the history
  • Loading branch information
romgrk committed Jul 18, 2024
2 parents 0f4363c + 06e1e72 commit 3669e05
Show file tree
Hide file tree
Showing 1,211 changed files with 42,226 additions and 20,004 deletions.
72 changes: 55 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ parameters:
description: Whether to force browserstack usage. We have limited resources on browserstack so the pipeline might decide to skip browserstack if this parameter isn't set to true.
type: boolean
default: false
react-dist-tag:
description: The dist-tag of react to be used
react-version:
description: The version of react to be used
type: string
default: stable
workflow:
Expand All @@ -20,10 +20,10 @@ parameters:

default-job: &default-job
parameters:
react-dist-tag:
description: The dist-tag of react to be used
react-version:
description: The version of react to be used
type: string
default: << pipeline.parameters.react-dist-tag >>
default: << pipeline.parameters.react-version >>
e2e-base-url:
description: The base url for running end-to-end test
type: string
Expand All @@ -33,7 +33,7 @@ default-job: &default-job
PLAYWRIGHT_BROWSERS_PATH: /tmp/pw-browsers
# expose it globally otherwise we have to thread it from each job to the install command
BROWSERSTACK_FORCE: << pipeline.parameters.browserstack-force >>
REACT_DIST_TAG: << parameters.react-dist-tag >>
REACT_VERSION: << parameters.react-version >>
working_directory: /tmp/mui
docker:
- image: cimg/node:18.20
Expand All @@ -59,14 +59,20 @@ commands:
description: 'Set to true if you intend to any browser (for example with playwright).'

steps:
- run:
name: Resolve React version
command: |
node scripts/useReactVersion.mjs
# log a patch for maintainers who want to check out this change
git --no-pager diff HEAD
- when:
condition: << parameters.browsers >>
steps:
- run:
name: Install pnpm package manager
command: |
corepack enable
corepack prepare pnpm@latest-8 --activate
- run:
name: Prepare playwright hash
command: pnpm list --json --filter playwright > /tmp/playwright_info.json
Expand All @@ -91,7 +97,17 @@ commands:
pnpm --version
- run:
name: Install js dependencies
command: pnpm install
command: |
echo "React version $REACT_VERSION"
if [ $REACT_VERSION == "stable" ];
then
echo "pnpm install"
pnpm install
else
echo "pnpm install --no-frozen-lockfile"
pnpm install --no-frozen-lockfile
fi
- when:
condition: << parameters.browsers >>
steps:
Expand All @@ -116,7 +132,7 @@ jobs:
name: Should not have any git not staged
command: git add -A && git diff --exit-code --staged
- run:
name: Check for duplicated packages
name: '`pnpm dedupe` was run?'
command: |
if [[ $(git diff --name-status next | grep pnpm-lock) == "" ]];
then
Expand Down Expand Up @@ -147,7 +163,7 @@ jobs:
command: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${CODECOV_TOKEN} -Z -F "$REACT_DIST_TAG-jsdom"
./codecov -t ${CODECOV_TOKEN} -Z -F "$REACT_VERSION-jsdom"
test_lint:
<<: *default-job
steps:
Expand Down Expand Up @@ -276,15 +292,9 @@ jobs:
command: pnpm test:argos
run_danger:
<<: *default-job
docker:
- image: mcr.microsoft.com/playwright:v1.44.1-focal
environment:
NODE_ENV: development # Needed if playwright is in `devDependencies`
steps:
- checkout
- install_js:
# TODO remove, no needed
browsers: true
- install_js
- run:
name: Run danger on PRs
command: pnpm danger ci --fail-on-errors
Expand Down Expand Up @@ -337,3 +347,31 @@ workflows:
- test_e2e_website:
requires:
- checkout

react-next:
when:
equal: [react-next, << pipeline.parameters.workflow >>]
# triggers:
# - schedule:
# cron: '0 0 * * *'
# filters:
# branches:
# only:
# - master
jobs:
- test_unit:
<<: *default-context
react-version: next
name: test_unit-react@next
- test_browser:
<<: *default-context
react-version: next
name: test_browser-react@next
- test_regressions:
<<: *default-context
react-version: next
name: test_regressions-react@next
- test_e2e:
<<: *default-context
react-version: next
name: test_e2e-react@next
7 changes: 4 additions & 3 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"packages/x-date-pickers",
"packages/x-date-pickers-pro",
"packages/x-charts",
"packages/x-charts-pro",
"packages/x-tree-view"
"packages/x-tree-view",
"packages/x-internals"
],
"publishDirectory": {
"@mui/x-license": "packages/x-license/build",
Expand All @@ -25,7 +25,8 @@
"@mui/x-charts": "packages/x-charts/build",
"@mui/x-charts-pro": "packages/x-charts-pro/build",
"@mui/x-tree-view": "packages/x-tree-view/build",
"@mui/x-tree-view-pro": "packages/x-tree-view-pro/build"
"@mui/x-tree-view-pro": "packages/x-tree-view-pro/build",
"@mui/x-internals": "packages/x-internals/build"
},
"sandboxes": ["/bug-reproductions/x-data-grid"],
"silent": true
Expand Down
70 changes: 67 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,48 @@
const baseline = require('@mui/monorepo/.eslintrc');
const path = require('path');

const chartsPackages = ['x-charts', 'x-charts-pro'];

const dataGridPackages = [
'x-data-grid',
'x-data-grid-pro',
'x-data-grid-premium',
'x-data-grid-generator',
];

const datePickersPackages = ['x-date-pickers', 'x-date-pickers-pro'];

const treeViewPackages = ['x-tree-view', 'x-tree-view-pro'];

// Enable React Compiler Plugin rules globally
const ENABLE_REACT_COMPILER_PLUGIN = process.env.ENABLE_REACT_COMPILER_PLUGIN ?? false;

// Enable React Compiler Plugin rules per package
const ENABLE_REACT_COMPILER_PLUGIN_CHARTS = process.env.ENABLE_REACT_COMPILER_PLUGIN_CHARTS ?? true;
const ENABLE_REACT_COMPILER_PLUGIN_DATA_GRID =
process.env.ENABLE_REACT_COMPILER_PLUGIN_DATA_GRID ?? false;
const ENABLE_REACT_COMPILER_PLUGIN_DATE_PICKERS =
process.env.ENABLE_REACT_COMPILER_PLUGIN_DATE_PICKERS ?? false;
const ENABLE_REACT_COMPILER_PLUGIN_TREE_VIEW =
process.env.ENABLE_REACT_COMPILER_PLUGIN_TREE_VIEW ?? false;

const isAnyReactCompilerPluginEnabled =
ENABLE_REACT_COMPILER_PLUGIN ||
ENABLE_REACT_COMPILER_PLUGIN_CHARTS ||
ENABLE_REACT_COMPILER_PLUGIN_DATA_GRID ||
ENABLE_REACT_COMPILER_PLUGIN_DATE_PICKERS ||
ENABLE_REACT_COMPILER_PLUGIN_TREE_VIEW;

const addReactCompilerRule = (packagesNames, isEnabled) =>
!isEnabled
? []
: packagesNames.map((packageName) => ({
files: [`packages/${packageName}/src/**/*{.ts,.tsx,.js}`],
rules: {
'react-compiler/react-compiler': 'error',
},
}));

// TODO move this helper to @mui/monorepo/.eslintrc
// It needs to know about the parent "no-restricted-imports" to not override them.
const buildPackageRestrictedImports = (packageName, root, allowRootImports = true) => [
Expand Down Expand Up @@ -89,7 +131,11 @@ const buildPackageRestrictedImports = (packageName, root, allowRootImports = tru

module.exports = {
...baseline,
plugins: [...baseline.plugins, 'eslint-plugin-jsdoc'],
plugins: [
...baseline.plugins,
'eslint-plugin-jsdoc',
...(isAnyReactCompilerPluginEnabled ? ['eslint-plugin-react-compiler'] : []),
],
settings: {
'import/resolver': {
webpack: {
Expand All @@ -103,8 +149,21 @@ module.exports = {
*/
rules: {
...baseline.rules,
// TODO move to @mui/monorepo/.eslintrc, codebase is moving away from default exports
...(ENABLE_REACT_COMPILER_PLUGIN ? { 'react-compiler/react-compiler': 'error' } : {}),
// TODO move to @mui/monorepo, codebase is moving away from default exports https://github.com/mui/material-ui/issues/21862
'import/prefer-default-export': 'off',
'import/no-restricted-paths': [
'error',
{
zones: [...chartsPackages, ...datePickersPackages, ...treeViewPackages].map(
(packageName) => ({
target: `./packages/${packageName}/src/**/!(*.test.*|*.spec.*)`,
from: `./packages/${packageName}/src/internals/index.ts`,
message: `Use a more specific import instead. E.g. import { MyInternal } from '../internals/MyInternal';`,
}),
),
},
],
// TODO move rule into the main repo once it has upgraded
'@typescript-eslint/return-await': 'off',
'no-restricted-imports': 'off',
Expand Down Expand Up @@ -133,7 +192,7 @@ module.exports = {
// TODO move to @mui/monorepo/.eslintrc
// TODO Fix <Input> props names to not conflict
'react/jsx-no-duplicate-props': [1, { ignoreCase: false }],
// TOOD move to @mui/monorepo/.eslintrc, these are false positive
// TODO move to @mui/monorepo/.eslintrc, these are false positive
'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
},
overrides: [
Expand Down Expand Up @@ -222,5 +281,10 @@ module.exports = {
...buildPackageRestrictedImports('@mui/x-tree-view', 'x-tree-view', false),
...buildPackageRestrictedImports('@mui/x-tree-view-pro', 'x-tree-view-pro', false),
...buildPackageRestrictedImports('@mui/x-license', 'x-license'),

...addReactCompilerRule(chartsPackages, ENABLE_REACT_COMPILER_PLUGIN_CHARTS),
...addReactCompilerRule(dataGridPackages, ENABLE_REACT_COMPILER_PLUGIN_DATA_GRID),
...addReactCompilerRule(datePickersPackages, ENABLE_REACT_COMPILER_PLUGIN_DATE_PICKERS),
...addReactCompilerRule(treeViewPackages, ENABLE_REACT_COMPILER_PLUGIN_TREE_VIEW),
],
};
2 changes: 1 addition & 1 deletion .github/workflows/cherry-pick-master-to-v6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
if: ${{ contains(github.event.pull_request.labels.*.name, 'needs cherry-pick') && github.event.pull_request.merged == true }}
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: Cherry pick and create the new PR
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cherry-pick-next-to-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
if: ${{ contains(github.event.pull_request.labels.*.name, 'needs cherry-pick') && github.event.pull_request.merged == true }}
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: Cherry pick and create the new PR
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6
uses: github/codeql-action/init@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12
with:
languages: typescript
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -29,4 +29,4 @@ jobs:
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6
uses: github/codeql-action/analyze@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12
7 changes: 3 additions & 4 deletions .github/workflows/l10n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ jobs:
issues: write
steps:
- run: echo "${{ github.actor }}"
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d #v3.0.0
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
version: 8
run_install: false
- name: Use Node.js 20.x
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 20
cache: 'pnpm' # https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
pull-requests: write
steps:
- name: check if prs are dirty
uses: eps1lon/actions-label-merge-conflict@6d74047dcef155976a15e4a124dde2c7fe0c5522 # v3.0.1
uses: eps1lon/actions-label-merge-conflict@1b1b1fcde06a9b3d089f3464c96417961dde1168 # v3.0.2
with:
dirtyLabel: 'PR: out-of-date'
repoToken: '${{ secrets.GITHUB_TOKEN }}'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false

Expand All @@ -44,6 +44,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@9fdb3e49720b44c48891d036bb502feb25684276 # v3.25.6
uses: github/codeql-action/upload-sarif@4fa2a7953630fd2f3fb380f21be14ede0169dd4f # v3.25.12
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/vale-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: errata-ai/vale-action@38bf078c328061f59879b347ca344a718a736018 # v2.1.0
with:
reporter: github-pr-review
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ __diff_output__
/docs/.next
/docs/pages/playground/*
!/docs/pages/playground/tsconfig.json
/docs/.env.local
/docs/export
/test/regressions/screenshots
build
Expand Down
Loading

0 comments on commit 3669e05

Please sign in to comment.