Skip to content

Commit

Permalink
chore: normalize on 2-space indent & roll out eslint (#791)
Browse files Browse the repository at this point in the history
In a long overdue sweep on the code style standards, added and
configured `eslint` for TypeScript with minimal settings to guarantee
some minimal degree of homogeneity throughout the codebase. The rule set
is likely to expand over time as we iterate and discover more items we
can and want to enforce.
  • Loading branch information
RomainMuller authored Sep 18, 2019
1 parent 62b4120 commit cd23814
Show file tree
Hide file tree
Showing 184 changed files with 21,036 additions and 13,014 deletions.
216 changes: 216 additions & 0 deletions eslint-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
---
env:
jest: true
node: true

plugins:
- '@typescript-eslint'

parser: '@typescript-eslint/parser'
parserOptions:
ecmaVersion: 2018
sourceType: module
project: tsconfig.json

extends:
- eslint:recommended
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/recommended-requiring-type-checking

rules:
# Custom Configurations

'@typescript-eslint/array-type':
- error
- default: array-simple
readonly: array-simple

'@typescript-eslint/await-thenable':
- error

'@typescript-eslint/brace-style':
- error
- 1tbs # One True Brace Style!
- allowSingleLine: true

'@typescript-eslint/explicit-member-accessibility':
- error

'@typescript-eslint/indent':
- error
- 2

'@typescript-eslint/member-delimiter-style':
- error
- multiline:
delimiter: semi
requireLast: true
singleline:
delimiter: comma
requireLast: false

'@typescript-eslint/member-ordering':
- warn
- default:
- static-field
- static-method
- instance-field
- constructor
- instance-method

'@typescript-eslint/no-empty-function':
- error
- allow: [constructors]

'@typescript-eslint/no-extra-parens':
- error
- all
- conditionalAssign: false
nestedBinaryExpressions: false

'@typescript-eslint/no-floating-promises':
- error

'@typescript-eslint/no-for-in-array':
- error

'@typescript-eslint/no-unused-vars':
- error
- args: all
argsIgnorePattern: ^_
caughtErrors: all
vars: all
varsIgnorePattern: ^_

'@typescript-eslint/no-useless-constructor':
- error

'@typescript-eslint/prefer-for-of':
- error

'@typescript-eslint/prefer-readonly':
- error

'@typescript-eslint/promise-function-async':
- error
- checkArrowFunctions: false

'@typescript-eslint/quotes':
- error
- single
- avoidEscape: true
allowTemplateLiterals: false

'@typescript-eslint/require-await':
- error

'@typescript-eslint/type-annotation-spacing':
- error

'array-bracket-spacing':
- error
- never

'complexity':
- warn
- 20

'consistent-return':
- error

'curly':
- error
- all

'dot-location':
- error
- property

'dot-notation':
- error

'eqeqeq':
- error
- always
- null: ignore

'max-len':
- error
- code: 150
ignoreStrings: true
ignoreTemplateLiterals: true
tabWidth: 2

'no-alert':
- error

'no-await-in-loop':
- warn

'no-caller':
- error

'no-else-return':
- error
- allowElseIf: true

'no-eval':
- error

'no-extra-bind':
- warn

'no-implied-eval':
- error

'no-lone-blocks':
- error

'no-multi-spaces':
- error
- ignoreEOLComments: true

'no-new-symbol':
- error

'no-proto':
- error

'no-restricted-properties':
- error

'no-return-await':
- warn

'no-unused-expressions':
- error

'no-useless-call':
- error

'no-var':
- error

'object-curly-spacing':
- error
- always

'prefer-const':
- error

'prefer-template':
- error

'template-curly-spacing':
- error

# Disabled rules
'@typescript-eslint/explicit-function-return-type': off
'@typescript-eslint/interface-name-prefix': off
'@typescript-eslint/no-explicit-any': off
'@typescript-eslint/no-non-null-assertion': off
'@typescript-eslint/no-use-before-define': off
'@typescript-eslint/unbound-method': off
'no-case-declarations': off
'require-atomic-updates': off
Loading

0 comments on commit cd23814

Please sign in to comment.