Skip to content

Commit c08a543

Browse files
committed
Fix a violation and ignore false positives
1 parent 08f5761 commit c08a543

File tree

7 files changed

+20
-1
lines changed

7 files changed

+20
-1
lines changed

packages/mui-styles/src/styled/styled.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ describe('styled', () => {
6363
});
6464

6565
it('should filter some props', () => {
66+
// false positive
67+
// eslint-disable-next-line react/function-component-definition
6668
const style = (props) => ({
6769
background: props.color,
6870
borderRadius: 3,

packages/mui-styles/src/withStyles/withStyles.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,10 @@ describe('withStyles', () => {
168168
});
169169

170170
it('should use theme.props instead of defaultProps', () => {
171-
const MuiFoo = ({ foo }) => foo;
171+
function MuiFoo({ foo }) {
172+
return foo;
173+
}
174+
172175
MuiFoo.defaultProps = {
173176
foo: 'foo',
174177
};

packages/mui-system/src/borders.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ export const borderLeftColor = style({
6767
themeKey: 'palette',
6868
});
6969

70+
// false positive
71+
// eslint-disable-next-line react/function-component-definition
7072
export const borderRadius = (props) => {
7173
if (props.borderRadius !== undefined && props.borderRadius !== null) {
7274
const transformer = createUnaryUnit(props.theme, 'shape.borderRadius', 4, 'borderRadius');

packages/mui-system/src/breakpoints.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export function handleBreakpoints(props, propValue, styleFromPropValue) {
5151
}
5252

5353
function breakpoints(styleFunction) {
54+
// false positive
55+
// eslint-disable-next-line react/function-component-definition
5456
const newStyleFunction = (props) => {
5557
const theme = props.theme || {};
5658
const base = styleFunction(props);

packages/mui-system/src/compose.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ function compose(...styles) {
99
return acc;
1010
}, {});
1111

12+
// false positive
13+
// eslint-disable-next-line react/function-component-definition
1214
const fn = (props) => {
1315
return Object.keys(props).reduce((acc, prop) => {
1416
if (handlers[prop]) {

packages/mui-system/src/cssGrid.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { createUnaryUnit, getValue } from './spacing';
44
import { handleBreakpoints } from './breakpoints';
55
import responsivePropType from './responsivePropType';
66

7+
// false positive
8+
// eslint-disable-next-line react/function-component-definition
79
export const gap = (props) => {
810
if (props.gap !== undefined && props.gap !== null) {
911
const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'gap');
@@ -20,6 +22,8 @@ gap.propTypes = process.env.NODE_ENV !== 'production' ? { gap: responsivePropTyp
2022

2123
gap.filterProps = ['gap'];
2224

25+
// false positive
26+
// eslint-disable-next-line react/function-component-definition
2327
export const columnGap = (props) => {
2428
if (props.columnGap !== undefined && props.columnGap !== null) {
2529
const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'columnGap');
@@ -37,6 +41,8 @@ columnGap.propTypes =
3741

3842
columnGap.filterProps = ['columnGap'];
3943

44+
// false positive
45+
// eslint-disable-next-line react/function-component-definition
4046
export const rowGap = (props) => {
4147
if (props.rowGap !== undefined && props.rowGap !== null) {
4248
const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'rowGap');

packages/mui-system/src/style.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ function getValue(themeMapping, transform, propValueFinal, userValue = propValue
4545
function style(options) {
4646
const { prop, cssProperty = options.prop, themeKey, transform } = options;
4747

48+
// false positive
49+
// eslint-disable-next-line react/function-component-definition
4850
const fn = (props) => {
4951
if (props[prop] == null) {
5052
return null;

0 commit comments

Comments
 (0)