Skip to content

Commit 507e709

Browse files
committed
[infra] Migrate to use eslint without airbnb config
1 parent 37bc251 commit 507e709

File tree

48 files changed

+704
-959
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+704
-959
lines changed

docs/data/data-grid/server-side-data/ServerSideTreeDataCustomCache.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const cache: GridDataSourceCache = {
4444

4545
const pageSizeOptions = [5, 10, 50];
4646
const dataSetOptions = {
47-
dataSet: 'Employee' as 'Employee',
47+
dataSet: 'Employee' as const,
4848
rowLength: 1000,
4949
treeData: { maxDepth: 3, groupingField: 'name', averageChildren: 5 },
5050
};

docs/data/data-grid/server-side-data/ServerSideTreeDataErrorHandling.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { useMockServer } from '@mui/x-data-grid-generator';
1717
const pageSizeOptions = [5, 10, 50];
1818
const serverOptions = { useCursorPagination: false };
1919
const dataSetOptions = {
20-
dataSet: 'Employee' as 'Employee',
20+
dataSet: 'Employee' as const,
2121
rowLength: 1000,
2222
treeData: { maxDepth: 3, groupingField: 'name', averageChildren: 5 },
2323
};

docs/pages/x/api/data-grid/grid-api.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@
7474
"isPremiumPlan": true
7575
},
7676
"getCellValue": {
77-
"type": {
78-
"description": "<V extends any = any>(id: GridRowId, field: string) => V"
79-
},
77+
"type": { "description": "<V = any>(id: GridRowId, field: string) => V" },
8078
"required": true
8179
},
8280
"getColumn": {

docs/scripts/api/buildExportsDocumentation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const buildPackageExports = (project: XTypeScriptProject) => {
1818
return {
1919
name,
2020
kind: syntaxKindToSyntaxName[
21+
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
2122
resolveExportSpecifier(symbol, project).declarations?.[0].kind!
2223
],
2324
};
@@ -27,7 +28,6 @@ const buildPackageExports = (project: XTypeScriptProject) => {
2728
writePrettifiedFile(
2829
path.resolve(project.workspaceRoot, `scripts/${project.name}.exports.json`),
2930
JSON.stringify(exports),
30-
project,
3131
);
3232
};
3333

docs/src/modules/utils/useCustomizationPlayground.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ interface Props
145145

146146
/* I use this method to parse whatever component props are passed in and format them for the code example,
147147
so the code example includes the same props as the rendered component. e.g. the views={['month']} */
148-
function formatComponentProps(componentProps?: Object, spacing: number = 1) {
149-
function formatObject(obj: Object, indentLevel = 0, separator = ': '): string {
148+
function formatComponentProps(componentProps?: object, spacing: number = 1) {
149+
function formatObject(obj: object, indentLevel = 0, separator = ': '): string {
150150
const indent = ' '.repeat(indentLevel * 2);
151151

152152
return (Object.keys(obj) as Array<keyof typeof obj>)
@@ -161,7 +161,7 @@ function formatComponentProps(componentProps?: Object, spacing: number = 1) {
161161
return val;
162162
};
163163

164-
const value = obj[key];
164+
const value = obj[key] as object | Array<unknown> | string;
165165
if (typeof value === 'object' && !Array.isArray(value)) {
166166
return `${indent}${key}${separator}${separator === '=' ? '{' : ''}{\n${formatObject(
167167
getValue(value),

docs/src/sw.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
/* eslint-env serviceworker */
22
// https://github.com/airbnb/javascript/issues/1632
3-
/* eslint-disable no-restricted-globals */
43

54
// See https://developer.chrome.com/docs/workbox/remove-buggy-service-workers/
6-
self.addEventListener('install', () => {
5+
globalThis.addEventListener('install', () => {
76
// Skip over the "waiting" lifecycle state, to ensure that our
87
// new service worker is activated immediately, even if there's
98
// another tab open controlled by our older service worker code.
10-
self.skipWaiting();
9+
globalThis.skipWaiting();
1110
});
12-
self.addEventListener('message', () => {
11+
globalThis.addEventListener('message', () => {
1312
// Optional: Get a list of all the current open windows/tabs under
1413
// our service worker's control, and force them to reload.
1514
// This can "unbreak" any open windows/tabs as soon as the new
1615
// service worker activates, rather than users having to manually reload.
17-
self.clients.matchAll({ type: 'window' }).then((windowClients) => {
16+
globalThis.clients.matchAll({ type: 'window' }).then((windowClients) => {
1817
windowClients.forEach((windowClient) => {
1918
windowClient.navigate(windowClient.url);
2019
});

eslint.config.mjs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ export default defineConfig(
165165
'react/jsx-no-duplicate-props': ['warn', { ignoreCase: false }],
166166
// TODO move to @mui/internal-code-infra/eslint, these are false positive
167167
'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
168+
// migration rules
169+
'@typescript-eslint/ban-ts-comment': 'off',
170+
'@typescript-eslint/no-require-imports': 'off',
168171
},
169172
},
170173
// Test start
@@ -412,9 +415,12 @@ export default defineConfig(
412415

413416
{
414417
// TODO: typescript namespaces found to be harmful. Refactor to different patterns. More info: https://github.com/mui/mui-x/pull/19071
415-
ignores: ['packages/x-scheduler/**/*', 'packages/x-virtualizer/**/*'],
418+
files: [
419+
`packages/x-scheduler/src/**/*.${EXTENSION_TS}`,
420+
`packages/x-virtualizer/src/**/*.${EXTENSION_TS}`,
421+
],
416422
rules: {
417-
'@typescript-eslint/no-namespace': 'error',
423+
'@typescript-eslint/no-namespace': 'off',
418424
},
419425
},
420426
);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"@mui/icons-material": "catalog:",
8080
"@mui/internal-bundle-size-checker": "^1.0.9-canary.18",
8181
"@mui/internal-babel-plugin-display-name": "^1.0.4-canary.3",
82-
"@mui/internal-code-infra": "^0.0.2-canary.32",
82+
"@mui/internal-code-infra": "^0.0.2-canary.53",
8383
"@mui/internal-markdown": "^2.0.6",
8484
"@mui/internal-test-utils": "catalog:",
8585
"@mui/material": "catalog:",

packages/x-charts-pro/src/FunnelChart/curves/bump.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable class-methods-use-this */
21
import { FunnelCurveGenerator, CurveOptions, Point } from './curve.types';
32

43
/**

packages/x-charts-pro/src/FunnelChart/curves/linear.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable class-methods-use-this */
21
import { FunnelCurveGenerator, CurveOptions, FunnelPointShape, Point } from './curve.types';
32
import { borderRadiusPolygon } from './borderRadiusPolygon';
43
import { lerpX, lerpY } from './utils';

0 commit comments

Comments
 (0)