Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Latest commit

 

History

History

eslint-plugin-internal

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

@ueno/eslint-plugin-internal

npm

Why?

We needed some customs rules to add to our lint config, to align with our code style. This package is used in the @ueno/eslint-config to add two custom rules to our config.

@ueno/internal/decorator-line-break

Force a line break after the decorator statement

This rule has one option, which can be a string option.

String option:

  • "always" (default) requires a line break after a decorator statement
  • "never" disallows line break after a decorator statement

Example:

'@ueno/internal/decorator-line-break': 2 Will requires to add a line break after a decorator declaration

Wrong 👎

@observable myValue = true;

Good 👍

@observable
myValue = true;

@ueno/internal/padded-blocks

Force a blank line after the class declaration

This rule has two options, which can be a string option or an object option.

String option:

  • "always" (default) requires empty lines at the beginning and ending of blocks, classes and switches statements
  • "never" disallows empty lines at the beginning and ending of blocks, classes and switches statements
  • "top" requires empty lines only at the beginning of blocks, classes and switches statements
  • "bottom" disallows empty lines only at the ending of blocks, classes and switches statements

Object option:

  • "blocks" require or disallow padding within blocks statements
  • "classes" require or disallow padding within classes statements
  • "switches" require or disallow padding within switch statements

Examples:

'@ueno/internal/padded-blocks': 2 Will requires empty lines only at the beginning and ending of blocks, classes and switches statements

Wrong 👎

class A {
  constructor() {
  }
}

Good 👍

class A {

  constructor() {
  }

}

'@ueno/internal/padded-blocks': ['error', { classes: 'top' }] Will requires empty lines only at the beginning of classes statements

Wrong 👎

class A {
  constructor() {
  }
}

Good 👍

class A {

  constructor() {
  }
}

License

MIT © ueno.