0.5.0 • Published 2 years ago
eslint-config-chomosuke v0.5.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-len
to 80 and not ignoring string & template literal.- I have a small screen and I like vertical spliting.
- Turned off
import/prefer-default-export
and 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-lines
will take care of preventing files exporting too many things.
- Overridden
no-unused-vars
to 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-style
to enforce semicolon style.- It's good to have consistency.
- Added
eqeqeq
.- You almost never want
==
. Even when comparing againstnull
it's better to explicitly state if you want to allowundefined
or 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-any
an error.any
defeats the purpose of typescript, useunknown
instead.- This should be used with
noImplicitAny
in 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.5.0
2 years ago
0.3.0
2 years ago
0.4.1
2 years ago
0.3.2
2 years ago
0.2.3
2 years ago
0.4.0
2 years ago
0.3.1
2 years ago
0.2.2
2 years ago
0.3.4
2 years ago
0.4.2
2 years ago
0.3.3
2 years ago
0.2.1
2 years ago
0.2.0
2 years ago
0.1.7
2 years ago
0.1.6
2 years ago
0.1.5
2 years ago
0.1.4
2 years ago
0.1.3
2 years ago
0.1.2
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago
0.0.12
2 years ago
0.0.11
2 years ago
0.0.10
2 years ago
0.0.9
2 years ago
0.0.8
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago