1.0.6 • Published 1 year ago

@patrickemoore/eslint-plugin-aliased-props v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

eslint-plugin-aliased-props

What the plugin does

This ESLint plugin enforces the use of aliased (named) types for React component props. It ensures that props are defined using named interfaces or type aliases instead of inline types.

Installation

To install the plugin, run:

npm install @patrickemoore/eslint-plugin-aliased-props --save-dev

Configuration

To configure the plugin in your ESLint configuration file, add the following:

{
  "plugins": ["@patrickemoore/aliased-props"],
  "rules": {
    "@patrickemoore/aliased-props/require-aliased-props": "error"
  }
}

Examples

Incorrect

const MyComponent = (props: { name: string, age: number }) => {
  return <div>{props.name}</div>;
};

Correct

type Props = {
  name: string,
  age: number,
};

const MyComponent = (props: Props) => {
  return <div>{props.name}</div>;
};
1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago