Skip to content

Latest commit

 

History

History
35 lines (30 loc) · 1.46 KB

jsx-component-props-no-inline-interface.md

File metadata and controls

35 lines (30 loc) · 1.46 KB

Prevent inline interface props as JSX component's props (jsx-component-props-no-inline-interface)

Rule Details

The following patterns are considered warnings:

const App: React.FC<{test: string}> = (props) => null
const App: FC<{test: string}> = (props) => null
const App: React.FC<ITestProps & {test: string}> = (props) => null
const App: FC<ITestProps & {test: string}> = (props) => null
const App = (props: ITestProps & {test: string}) => null
const App = (props: Pick<ITestProps, 'test'> & {test: string}) => null
const App = (props: {test: string}) => null
const App = ({ test }: {test: string}) => null
const App = ({ test }: Pick<ITestProps, 'test'> & {test: string}) => null
const App = ({ test }: ITestProps & {test: string}) => null
const App: FC<ITestProps & {test: string}> = ({ test }) => null
const App: React.FC<{test: string}> = ({ test }) => null
const App: FC<{test: string}> = ({ test }) => null
const App: React.FC<ITestProps & {test: string}> = ({ test }) => null

The following patterns are not considered warnings:

const App = (props: ITestProps) => null
const App = (props: Pick<ITestProps, 'test'>) => null
const App: React.FC<ITestProps> = (props) => null
const App: React.FC<Pick<ITestProps, 'test'>> = (props) => null
const App = ({ test }: ITestProps) => null
const App = ({ test }: Pick<ITestProps, 'test'>) => null
const App: React.FC<ITestProps> = ({ test }) => null
const App: React.FC<Pick<ITestProps, 'test'>> = ({ test }) => null