eslint-plugin-wrap-props

0.1.2 • Public • Published

eslint-plugin-wrap-props

A set of ESLint rules to wrap functions or JSX elements that exceed a desired line length, and companion rules to unwrap functions or JSX elements which can fit on one line.

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-wrap-props:

$ npm install eslint-plugin-wrap-props --save-dev

Usage

Add wrap-props to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": [
    "wrap-props"
  ]
}

Then configure the rules under the rules section.

{
  "rules": {
    'wrap-props/wrap-function-props':       ['error'],
    'wrap-props/wrap-function-arguments':   ['error'],
    'wrap-props/wrap-jsx-props':            ['error'],
    'wrap-props/unwrap-function-props':     ['error'],
    'wrap-props/unwrap-function-arguments': ['error'],
    'wrap-props/unwrap-jsx-props':          ['error']
  }
}

Options

  • maxLength : (integer, default: 80)

Determine how long a line must be before wrapping is applied. For unwrap rules, this is used to determine which lines are short enough to be safely unwrapped.

  • indent : (integer, default: 2)

Used to indent props or arguments when wrapping. Not applicable for unwrap rules.

More information

Package Sidebar

Install

npm i eslint-plugin-wrap-props

Weekly Downloads

172

Version

0.1.2

License

ISC

Unpacked Size

66.3 kB

Total Files

25

Last publish

Collaborators

  • pascalpp