Skip to content

Commit

Permalink
chore: migrating from tslint to eslint
Browse files Browse the repository at this point in the history
tslint has been deprecated.
Using eslint as standard linter for Angular.

BREAKING CHANGE: eslint as default linter
  • Loading branch information
ElonH committed Jul 6, 2020
1 parent 60a5a82 commit a66ec4f
Show file tree
Hide file tree
Showing 8 changed files with 1,688 additions and 65 deletions.
6 changes: 5 additions & 1 deletion .editorconfig
Expand Up @@ -3,7 +3,7 @@ root = true

[*]
charset = utf-8
indent_style = space
indent_style = tab
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
Expand All @@ -14,3 +14,7 @@ quote_type = single
[*.md]
max_line_length = off
trim_trailing_whitespace = false

[{package*.json}]
indent_style = space
indent_size = 2
288 changes: 288 additions & 0 deletions .eslintrc.json
@@ -0,0 +1,288 @@
{
"env": {
"browser": true,
"es2020": true
},
"plugins": ["@typescript-eslint"],
"extends": ["plugin:@angular-eslint/recommended"],
"overrides": [
{
// general
"files": ["*.ts"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"plugins": ["eslint-plugin-prefer-arrow", "jsdoc"],
"extends": [
// "eslint:recommended",
// "plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:jsdoc/recommended"
],
"rules": {
"@typescript-eslint/dot-notation": "warn",
"import/no-deprecated": "warn",
"import/no-extraneous-dependencies": "error",
"import/no-internal-modules": [
// https://github.com/benmosher/eslint-plugin-import/issues/1430
"off",
{
"allow": [
"rxjs/*",
"@angular/platform-browser/*",
"@angular/core/testing/*",
"@angular/core/testing",
"@angular/router/testing/*",
"@angular/platform-browser-dynamic/*",
"zone.js/**"
]
}
],
"import/order": "warn",
"import/no-unresolved": "error",
"import/named": "error",
"import/no-self-import": "error",
// TODO: NavigationFlowOutNode, NavigationFlow
// "import/no-cycle": "error",
"import/newline-after-import": "error"
}
},
{
// prettier
"files": ["*.ts", "*.json"],
"extends": ["plugin:prettier/recommended"]
},
{
"files": ["*.component.ts"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"plugins": ["@angular-eslint/template"],
"processor": "@angular-eslint/template/extract-inline-html"
}
],
"rules": {
"@angular-eslint/component-class-suffix": "error",
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"@angular-eslint/contextual-lifecycle": "error",
"@angular-eslint/directive-class-suffix": "error",
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/no-conflicting-lifecycle": "error",
"@angular-eslint/no-host-metadata-property": "error",
"@angular-eslint/no-input-rename": "error",
"@angular-eslint/no-inputs-metadata-property": "error",
"@angular-eslint/no-output-native": "error",
"@angular-eslint/no-output-on-prefix": "error",
"@angular-eslint/no-output-rename": "error",
"@angular-eslint/no-outputs-metadata-property": "error",
"@angular-eslint/use-component-view-encapsulation": "error",
"@angular-eslint/use-lifecycle-interface": "error",
"@angular-eslint/use-pipe-decorator": "error",
"@angular-eslint/use-pipe-transform-interface": "error",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "warn",
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"Object": {
"message": "Avoid using the `Object` type. Did you mean `object`?"
},
"Function": {
"message": "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."
},
"Boolean": {
"message": "Avoid using the `Boolean` type. Did you mean `boolean`?"
},
"Number": {
"message": "Avoid using the `Number` type. Did you mean `number`?"
},
"String": {
"message": "Avoid using the `String` type. Did you mean `string`?"
},
"Symbol": {
"message": "Avoid using the `Symbol` type. Did you mean `symbol`?"
}
}
}
],
// Definition for rule "@typescript-eslint/class-name-casing" was not found
"@typescript-eslint/class-name-casing": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/consistent-type-definitions": "error",
// You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
// using prettier as formater
"@typescript-eslint/indent": "off",
// Definition for rule "@typescript-eslint/interface-name-prefix" was not found
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/member-delimiter-style": [
"warn",
{
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}
],
"@typescript-eslint/member-ordering": "error",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@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": "off",
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "warn",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/quotes": "off",
"@typescript-eslint/semi": ["error"],
"@typescript-eslint/triple-slash-reference": [
"error",
{
"path": "always",
"types": "prefer-import",
"lib": "always"
}
],
"@typescript-eslint/type-annotation-spacing": "warn",
"@typescript-eslint/unified-signatures": "error",
"arrow-body-style": ["warn", "as-needed"],
"arrow-parens": [
"warn",
"as-needed",
{
"requireForBlockBody": false
}
],
"brace-style": ["off", "off"],
"camelcase": "error",
"comma-dangle": "off",
"complexity": "off",
"constructor-super": "error",
"curly": "off",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
"dot-notation": "off",
"eol-last": "off",
"eqeqeq": ["error", "smart"],
"guard-for-in": "error",
// "id-blacklist": [
// "error",
// "any",
// "Number",
// "number",
// "String",
// "string",
// "Boolean",
// "boolean",
// "Undefined",
// "undefined"
// ],
"id-match": "error",
"linebreak-style": "off",
"max-classes-per-file": "off",
"max-len": "off",
"new-parens": "off",
"newline-per-chained-call": "off",
"no-bitwise": "error",
"no-caller": "error",
"no-cond-assign": "error",
"no-console": [
"error",
{
"allow": ["error"]
}
],
"no-debugger": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-empty": "off",
"no-eval": "error",
"no-extra-bind": "error",
"no-extra-semi": "off",
"no-fallthrough": "error",
"no-invalid-this": "off",
"no-irregular-whitespace": "off",
"no-multiple-empty-lines": "off",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-redeclare": "warn",
"no-restricted-imports": ["error", "rxjs/Rx"],
"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-unneeded-ternary": "error",
"no-unsafe-finally": "error",
"no-unused-labels": "error",
"no-var": "error",
"object-shorthand": "error",
"one-var": ["error", "never"],
// TODO:
// "prefer-arrow/prefer-arrow-functions": "error",
"prefer-const": "error",
"prefer-object-spread": "error",
"quotes": "off",
"quote-props": "off",
"radix": "error",
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md
"semi": "off",
"space-before-function-paren": "off",
"space-in-parens": ["off", "never"],
"spaced-comment": [
"error",
"always",
{
"markers": ["/"]
}
],
"use-isnan": "error",
"valid-typeof": "off"
}
}
22 changes: 22 additions & 0 deletions .vscode/extensions.json
@@ -0,0 +1,22 @@
{
"recommendations": [
"angular.ng-template",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"natewallace.angular2-inline",
"cyrilletuzi.angular-schematics",
"kamikillerto.vscode-colorize",
"msjsdiag.debugger-for-chrome",
"dbaeumer.vscode-eslintd",
"oderwat.indent-rainbow",
"2gua.rainbow-brackets",
"mrmlnc.vscode-scss",
"nrwl.angular-console",
"editorconfig.editorconfig",
"johnpapa.angular2",
"christian-kohler.path-intellisense",
"formulahendry.auto-close-tag",
"gruntfuggly.todo-tree",
"wayou.vscode-todo-highlight"
]
}

0 comments on commit a66ec4f

Please sign in to comment.