Skip to content

Commit dac0464

Browse files
author
Brijesh Bittu
committed
temp
1 parent 0995a43 commit dac0464

File tree

4 files changed

+103
-109
lines changed

4 files changed

+103
-109
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ConfigArray } from 'typescript-eslint';
22

3-
declare function createDocsConfig(): ConfigArray;
3+
declare const docsConfig: ConfigArray;
44

5-
export { createDocsConfig };
5+
export { docsConfig };

packages/mui-internal-code-infra/src/eslint/docs.mjs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@ import * as tselint from 'typescript-eslint';
88
/**
99
* @returns {import('typescript-eslint').ConfigArray}
1010
*/
11-
export function createDocsConfig() {
12-
return tselint.config(nextjs.flatConfig.recommended, {
13-
settings: {
14-
next: {
15-
rootDir: 'docs',
16-
},
11+
export const docsConfig = tselint.config(nextjs.flatConfig.recommended, {
12+
settings: {
13+
next: {
14+
rootDir: 'docs',
1715
},
18-
rules: {
19-
// We're not using the Image component at the moment
20-
'@next/next/no-img-element': 'off',
21-
'no-irregular-whitespace': ['error', { skipJSXText: true, skipStrings: true }],
22-
},
23-
});
24-
}
16+
},
17+
rules: {
18+
// We're not using the Image component at the moment
19+
'@next/next/no-img-element': 'off',
20+
'no-irregular-whitespace': ['error', { skipJSXText: true, skipStrings: true }],
21+
},
22+
});
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type { ConfigArray, ConfigWithExtends } from 'typescript-eslint';
22

3-
type BaseConfigOptions = {
4-
enableReactCompiler?: boolean;
5-
};
3+
// type BaseConfigOptions = {
4+
// enableReactCompiler?: boolean;
5+
// };
66

77
declare const baseSpecRules: ConfigWithExtends;
88

9-
declare function createBaseConfig(options?: BaseConfigOptions): ConfigArray;
10-
declare function createTestConfig(): ConfigArray;
9+
declare const baseConfig: ConfigArray;
10+
declare const testConfig: ConfigArray;
1111

12-
export { baseSpecRules, createBaseConfig, createTestConfig };
12+
export { baseSpecRules, baseConfig, testConfig };
Lines changed: 84 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import prettier from 'eslint-config-prettier/flat';
22
import { flatConfigs as importFlatConfigs } from 'eslint-plugin-import';
33
import mochaPlugin from 'eslint-plugin-mocha';
4-
import reactCompilerPlugin from 'eslint-plugin-react-compiler';
4+
// import reactCompilerPlugin from 'eslint-plugin-react-compiler';
55
import { configs as reactHookConfigs } from 'eslint-plugin-react-hooks';
66
import testingLibrary from 'eslint-plugin-testing-library';
77
import globals from 'globals';
@@ -50,105 +50,101 @@ export const baseSpecRules = {
5050
* @param {boolean} [params.enableReactCompiler] - Whether the config is for spec files.
5151
* @returns {import('typescript-eslint').ConfigArray}
5252
*/
53-
export function createBaseConfig({ enableReactCompiler = false } = {}) {
54-
return tseslint.config(
55-
importFlatConfigs.recommended,
56-
importFlatConfigs.typescript,
57-
reactHookConfigs.recommended,
58-
enableReactCompiler ? reactCompilerPlugin.configs.recommended : {},
59-
airbnbBase,
60-
airbnbReact,
61-
airbnbTs,
62-
prettier,
63-
{
64-
name: 'typescript-eslint-parser',
65-
languageOptions: {
66-
parser: tseslint.parser,
67-
ecmaVersion: 7,
68-
globals: {
69-
...globals.es2020,
70-
...globals.browser,
71-
...globals.node,
72-
},
53+
export const baseConfig = tseslint.config(
54+
importFlatConfigs.recommended,
55+
importFlatConfigs.typescript,
56+
reactHookConfigs.recommended,
57+
// enableReactCompiler ? reactCompilerPlugin.configs.recommended : {},
58+
airbnbBase,
59+
airbnbReact,
60+
airbnbTs,
61+
prettier,
62+
{
63+
name: 'typescript-eslint-parser',
64+
languageOptions: {
65+
parser: tseslint.parser,
66+
ecmaVersion: 7,
67+
globals: {
68+
...globals.es2020,
69+
...globals.browser,
70+
...globals.node,
7371
},
74-
plugins: {
75-
'@typescript-eslint': tseslint.plugin,
76-
'material-ui': muiPlugin,
72+
},
73+
plugins: {
74+
'@typescript-eslint': tseslint.plugin,
75+
'material-ui': muiPlugin,
76+
},
77+
settings: {
78+
'import/parsers': {
79+
'@typescript-eslint/parser': ['.ts', '.tsx'],
7780
},
78-
settings: {
79-
'import/parsers': {
80-
'@typescript-eslint/parser': ['.ts', '.tsx'],
81-
},
82-
'import/resolver': {
83-
typescript: {
84-
project: ['tsconfig.node.json', 'apps/*/tsconfig.json', 'packages/*/tsconfig.json'],
85-
},
81+
'import/resolver': {
82+
typescript: {
83+
project: ['tsconfig.node.json', 'apps/*/tsconfig.json', 'packages/*/tsconfig.json'],
8684
},
8785
},
88-
extends: createCoreConfig({ reactCompilerEnabled: enableReactCompiler }),
8986
},
90-
);
91-
}
87+
extends: createCoreConfig({ reactCompilerEnabled: false }),
88+
},
89+
);
9290

9391
/**
9492
* @returns {import('typescript-eslint').ConfigArray}
9593
*/
96-
export function createTestConfig() {
97-
return tseslint.config(
98-
mochaPlugin.configs.recommended,
99-
testingLibrary.configs['flat/dom'],
100-
testingLibrary.configs['flat/react'],
101-
{
102-
languageOptions: {
103-
parser: tseslint.parser,
104-
parserOptions: {
105-
ecmaVersion: 7,
106-
},
107-
globals: globals.mocha,
94+
export const testConfig = tseslint.config(
95+
mochaPlugin.configs.recommended,
96+
testingLibrary.configs['flat/dom'],
97+
testingLibrary.configs['flat/react'],
98+
{
99+
languageOptions: {
100+
parser: tseslint.parser,
101+
parserOptions: {
102+
ecmaVersion: 7,
108103
},
109-
rules: {
110-
// does not work with wildcard imports. Mistakes will throw at runtime anyway
111-
'import/named': 'off',
112-
'material-ui/disallow-active-element-as-key-event-target': 'error',
113-
'mocha/consistent-spacing-between-blocks': 'off',
104+
globals: globals.mocha,
105+
},
106+
rules: {
107+
// does not work with wildcard imports. Mistakes will throw at runtime anyway
108+
'import/named': 'off',
109+
'material-ui/disallow-active-element-as-key-event-target': 'error',
110+
'mocha/consistent-spacing-between-blocks': 'off',
114111

115-
// upgraded level from recommended
116-
'mocha/no-pending-tests': 'error',
112+
// upgraded level from recommended
113+
'mocha/no-pending-tests': 'error',
117114

118-
// no rationale provided in /recommended
119-
'mocha/no-mocha-arrows': 'off',
120-
// definitely a useful rule but too many false positives
121-
// due to `describeConformance`
122-
// "If you're using dynamically generated tests, you should disable this rule.""
123-
'mocha/no-setup-in-describe': 'off',
124-
// `beforeEach` for a single case is optimized for change
125-
// when we add a test we don't have to refactor the existing
126-
// test to `beforeEach`.
127-
// `beforeEach`+`afterEach` also means that the `beforeEach`
128-
// is cleaned up in `afterEach` if the test causes a crash
129-
'mocha/no-hooks-for-single-case': 'off',
115+
// no rationale provided in /recommended
116+
'mocha/no-mocha-arrows': 'off',
117+
// definitely a useful rule but too many false positives
118+
// due to `describeConformance`
119+
// "If you're using dynamically generated tests, you should disable this rule.""
120+
'mocha/no-setup-in-describe': 'off',
121+
// `beforeEach` for a single case is optimized for change
122+
// when we add a test we don't have to refactor the existing
123+
// test to `beforeEach`.
124+
// `beforeEach`+`afterEach` also means that the `beforeEach`
125+
// is cleaned up in `afterEach` if the test causes a crash
126+
'mocha/no-hooks-for-single-case': 'off',
130127

131-
// disable eslint-plugin-jsx-a11y
132-
// tests are not driven by assistive technology
133-
// add `jsx-a11y` rules once you encounter them in tests
134-
'jsx-a11y/click-events-have-key-events': 'off',
135-
'jsx-a11y/control-has-associated-label': 'off',
136-
'jsx-a11y/iframe-has-title': 'off',
137-
'jsx-a11y/label-has-associated-control': 'off',
138-
'jsx-a11y/mouse-events-have-key-events': 'off',
139-
'jsx-a11y/no-noninteractive-tabindex': 'off',
140-
'jsx-a11y/no-static-element-interactions': 'off',
141-
'jsx-a11y/tabindex-no-positive': 'off',
128+
// disable eslint-plugin-jsx-a11y
129+
// tests are not driven by assistive technology
130+
// add `jsx-a11y` rules once you encounter them in tests
131+
'jsx-a11y/click-events-have-key-events': 'off',
132+
'jsx-a11y/control-has-associated-label': 'off',
133+
'jsx-a11y/iframe-has-title': 'off',
134+
'jsx-a11y/label-has-associated-control': 'off',
135+
'jsx-a11y/mouse-events-have-key-events': 'off',
136+
'jsx-a11y/no-noninteractive-tabindex': 'off',
137+
'jsx-a11y/no-static-element-interactions': 'off',
138+
'jsx-a11y/tabindex-no-positive': 'off',
142139

143-
// In tests this is generally intended.
144-
'react/button-has-type': 'off',
145-
// They are accessed to test custom validator implementation with PropTypes.checkPropTypes
146-
'react/forbid-foreign-prop-types': 'off',
147-
// components that are defined in test are isolated enough
148-
// that they don't need type-checking
149-
'react/prop-types': 'off',
150-
'react/no-unused-prop-types': 'off',
151-
},
140+
// In tests this is generally intended.
141+
'react/button-has-type': 'off',
142+
// They are accessed to test custom validator implementation with PropTypes.checkPropTypes
143+
'react/forbid-foreign-prop-types': 'off',
144+
// components that are defined in test are isolated enough
145+
// that they don't need type-checking
146+
'react/prop-types': 'off',
147+
'react/no-unused-prop-types': 'off',
152148
},
153-
);
154-
}
149+
},
150+
);

0 commit comments

Comments
 (0)