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

[test] Add missing types linting for x-grid #357

Merged
merged 2 commits into from
Oct 1, 2020
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
2 changes: 1 addition & 1 deletion packages/grid/data-grid/src/DataGrid.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react/forbid-foreign-prop-types */
import * as React from 'react';
import PropTypes from 'prop-types';
// @ts-ignore
// @ts-expect-error need to migrate helpers to TypeScript
import { createClientRender, ErrorBoundary } from 'test/utils';
import { expect } from 'chai';
import { DataGrid } from '@material-ui/data-grid';
Expand Down
11 changes: 6 additions & 5 deletions packages/grid/x-grid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
"datagrid",
"data-grid"
],
"scripts": {
"precommit": "npm run lint",
"lint": "../../../node_modules/.bin/tsc --noEmit && eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../../.eslintrc.js && npm run lint:css",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it's still useful the lint script here, if we need to lint from the root folder

Copy link
Member Author

@oliviertassinari oliviertassinari Sep 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No strong preferences. We lint eslint from the root but typescript from each package. I personally never run eslint from the CLI (always in the CI and IDE). I run TypeScript from time to time in the CLI and in nested folders as it has cross-file dependencies. Happy to only have eslint at the root.

"lint:css": "stylelint 'src/**/*.{ts,tsx}' ../../../.stylelintrc.js",
"typescript": "tsc -p tsconfig.json"
},
"dependencies": {
"@material-ui/x-license": "^4.0.0-alpha.6",
"prop-types": "^15.7.2",
Expand All @@ -34,11 +40,6 @@
"@material-ui/core": "^4.9.12",
"react": "^16.8.0"
},
"scripts": {
"precommit": "npm run lint",
"lint": "../../../node_modules/.bin/tsc --noEmit && eslint 'src/**/*.{ts,tsx}' --quiet --fix -c ../../../.eslintrc.js && npm run lint:css",
"lint:css": "stylelint 'src/**/*.{ts,tsx}' ../../../.stylelintrc.js"
},
"setupFiles": [
"<rootDir>/src/setupTests.js"
],
Expand Down
3 changes: 2 additions & 1 deletion packages/grid/x-grid/src/XGrid.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
// @ts-expect-error need to migrate helpers to TypeScript
import { screen, createClientRender, act, fireEvent } from 'test/utils';
import { expect } from 'chai';
import { XGrid, useApiRef } from '@material-ui/x-grid';
Expand Down Expand Up @@ -74,7 +75,7 @@ describe('<XGrid />', () => {
// Adapation of describeConformance()
describe('Material-UI component API', () => {
it(`attaches the ref`, () => {
const ref = React.createRef();
const ref = React.createRef<HTMLDivElement>();
const { container } = render(
<div style={{ width: 300, height: 300 }}>
<XGrid {...defaultProps} ref={ref} />
Expand Down