-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[DataGrid] Fix typings and packages assets #339
Conversation
So the solution was to treat @material-ui/x-grid-module as a regular folder? Should we remove its package.json? Also, should we remove the build step from |
Does using https://pkg.csb.dev/mui-org/material-ui-x/commit/93ab1549/@material-ui/data-grid for The reproduction: typescript-issue.zip. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reproduction still fails with the latest commit on my side (https://pkg.csb.dev/mui-org/material-ui-x/commit/b5d0f060/@material-ui/x-grid). If I run yarn lerna:build
locally, I get the following:
$ cat packages/grid/x-grid/dist/x-grid.d.ts
export * from '@material-ui/x-license';
import { GridComponentProps } from '@material-ui/x-grid-modules';
export * from '@material-ui/x-grid-modules';
import { MemoExoticComponent, ForwardRefExoticComponent, RefAttributes } from 'react';
[...]
I have opened mui/material-ui#22697 to have a confirmation of #339 (review) and help iterate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are getting closer:
@material-ui/data-grid
x-grid-data-generator leaks with one of the two packages
$ tsc -p tsconfig.json
node_modules/@material-ui/x-grid-data-generator/dist/esm/x-grid-data-generator.d.ts:1:43 - error TS2307: Cannot find module '@material-ui/x-grid' or its corresponding type declarations.
1 import { CellParams, ColDef, RowId } from '@material-ui/x-grid';
~~~~~~~~~~~~~~~~~~~~~
@material-ui/x-grid
x-license needs to be unbundled and published on npm
$ tsc -p tsconfig.json
node_modules/@material-ui/x-grid/dist/x-grid.d.ts:2:29 - error TS2307: Cannot find module '@material-ui/x-license' or its corresponding type declarations.
2 export { LicenseInfo } from '@material-ui/x-license';
~~~~~~~~~~~~~~~~~~~~~~~~
packages/grid/rollup.config.js
Outdated
}), | ||
typescript({ tsconfig: 'tsconfig.build.json' }), | ||
typescript({ tsconfig: 'tsconfig.json' }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we need two different tsconfig files:
typescript({ tsconfig: 'tsconfig.json' }), | |
typescript({ tsconfig: 'tsconfig.build.json' }), |
One to lint the sources (a.) and a second one to build (b.). For instance, with (a.) we want to lint the end-to-end tests and the TypeScript tests, with (b.) we don't want to build the definitions for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand how the 2 files are used.
Not sure we need the one for linting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why wouldn't we need one for linting? The main reason I see is different include/excludes configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because at the root you specify to lint every files with ts js tsx extensions, with no-emit, and it uses the eslint ignore
same inside packages
the only place it is used it's for the yarn typescript command which is just used to check the test as we exclude them in the build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I wasn't clear. There are two linting stages: eslint and TypeScript. These are complementary. I was referring to the latter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I know:
- lint with eslint is configured at the root and ran with a single command (
yarn eslint
). - lint with TypeScript is run in parallel with Lerna and defined in each package (
yarn typescript
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only place it is used it's for the yarn typescript command which is just used to check the test as we exclude them in the build
yarn typescript
tests all the demos of the documentation, all the end-to-end tests, all the type definition tests. Without this command, we would get silent fails (not reported in the CI).
Where did you run this command from? |
💥 |
I have tried the Lerna release workflow. It doesn't work: https://unpkg.com/browse/@material-next/data-grid@4.0.0-alpha.4/. Tested on my fork. |
#339 (comment) my bad, it works :). On a different note I have noticed that TypeScript isn't linting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only issue I could spot is the missing x-license dependency, otherwise, all good.
🎉 the build is almost green using the latest commit here: mui/material-ui#22697. There is an issue with the import of the |
The reproduction: typescript-issue.zip.
Closes #343
Closes #38