TSK-976: Set up eslint

This commit is contained in:
BVier 2019-12-19 16:04:56 +01:00 committed by Mustapha Zorgati
parent e2e7acacc6
commit 431878acbd
4 changed files with 1528 additions and 94 deletions

105
web/.eslintrc.js Normal file
View File

@ -0,0 +1,105 @@
module.exports = {
"extends": [
"airbnb-typescript/base"
],
"env": {
"browser": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
},
"plugins": [
"@typescript-eslint",
"@typescript-eslint/tslint"
],
"rules": {
"arrow-parens": ["off", "as-needed"],
"@typescript-eslint/indent": ['off', 2],
"import/extensions": "off",
"import/no-unresolved": "off",
"max-classes-per-file": "off",
"max-len": ["off", { "code": 140, "ignorePattern": "import *" }], // smaller than 140?
"no-plusplus": "off",
"object-curly-newline": ["off", { "ImportDeclaration": "never" }],
"quote-props": ["warn", "as-needed"],
// This rules shall be activated after they were corrected
//"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
//"comma-dangle": ["error", "only-multiline"],
//"function-paren-newline": ["error", "consistent"],
//"no-underscore-dangle": ["error", { "allow": ["_links", "__karma__"] }],
//"no-param-reassign": ["error", { "props": false }],
// all following rules SHOULD be removed
"class-methods-use-this": "off",
"import/order": "off",
"import/prefer-default-export": "off",
"no-underscore-dangle": "off",
"no-useless-escape": "off",
"object-curly-spacing": "off",
"padded-blocks": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/semi": "off",
// all following rules MUST be removed (mostly autofix)
"linebreak-style": ["off", "unix"], // own PR
"comma-dangle": "off",
"function-paren-newline": "off",
"lines-between-class-members": "off",
"no-restricted-syntax": "off",
"consistent-return": "off",
"no-return-assign": "off",
"prefer-destructuring": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-useless-constructor": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/camelcase": "off",
"no-multi-assign": "off",
"no-param-reassign": "off",
"no-new-object": "off",
"array-callback-return": "off",
"no-mixed-operators": "off",
"no-multi-str": "off",
"no-nested-ternary": "off",
"no-sequences": "off",
"no-tabs": "off",
"no-self-assign": "off",
"global-require": "off",
"no-prototype-builtins": "off",
"no-else-return": "off",
"prefer-template": "off",
"dot-notation": "off",
"quote-props": "off",
"comma-style": "off",
"@typescript-eslint/quotes": "off",
"array-bracket-spacing": "off",
"no-unexpected-multiline": "off",
"@typescript-eslint/func-call-spacing": "off",
"no-spaced-func": "off",
"no-multi-spaces": "off",
"prefer-arrow-callback": "off",
"func-names": "off",
"operator-linebreak": "off",
"no-extra-semi": "off",
"arrow-body-style": "off",
"no-var": "off",
"import/newline-after-import": 0,
"import/no-duplicates": 0,
"one-var": 0,
"one-var-declaration-per-line": 0,
"object-property-newline": 0,
"space-before-function-paren": 0,
"comma-spacing": 0,
"object-shorthand": 0,
"no-multiple-empty-lines": 0,
"space-in-parens": 0,
"prefer-object-spread": 0,
"operator-assignment": 0,
"import/no-useless-path-segments": 0,
"no-undef-init": 0,
"@typescript-eslint/no-array-constructor": 0,
}
};

1427
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,12 +10,13 @@
"build:prod-silent": "ng build --prod=true --no-progress",
"test": "ng test --karma-config karma.conf.js --watch=false --browsers Firefox",
"test:watch": "ng test --karma-config karma.conf.js --browsers Chrome",
"lint": "ng lint"
"lint": "eslint src/app/**/*.ts"
},
"private": true,
"dependencies": {
"@angular/animations": "^8.2.14",
"@angular/common": "^8.2.14",
"@angular/core": "^8.2.14",
"@angular/forms": "^8.2.14",
"@angular/platform-browser": "^8.2.14",
"@angular/platform-browser-dynamic": "^8.2.14",
@ -46,9 +47,15 @@
"@angular/core": "^8.2.14",
"@types/jasmine": "2.8.4",
"@types/node": "9.3.0",
"@typescript-eslint/eslint-plugin": "^2.7.0",
"@typescript-eslint/eslint-plugin-tslint": "^2.12.0",
"@typescript-eslint/parser": "^2.12.0",
"ajv": "^6.10.2",
"codelyzer": "^5.2.0",
"diff": "^3.5.0",
"eslint": "^6.7.2",
"eslint-config-airbnb-typescript": "^6.3.1",
"eslint-plugin-import": "^2.18.2",
"hoek": "5.0.3",
"jasmine-core": "^3.5.0",
"jasmine-spec-reporter": "4.2.1",
@ -64,7 +71,6 @@
"protractor": "5.4.0",
"ts-mockito": "2.3.0",
"ts-node": "4.1.0",
"tslint": "5.9.1",
"typescript": "3.5.3"
}
}

View File

@ -1,80 +0,0 @@
{
"rulesDirectory": [
"node_modules/tslint/lib",
"node_modules/codelyzer"
],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"deprecation": {
"severity": "warn"
},
"forin": true,
"import-blacklist": [true, "rxjs/Rx"],
"indent": [
true,
"spaces"
],
"interface-over-type-literal": true,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
{
"order": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"no-arg": true,
"no-bitwise": true,
"no-console": [true, "debug", "info", "time", "timeEnd", "trace"],
"no-construct": true,
"no-debugger": true,
"no-duplicate-super": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [true, "ignore-params"],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-unnecessary-initializer": true,
"no-unused-expression": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"triple-equals": [true, "allow-null-check"],
"unified-signatures": true,
"variable-name": false,
"directive-selector": [true, "attribute", "taskana", "camelCase"],
"component-selector": [true, "element", "taskana", "kebab-case"],
"no-conflicting-lifecycle": true,
"no-host-metadata-property": true,
"no-input-rename": true,
"no-inputs-metadata-property": true,
"no-output-native": true,
"no-output-on-prefix": true,
"no-output-rename": true,
"no-outputs-metadata-property": true,
"template-banana-in-box": true,
"template-no-negated-async": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": true
}
}