0.6.0 • Published 1 year ago
eslint-config-chomosuke v0.6.0
eslint-config-chomosuke
This is an opinionated eslint config for typescript based on airbnb-typescript/base & typescript/recommended
This config is published to NPM
Changes on top of airbnb-typescript/base & typecript/recommended:
- Indent with 4 spaces instead of 2.
- According to Linux kernel coding style, if you need more than 3 levels of indentation, you’re screwed anyway, and should fix your program.
- Changed
max-lento 80 and not ignoring string & template literal.- I have a small screen and I like vertical spliting.
- Turned off
import/prefer-default-exportand replaced it withimport/no-default-export.- Naming things are hard enough already, let's only do it once.
- This also enables auto import in some IDEs.
- People will get confused when they see the same thing with different name in different files.
max-lineswill take care of preventing files exporting too many things.
- Overridden
no-unused-varsto allow and enforce leading_to indicate intentionally unused vars- Enforce all unused vars to be intentional.
- Unused args could make sense sometimes.
- Added
@typescript-eslint/member-delimiter-styleto enforce semicolon style.- It's good to have consistency.
- Added
eqeqeq.- You almost never want
==. Even when comparing againstnullit's better to explicitly state if you want to allowundefinedor not.
- You almost never want
- Allowed
ForOfStatement.- Most programmers are more familiar with for loop syntax compared to
forEach(). - Performance shouldn't really be a consideration when using typescript.
- Most programmers are more familiar with for loop syntax compared to
- Disallowed type assertion.
- Turned off
no-use-before-define.- It's preferable to have public interfaces at the top of a module because it allows the reader to see the part they are going to use first. This rule forbids that.
- Added
@typescript-eslint/type-annotation-spacing.- It's good to have consistency.
- Turned off
no-plusplus&no-minusminus.- Most programmers are more familiar with for loop syntax compared to
forEach(). - Most programmers are very familiar with
++&--and know most its nuance.
- Most programmers are more familiar with for loop syntax compared to
- Made
@typescript-eslint/no-explicit-anyan error.anydefeats the purpose of typescript, useunknowninstead.- This should be used with
noImplicitAnyin tsconfig.
- No checkLoops for
no-constant-condition.- Infinite loop are almost always intended.
- Added
@typescript-eslint/no-floating-promises.- I've forgotten to await too many times to not have this rule.
- Added
@typescript-eslint/strict-boolean-expressions.- It's always better to define explicitly what you do or do not allow. It's less error prone and more intension revealing.
- Turned off
@typescript-eslint/no-inferrable-types.- Sometimes we like to write the type annotation explicitely to make our code more readable.
- Added
@typescript-eslint/explicit-member-accessibility.- It's good to have consistency.
- Added
max-lines,max-statements,max-depth&complexity.- This is aimed to increase cohesion.
Contributing
If you're adding new rules, please add your justification in the readme as well as in the PR.
0.6.0
1 year ago
0.5.0
3 years ago
0.3.0
4 years ago
0.4.1
4 years ago
0.3.2
4 years ago
0.2.3
4 years ago
0.4.0
4 years ago
0.3.1
4 years ago
0.2.2
4 years ago
0.3.4
4 years ago
0.4.2
4 years ago
0.3.3
4 years ago
0.2.1
4 years ago
0.2.0
4 years ago
0.1.7
4 years ago
0.1.6
4 years ago
0.1.5
4 years ago
0.1.4
4 years ago
0.1.3
4 years ago
0.1.2
4 years ago
0.1.1
4 years ago
0.1.0
4 years ago
0.0.12
4 years ago
0.0.11
4 years ago
0.0.10
4 years ago
0.0.9
4 years ago
0.0.8
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago