1.3.0 • Published 19 days ago

@profi.co/eslint-plugin v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
19 days ago

ESLint plugin by Profico

This plugin is used to enforce some ESLint rules Profico developers use on a day-to-day basis.

Installation

Install @profi.co/eslint-plugin with npm:

npm install --save-dev @profi.co/eslint-plugin

or with yarn:

yarn add --dev @profi.co/eslint-plugin

Usage

To use the recommended rules, add our plugin to your .eslintrc file:

{
  "extends": ["plugin:@profi.co/recommended"]
}

// or configure manually:
{
  "plugins": ["@profi.co"],
  "rules": {
    "@profi.co/lodash-imports": ["error"],
    "@profi.co/grouped-imports": ["error"],
    "@profi.co/dto-decorators": ["error"],
    "@profi.co/ordered-controllers-params": ["error"]
  }
}

The following checklist shows what we have implemented and what we plan on implementing in the near future:

lodash-imports

  • Default import lodash modules instead of importing the whole library or parts of it:
// Bad
import _ from "lodash"; // Not fixable
import { get, pick } from "lodash"; // Fixable

// Good
import get from "lodash/get";
import pick from "lodash/pick";

grouped-imports

dto-decorators

// Bad
@IsString()
@ApiProperty()
public classProperty: string;

// Good
@ApiProperty()
@IsString()
public classProperty: string;

ordered-controller-params

// Bad
public findAll(
  @Req() req: ProficoRequest,
  @Query() queryParams: QueryParams,
  @Custom2() customParam2: CustomParam,
  @Custom1() customParam1: CustomParam,
) {
  return this.service.find();
}

// Good
public findAll(
  @Query() queryParams: QueryParams,
  @Req() req: ProficoRequest,
  @Custom1() customParam1: CustomParam,
  @Custom2() customParam2: CustomParam,
) {
  return this.service.find();
}
1.3.0

19 days ago

1.2.2

1 month ago

1.2.0

7 months ago

1.2.1

7 months ago

1.1.0

1 year ago

1.0.9

1 year ago

1.1.7

1 year ago

1.0.8

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.2

1 year ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago