forked from mui/mui-x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
143 lines (142 loc) · 4.17 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
const baseline = require('@mui/monorepo/.eslintrc');
const path = require('path');
module.exports = {
...baseline,
plugins: [...baseline.plugins, 'jsdoc', 'filenames'],
settings: {
'import/resolver': {
webpack: {
config: path.join(__dirname, './webpackBaseConfig.js'),
},
},
},
/**
* Sorted alphanumerically within each group. built-in and each plugin form
* their own groups.
*/
rules: {
...baseline.rules,
'import/prefer-default-export': 'off',
// TODO move rule into the main repo once it has upgraded
'@typescript-eslint/return-await': 'off',
// TODO move rule into main repo to allow deep @mui/monorepo imports
'no-restricted-imports': 'off',
'jsdoc/require-param': ['error', { contexts: ['TSFunctionType'] }],
'jsdoc/require-param-type': ['error', { contexts: ['TSFunctionType'] }],
'jsdoc/require-param-name': ['error', { contexts: ['TSFunctionType'] }],
'jsdoc/require-param-description': ['error', { contexts: ['TSFunctionType'] }],
'jsdoc/require-returns': ['error', { contexts: ['TSFunctionType'] }],
'jsdoc/require-returns-type': ['error', { contexts: ['TSFunctionType'] }],
'jsdoc/require-returns-description': ['error', { contexts: ['TSFunctionType'] }],
},
overrides: [
...baseline.overrides,
{
files: [
// matching the pattern of the test runner
'*.test.js',
'*.test.ts',
'*.test.tsx',
'test/**',
],
rules: {
'no-restricted-imports': [
'error',
{
paths: ['@testing-library/react', 'test/utils/index'],
},
],
},
},
{
files: ['packages/grid/**/*.ts', 'packages/grid/**/*.js', 'docs/src/pages/**/*.tsx'],
excludedFiles: [
'packages/grid/x-data-grid/src/themeAugmentation/index.js', // TypeScript ignores JS files with the same name as the TS file
'packages/grid/x-data-grid-pro/src/themeAugmentation/index.js',
],
rules: {
'material-ui/no-direct-state-access': 'error',
},
parserOptions: { tsconfigRootDir: __dirname, project: ['./tsconfig.json'] },
},
{
files: ['docs/src/pages/components/**/*.js', 'docs/src/pages/components/**/*.tsx'],
rules: {
'filenames/match-exported': ['error'],
},
},
{
files: ['packages/*/src/**/*{.ts,.tsx,.js}'],
excludedFiles: ['*.d.ts', '*.spec.ts', '*.spec.tsx'],
rules: {
'material-ui/mui-name-matches-component-name': [
'error',
{
customHooks: [
'useDatePickerProcessedProps',
'useDatePickerDefaultizedProps',
'useTimePickerDefaultizedProps',
'useDateTimePickerDefaultizedProps',
],
},
],
},
},
{
files: ['packages/x-pickers/src/**/*{.ts,.tsx,.js}'],
excludedFiles: ['*.d.ts', '*.spec.ts', '*.spec.tsx', '**.test.tx', '**.test.tsx'],
rules: {
'no-restricted-imports': [
'error',
{
paths: ['@mui/x-pickers'],
patterns: ['@mui/x-pickers/*'],
},
],
},
},
{
files: ['packages/x-pickers-pro/src/**/*{.ts,.tsx,.js}'],
excludedFiles: ['*.d.ts', '*.spec.ts', '*.spec.tsx', '**.test.tx', '**.test.tsx'],
rules: {
'no-restricted-imports': [
'error',
{
paths: ['@mui/x-pickers-pro'],
patterns: ['@mui/x-pickers-pro/*'],
},
],
},
},
{
files: ['packages/grid/**/*{.ts,.tsx,.js}'],
excludedFiles: [
'packages/grid/x-data-grid-generator/**',
'*.d.ts',
'*.spec.ts',
'*.spec.tsx',
'**.test.tx',
'**.test.tsx',
],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@mui/base',
message: 'Use @mui/material instead',
},
],
patterns: [
{
group: ['@mui/base/*'],
message: 'Use @mui/material instead',
},
],
},
],
},
},
],
};