1.0.7 • Published 11 months ago

@spyrosoft/eslint-config-spyro v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

Spyrosoft ESlint Config

A set of rules selected by Spyrosoft's engineers as a company standard for frontend projects.

Table of Contents

Installation

In order to use this set of rules in your project, install this package as a dev dependency:

npm i --save-dev @spyrosoft/eslint-config-spyro

Then, set it in your .eslintrc.json file:

{
  "extends": ["@spyrosoft/eslint-config-spyro"]
}

And that's all, your ESlint rules are now set and ready to go.

List of rules

General rules

Tests rules

Jest recommended, extended by:

RuleDescription
jest/consistent-test-itforces all top-level tests to use test and all tests nested within describe to use it
jest/max-nested-describeenforces a maximum depth to nested describe() calls to 3
jest/no-alias-methodsdisallow alias methods
jest/no-duplicate-hooksdisallow duplicate setup and teardown hooks
jest/no-hooksallow only afterAll and beforeEach hooks
jest/no-ifdisallow conditional logic
jest/no-test-return-statementdisallow explicitly returning from tests
jest/require-top-level-describerequire test cases and hooks to be inside a describe block
jest/expect-expectensure that there is at least one expect call made in a test

Naming convention

  • interfaces - PascalCase, starting with I
  • type aliases - PascalCase, starting with T
  • variables - CamelCase, PascalCase or UPPER_CASE, consecutive capitals are not allowed
  • enums - UPPER_CASE

No trailing or leading underscores allowed in any of the above.

File naming convention

All file names should be in kebab-case.

Member declaration order

Access modifier order

  1. public
  2. protected
  3. private

Member type order

  1. static field
  2. instance field
  3. static method
  4. constructor
  5. instance method

Additonal rules

RuleDescription
@typescript-eslint/member-delimiter-styleeach member should be delimited with a semicolon
no-else-returndisallow else blocks after return statements in if statements
unicorn/new-for-builtinsenforce the use of new for all builtins, except String, Number, Boolean, Symbol and BigInt
unicorn/prefer-switchprefer switch over multiple else-if
react/jsx-no-useless-fragmentdisallow unnecessary fragments
react-hooks/exhaustive-depsvalidate dependencies of custom Hooks
1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

12 months ago

1.0.0

12 months ago