Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(eslint): migration to eslint #290

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 164 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
env:
browser: true
es6: true
node: true

parser: "@typescript-eslint/parser"

parserOptions:
sourceType: module
# project: tsconfig.json

plugins:
- "@typescript-eslint"
- import
- prefer-arrow
- local-rules
- jsdoc
- promise

extends:
- "prettier/@typescript-eslint"

rules:
"@typescript-eslint/adjacent-overload-signatures": error
"@typescript-eslint/array-type": [error, { default: array-simple } ] # was not correctly migrated
"@typescript-eslint/ban-types": error
"@typescript-eslint/class-name-casing": error
"@typescript-eslint/consistent-type-assertions": off
"@typescript-eslint/consistent-type-definitions": error
"@typescript-eslint/interface-name-prefix": error
"@typescript-eslint/member-ordering": error
"@typescript-eslint/no-empty-function": error
"@typescript-eslint/no-empty-interface": error
"@typescript-eslint/no-explicit-any": off
"@typescript-eslint/no-extraneous-class": error
"@typescript-eslint/no-inferrable-types": error
"@typescript-eslint/no-misused-new": error
"@typescript-eslint/no-namespace": error
"@typescript-eslint/no-non-null-assertion": error
"@typescript-eslint/no-parameter-properties": off
"@typescript-eslint/no-this-alias": error
# "@typescript-eslint/no-unnecessary-type-assertion": error # would need typescript --> parserOptions.project
"@typescript-eslint/no-use-before-define": off
"@typescript-eslint/no-var-requires": error
"@typescript-eslint/prefer-for-of": error
"@typescript-eslint/prefer-function-type": error
"@typescript-eslint/prefer-namespace-keyword": error
"@typescript-eslint/triple-slash-reference": error
"@typescript-eslint/unified-signatures": error
arrow-body-style: error
camelcase: error
comma-dangle: off
complexity: off
constructor-super: error
curly: error
dot-notation: error
eol-last: off
eqeqeq: [error, smart]
guard-for-in: error
# id-blacklist: # rule is totally shit and not working at all.
# should actually just ban these names as var names but reports errors when ever your using them like (x !== undefined)
# - error
# - any
# - Number
# - number
# - String
# - string
# - Boolean
# - boolean
# - Undefined
id-match: error
import/no-extraneous-dependencies: error
import/no-internal-modules: [error, { allow: ["aws-sdk/**/*", "rxjs/operators/*"]}]
import/order: error
jsdoc/check-alignment: 1
# jsdoc/check-examples: 1 # its typescript..
jsdoc/check-indentation: 1
jsdoc/check-param-names: 1
jsdoc/check-syntax: 1
# jsdoc/check-tag-names: 1
jsdoc/check-types: 1
jsdoc/implements-on-classes: 1
# jsdoc/match-description: 1
jsdoc/newline-after-description: 1
jsdoc/no-types: 1
jsdoc/no-undefined-types: 1
# jsdoc/require-description: 1
# jsdoc/require-description-complete-sentence: 1
# jsdoc/require-example: 1
# jsdoc/require-hyphen-before-param-description: 1
# jsdoc/require-jsdoc: 1
# jsdoc/require-param: 1
# jsdoc/require-param-description: 1
# jsdoc/require-param-name: 1
# jsdoc/require-param-type: 1
# jsdoc/require-returns: 1
jsdoc/require-returns-check: 1
jsdoc/require-returns-description: 1
# jsdoc/require-returns-type: 1
jsdoc/valid-types: 1
linebreak-style: off
max-classes-per-file: [error, 1]
max-len: off
new-parens: off
newline-per-chained-call: off
no-bitwise: error
no-caller: error
no-cond-assign: [error, always]
no-console: error
no-debugger: error
no-duplicate-case: error
no-duplicate-imports: error
no-empty: error
no-eval: error
no-extra-bind: error
no-extra-semi: off
no-fallthrough: off
no-invalid-this: off
no-irregular-whitespace: off
no-multiple-empty-lines: off
no-new-func: error
no-new-wrappers: error
no-redeclare: error
no-restricted-imports: [error, aws-sdk]
no-return-await: error
no-sequences: error
no-shadow: [error, {hoist: all} ]
no-sparse-arrays: error
no-template-curly-in-string: error
no-throw-literal: error
no-trailing-spaces: off
no-undef-init: error
no-underscore-dangle: error
no-unsafe-finally: error
no-unused-expressions: error
no-unused-labels: error
no-useless-constructor: error
# no-unused-vars: error # seems not to work fine in TS
no-var: error
object-shorthand: error
one-var: [error, never]
# prefer-arrow/prefer-arrow-functions: error # TODO --> SEE tslint-eeslint-config.log
prefer-const: error
prefer-object-spread: error
promise/always-return: error
promise/no-return-wrap: error
promise/param-names: error
promise/catch-or-return: error
promise/no-native: off
# promise/no-nesting: warn
promise/no-promise-in-callback: warn
promise/no-callback-in-promise: warn
# promise/avoid-new: warn
promise/no-new-statics: error
promise/no-return-in-finally: warn
promise/valid-params: warn
quote-props: off
radix: error
space-in-parens: [off, never]
spaced-comment: error
use-isnan: error
valid-typeof: off
# local rules located in tools/eslint-rules
local-rules/no-named-dynamo-import: error
10 changes: 2 additions & 8 deletions .lintstagedrc.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
"src/**/!(*.spec).ts":
"{src,test}/**/*.ts":
- prettier --write --config ./.prettierrc.yml
- tslint --project ./tsconfig.json -t codeFrame --fix
"(src/**/*.spec.ts|test/**/*.ts)":
- prettier --write --config ./.prettierrc.yml
# TODO LOW tslint will not work because of the following error
# ✖ tslint --project ./tsconfig.jest.json -t codeFrame --fix found some errors. Please fix them and try committing again.
#'/Users/michaelwittwer/dev/shiftcode/dynamo-easy/test/models/complex.model.ts' is not included in project.
# - tslint --project ./tsconfig.jest.json -t codeFrame --fix
- eslint --config .eslintrc.yml --ext .ts --fix
"**/package.json":
- sort-package-json
5 changes: 5 additions & 0 deletions eslint-local-rules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict'

module.exports = {
'no-named-dynamo-import': require('./tools/eslint-rules/no-named-dynamo-import'),
}
Loading