Skip to content

Repository files navigation

eslint-plugin-react-native-enforce-props

📝 Enforce a specific set of props on specific elements.

Setup

Pre-Requisites

Before starting, make sure you have ESLint as a devDependency of your project.

Installation

Next, install eslint-plugin-react-native-enforce-props:

npm install eslint-plugin-react-native-enforce-props --save-dev

# or

yarn add eslint-plugin-react-native-enforce-props --dev

Usage

Import the plugin in your eslint config, add it to the plugins section and set the rules you want to use:

const enforceProps = require('../eslint-plugin-react-native-enforce-props/dist/index');

module.exports = tsEslint.config(
  { ignores: ['babel.config.js', '*.jpg', 'index.js'] },
  {
    ...other options...
    plugins: {
        ...other plugins...
      'react-native-enforce-props': enforceProps,
    },
    rules: {
       ...other rules...
      'react-native-enforce-props/enforce-props': [
        'error',
        {
          propsToCheck: ['onPress'],
          componentsToCheck: ['TouchableOpacity'],
        },
      ],
    }
  },
);

Supported Rules

The plugin provides the following rules:

Name Description
enforce-props Enforce a specific set of props on specific elements

License

eslint-plugin-react-native-enforce-props is licensed under the MIT License.

Maintenance Status: Active

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages