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

Added migration to eslint #49

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules/
npm-debug.log
test/**/*.js
test/**/*.js.map
!test/eslintrc.js
199 changes: 199 additions & 0 deletions eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
module.exports = {
env: {
node: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.json",
sourceType: "module",
},
plugins: ["@typescript-eslint", "@typescript-eslint/tslint"],
rules: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot of rules to enable! Let's extend from the list of rules defined in the plugins.

Example reference: https://github.com/typescript-eslint/tslint-to-eslint-config/pull/229/files#diff-e4403a877d80de653400d88d85e4801aR6

"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-ignore": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
overrides: {
constructors: "off",
},
},
],
"@typescript-eslint/indent": "off",
"@typescript-eslint/interface-name-prefix": "error",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/no-angle-bracket-type-assertion": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-for-in-array": "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-object-literal-type-assertion": "error",
"@typescript-eslint/no-param-reassign": "off",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-this-alias": "error",
"@typescript-eslint/no-triple-slash-reference": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-use-before-declare": "off",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-interface": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/quotes": "off",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/type-annotation-spacing": "off",
"@typescript-eslint/unbound-method": "error",
"@typescript-eslint/unified-signatures": "error",
"arrow-body-style": ["error", "always"],
"arrow-parens": ["off", "as-needed"],
"class-methods-use-this": "off",
complexity: "error",
"constructor-super": "error",
curly: "error",
"default-case": "error",
"dot-notation": "error",
"eol-last": "off",
eqeqeq: ["error", "always"],
"guard-for-in": "error",
"linebreak-style": "off",
"max-classes-per-file": ["error", 1],
"max-len": [
"error",
{
code: 140,
},
],
"max-lines": ["error", 1000],
"new-parens": "off",
"newline-per-chained-call": "off",
"no-bitwise": "error",
"no-caller": "error",
"no-cond-assign": "error",
"no-console": "error",
"no-debugger": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-empty": "off",
"no-empty-functions": "off",
"no-eval": "error",
"no-extra-bind": "error",
"no-extra-semi": "off",
"no-irregular-whitespace": "off",
"no-magic-numbers": [
"error",
{
ignore: [-1, 0, 1, 2, 3],
},
],
"no-multiple-empty-lines": "off",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-plusplus": [
"error",
{
allowForLoopAfterthoughts: true,
},
],
"no-restricted-syntax": ["off", "ForInStatement"],
"no-return-await": "error",
"no-sequences": "error",
"no-sparse-arrays": "error",
"no-template-curly-in-string": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "off",
"no-undef-init": "error",
"no-unsafe-finally": "error",
"no-unused-labels": "error",
"no-useless-constructor": "error",
"no-var": "error",
"no-void": "error",
"object-shorthand": "error",
"one-var": "error",
"padding-line-between-statements": [
"off",
"error",
{
blankLine: "always",
prev: "*",
next: "return",
},
],
"prefer-arrow/prefer-arrow-functions": "error",
"prefer-const": "error",
"prefer-object-spread": "error",
"prefer-readonly": "error",
"prefer-template": "error",
"quote-props": "off",
radix: "error",
"space-before-function-paren": "off",
"use-isnan": "error",
yoda: "error",
"@typescript-eslint/tslint/config": [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amusing that there are still so many not yet implemented. You can go ahead and not include this list of tslint/config rules. I'm ok with them not being enabled any more. 😮

"error",
{
rules: {
"comment-type": [true, "singleline", "multiline", "doc", "directive"],
deprecation: true,
encoding: true,
"file-name-casing": [true, "camel-case"],
"jsdoc-format": [true, "check-multiline-start"],
"match-default-export-name": true,
"no-boolean-literal-compare": true,
"no-default-export": true,
"no-default-import": true,
"no-duplicate-variable": [true, "check-parameters"],
"no-dynamic-delete": true,
"no-implicit-dependencies": [true, "dev"],
"no-inferred-empty-object-type": true,
"no-mergeable-namespace": true,
"no-null-keyword": true,
"no-null-undefined-union": true,
"no-promise-as-boolean": true,
"no-redundant-jsdoc": true,
"no-reference-import": true,
"no-restricted-globals": true,
"no-shadowed-variable": true,
"no-tautology-expression": true,
"no-unnecessary-callback-wrapper": true,
"no-unused-expression": true,
"object-literal-sort-keys": true,
"ordered-imports": [
true,
{
"grouped-imports": true,
"import-sources-order": "case-insensitive",
"named-imports-order": "case-insensitive",
"module-source-path": "full",
},
],
"prefer-conditional-expression": true,
"prefer-method-signature": true,
"prefer-switch": true,
"prefer-while": true,
"return-undefined": true,
"static-this": true,
"strict-boolean-expressions": true,
"strict-comparisons": true,
"strict-type-predicates": true,
"switch-final-break": true,
"unnecessary-else": true,
"use-default-type-parameter": true,
"variable-name": [true, "ban-keywords", "check-format", "require-const-for-all-caps"],
},
},
],
},
};
Loading