2.0.16 • Published 23 days ago

@captive/eslint-config v2.0.16

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

Captive ESLint configuration (@captive/eslint-config)

NPM Version License

ESLint configuration presets

Installation

npm install --save-dev @captive/eslint-config

Usage

Default JS/TS project

For most kind of project, just edit eslintrc.json and add default configuration

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

Features :

  • ES and TS validation
  • JSON
  • YAML
  • Prettier formatting
  • JSX and React syntax validation
  • Jest tests
  • VueJS
  • Cypress

Custom project

For most kind of project, just edit eslintrc.json and cherry pick only configurations

{
  "root": true,
  "extends": [
    "@captive/eslint-config/dist/react",
    "@captive/eslint-config/dist/ts",
    // include more configurations here
  ]
  //...
}

Available configurations :

  • @captive/eslint-config/dist/es: for ECMA Script (ES) files
  • @captive/eslint-config/dist/jest: for jest environment tests
  • @captive/eslint-config/dist/json: for jest environment tests
  • @captive/eslint-config/dist/react: for react capability
  • @captive/eslint-config/dist/ts: for typescript files

Migration Guide

Intention

This is a recommended way of migrating from another configuration / no configuration. The aim is to setup the shared configuration as soon as possible and progressively fix all errors.

All modifications should be :

  • iterative : move safely from a step to another
  • easy to review : the smallest changes possible
  • safe : avoid touching business code if there is a chance that it could introduce regression

Content

  1. Add the configuration your eslint configuration file (follow Usage section)
  2. Disable temporarily each rule that returns an error

    1. Get all the errors from eslint

      > yarn eslint .
      path/to/my-project/file.js
      1:1  error  'foo' is not defined  no-undef
      
      # ...
    2. Set each rule to off

      {
          "rules": {
              "no-undef": "off"    
          }
      }  
    3. Run again eslint and check that no errors are reported

    4. Ship the code (Commit, Push, Merge, ...)
  3. For each error iterate as the following :

    1. Enable the rule (remove the off line in the eslint configuration)
    2. Analyze the type of error :
      • When fixable and no breaking change could be introduced, then run eslint --fix
      • When the error is pretty obvious to fix manually, then correct manually all files
      • When the code is unsafe by nature or should not be changed (no tests, highly sensitive code), then the developer could take responsibility to ignore the rule using // eslint-disable-line ... and // eslint-disable-next-line ...
      • When the rule seems non relevant / impossible to fix in most cases, then post an issue on the eslint-config repository with your use case
    3. Ship the code (Commit, Push, Merge, ...)

License

MIT © Julien Polo julien.polo@captive.fr

About Captive

captive

@captive/eslint-config is maintained and funded by Captive. The names and logos for captive are trademarks of captive-studio.

We love open source software! See our other projects or hire us to design, develop, and grow your product.

2.0.16

23 days ago

2.0.15

1 month ago

2.0.14

2 months ago

2.0.13

2 months ago

2.0.12

2 months ago

2.0.11

4 months ago

2.0.10

5 months ago

2.0.9

5 months ago

1.10.5

7 months ago

1.10.4

7 months ago

1.10.3

9 months ago

1.10.2

9 months ago

1.8.1

10 months ago

2.0.3

7 months ago

2.0.2

7 months ago

2.0.5

6 months ago

2.0.4

7 months ago

2.0.7

6 months ago

2.0.6

6 months ago

2.0.8

6 months ago

2.0.1

7 months ago

2.0.0

7 months ago

1.9.1

10 months ago

1.9.0

10 months ago

1.10.1

9 months ago

1.10.0

9 months ago

1.8.0

11 months ago

1.7.34

11 months ago

1.7.28

1 year ago

1.7.29

1 year ago

1.7.30

1 year ago

1.7.31

1 year ago

1.7.32

12 months ago

1.7.33

11 months ago

1.7.27

1 year ago

1.7.20

1 year ago

1.7.21

1 year ago

1.7.22

1 year ago

1.7.23

1 year ago

1.7.24

1 year ago

1.7.25

1 year ago

1.7.26

1 year ago

1.7.19

1 year ago

1.7.18

1 year ago

1.7.17

1 year ago

1.7.10

1 year ago

1.7.11

1 year ago

1.7.12

1 year ago

1.7.13

1 year ago

1.7.14

1 year ago

1.7.15

1 year ago

1.7.16

1 year ago

1.7.3

1 year ago

1.7.2

1 year ago

1.7.1

1 year ago

1.7.0

1 year ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.7.9

1 year ago

1.7.8

1 year ago

1.7.7

1 year ago

1.7.6

1 year ago

1.7.5

1 year ago

1.7.4

1 year ago

1.3.0

2 years ago

1.2.0

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

1.0.0-alpha.8

2 years ago

1.0.0-alpha.7

2 years ago

1.0.0-alpha.6

2 years ago

1.0.0-alpha.5

2 years ago

1.0.0-alpha.4

2 years ago

1.0.0-alpha.3

2 years ago

1.0.0-alpha.2

2 years ago

1.0.0-alpha.1

2 years ago