Skip to content
Snippets Groups Projects
Commit 497b15f5 authored by Martin Hamerník's avatar Martin Hamerník
Browse files

Merge branch '10-migrate-from-tslint-to-eslint' into 'master'

Resolve "Migrate from tslint to eslint"

Closes #10

See merge request muni-kypo-crp/frontend-angular/models/kypo2-angular-topology-model!13
parents 42150e4e d447451c
No related branches found
No related tags found
No related merge requests found
Showing with 4449 additions and 6558 deletions
{
"root": true,
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
"project": [
"tsconfig.*?.json"
],
"createDefaultProgram": true
},
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended"
],
"rules": {
"max-len": ["error", { "code": 140, "ignorePattern": "import .*" }],
"@angular-eslint/directive-selector": [
"error",
{ "type": "attribute", "prefix": "app", "style": "camelCase" }
],
"@angular-eslint/component-selector": [
"error",
{ "type": "element", "prefix": "app", "style": "kebab-case" }
],
"quotes": ["error", "single", { "allowTemplateLiterals": true }]
}
},
{
"files": ["*.component.html"],
"extends": ["plugin:@angular-eslint/template/recommended"],
"rules": {
"max-len": ["error", { "code": 140 }]
}
},
{
"files": ["*.component.ts"],
"extends": ["plugin:@angular-eslint/template/process-inline-templates"]
}
]
}
...@@ -87,18 +87,6 @@ ...@@ -87,18 +87,6 @@
"src/assets" "src/assets"
] ]
} }
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
} }
} }
}, },
...@@ -117,15 +105,6 @@ ...@@ -117,15 +105,6 @@
"devServerTarget": "graph-topology-model:serve:production" "devServerTarget": "graph-topology-model:serve:production"
} }
} }
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
} }
} }
}, },
...@@ -143,9 +122,9 @@ ...@@ -143,9 +122,9 @@
}, },
"configurations": { "configurations": {
"production": { "production": {
"project": "projects/kypo2-topology-graph-model/ng-package.prod.json" "project": "projects/kypo2-topology-graph-model/ng-package.prod.json",
, "tsConfig": "projects/kypo2-topology-graph-model/tsconfig.lib.prod.json" "tsConfig": "projects/kypo2-topology-graph-model/tsconfig.lib.prod.json"
} }
} }
}, },
"test": { "test": {
...@@ -157,14 +136,11 @@ ...@@ -157,14 +136,11 @@
} }
}, },
"lint": { "lint": {
"builder": "@angular-devkit/build-angular:tslint", "builder": "@angular-eslint/builder:lint",
"options": { "options": {
"tsConfig": [ "lintFilePatterns": [
"projects/kypo2-topology-graph-model/tsconfig.lib.json", "projects/kypo2-topology-graph-model/**/*.ts",
"projects/kypo2-topology-graph-model/tsconfig.spec.json" "projects/kypo2-topology-graph-model/**/*.component.html"
],
"exclude": [
"**/node_modules/**"
] ]
} }
} }
......
This diff is collapsed.
...@@ -6,9 +6,10 @@ ...@@ -6,9 +6,10 @@
"start": "ng serve", "start": "ng serve",
"build": "ng build", "build": "ng build",
"test": "ng test", "test": "ng test",
"lint": "ng lint", "lint": "ng lint && npm run prettier-check",
"e2e": "ng e2e", "e2e": "ng e2e",
"ci-test": "ng test --browsers ChromeHeadless --watch=false", "ci-test": "ng test --browsers ChromeHeadless --watch=false",
"prettier-check": "prettier --check \"projects/**/*.ts\"",
"build-library": "ng build --prod kypo2-topology-graph-model", "build-library": "ng build --prod kypo2-topology-graph-model",
"create-package": "cd dist/kypo2-topology-graph-model && npm pack", "create-package": "cd dist/kypo2-topology-graph-model && npm pack",
"build-and-pack": "npm install && npm run build-library && npm run create-package", "build-and-pack": "npm install && npm run build-library && npm run create-package",
...@@ -18,7 +19,7 @@ ...@@ -18,7 +19,7 @@
}, },
"husky": { "husky": {
"hooks": { "hooks": {
"pre-commit": "ng lint" "pre-commit": "npm run prettier-check"
} }
}, },
"private": false, "private": false,
...@@ -41,15 +42,22 @@ ...@@ -41,15 +42,22 @@
"@angular/compiler-cli": "^10.0.0", "@angular/compiler-cli": "^10.0.0",
"@angular-devkit/build-ng-packagr": "~0.1000.0", "@angular-devkit/build-ng-packagr": "~0.1000.0",
"@angular-devkit/build-angular": "~0.1000.0", "@angular-devkit/build-angular": "~0.1000.0",
"@angular/language-service": "^10.0.0",
"@angular-eslint/builder": "^0.8.0-beta.0",
"@angular-eslint/eslint-plugin": "^0.8.0-beta.0",
"@angular-eslint/eslint-plugin-template": "^0.8.0-beta.0",
"@angular-eslint/schematics": "^0.8.0-beta.0",
"@angular-eslint/template-parser": "^0.8.0-beta.0",
"@typescript-eslint/parser": "^4.3.0",
"@typescript-eslint/eslint-plugin": "^4.7.0",
"eslint": "^7.13.0",
"ng-packagr": "^10.0.0", "ng-packagr": "^10.0.0",
"typescript": "~3.9.5", "typescript": "~3.9.5",
"@angular/cli": "~10.0.0", "@angular/cli": "~10.0.0",
"@types/d3": "^5.0.0", "@types/d3": "^5.0.0",
"@angular/language-service": "^10.0.0",
"@types/jasmine": "~2.8.6", "@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3", "@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1", "@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0", "jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0", "jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0", "karma": "~5.0.0",
...@@ -57,12 +65,9 @@ ...@@ -57,12 +65,9 @@
"karma-coverage-istanbul-reporter": "~3.0.2", "karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~3.3.0", "karma-jasmine": "~3.3.0",
"karma-jasmine-html-reporter": "^1.5.0", "karma-jasmine-html-reporter": "^1.5.0",
"tslint-config-prettier": "1.18.0",
"tslint-plugin-prettier": "2.3.0",
"husky": "^4.2.5", "husky": "^4.2.5",
"prettier": "2.0.4", "prettier": "2.0.4",
"protractor": "~7.0.0", "protractor": "~7.0.0",
"ts-node": "~5.0.1", "ts-node": "~5.0.1"
"tslint": "~6.1.0"
} }
} }
{
"extends": ["../../.eslintrc.json"],
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
"project": ["projects/kypo2-topology-graph-model/tsconfig.*?.json"],
"createDefaultProgram": true
},
"rules": {
"@angular-eslint/directive-selector": [
"error",
{ "type": "attribute", "prefix": "kypo", "style": "camelCase" }
],
"@angular-eslint/component-selector": [
"error",
{ "type": "element", "prefix": "kypo", "style": "kebab-case" }
]
}
},
{
"files": ["*.component.html"],
"rules": {}
}
]
}
...@@ -37,6 +37,4 @@ export class Link implements SimulationLinkDatum<Node> { ...@@ -37,6 +37,4 @@ export class Link implements SimulationLinkDatum<Node> {
* Type of link * Type of link
*/ */
type: LinkTypeEnum; type: LinkTypeEnum;
constructor() {}
} }
...@@ -7,9 +7,7 @@ export class NodePort { ...@@ -7,9 +7,7 @@ export class NodePort {
ip?: string; ip?: string;
mac?: string; mac?: string;
constructor() {} toString(): string {
toString() {
let result = 'Name: ' + this.name + '\n'; let result = 'Name: ' + this.name + '\n';
if (this.ip !== null && this.ip !== '') { if (this.ip !== null && this.ip !== '') {
result += 'IP address: ' + this.ip + '\n'; result += 'IP address: ' + this.ip + '\n';
......
...@@ -5,7 +5,7 @@ import { NodePort } from '../node-port/node-port'; ...@@ -5,7 +5,7 @@ import { NodePort } from '../node-port/node-port';
/** /**
* Node interface extends D3 Node interface and implents coordinate attributes for the purposes of force graph simulation (visualization) * Node interface extends D3 Node interface and implents coordinate attributes for the purposes of force graph simulation (visualization)
*/ */
// tslint:disable-next-line:interface-name // eslint-disable-next-line @typescript-eslint/naming-convention
export interface INode extends SimulationNodeDatum { export interface INode extends SimulationNodeDatum {
x?: number; x?: number;
y?: number; y?: number;
......
...@@ -24,8 +24,6 @@ export abstract class Node implements INode { ...@@ -24,8 +24,6 @@ export abstract class Node implements INode {
*/ */
nodePorts: NodePort[]; nodePorts: NodePort[];
protected constructor() {}
public toString = (): string => { public toString = (): string => {
let result = 'Name: ' + this.name + '\n'; let result = 'Name: ' + this.name + '\n';
result += 'Physical role: ' + this.physicalRole + '\n'; result += 'Physical role: ' + this.physicalRole + '\n';
......
...@@ -28,7 +28,7 @@ export class SwitchNode extends Node { ...@@ -28,7 +28,7 @@ export class SwitchNode extends Node {
* Router is role for revealed subnet * Router is role for revealed subnet
* Cloud is role for hidden subnet * Cloud is role for hidden subnet
*/ */
public changeSwitchPhysicalRole() { public changeSwitchPhysicalRole(): void {
if (this.physicalRole === NodePhysicalRoleEnum.Switch) { if (this.physicalRole === NodePhysicalRoleEnum.Switch) {
this.physicalRole = NodePhysicalRoleEnum.Cloud; this.physicalRole = NodePhysicalRoleEnum.Cloud;
} else if (this.physicalRole === NodePhysicalRoleEnum.Cloud) { } else if (this.physicalRole === NodePhysicalRoleEnum.Cloud) {
......
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"lib",
"camelCase"
],
"component-selector": [
true,
"element",
"lib",
"kebab-case"
]
}
}
{
"extends": "../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
]
}
}
{
"extends": ["tslint:recommended", "tslint-config-prettier", "tslint-plugin-prettier"],
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"prettier": true,
"interface-name" : [true, "never-prefix"],
"align": {
"options": ["parameters", "statements"]
},
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"deprecation": {
"severity": "warn"
},
"eofline": true,
"forin": true,
"import-blacklist": [
true,
"rxjs/Rx"
],
"import-spacing": true,
"indent": [
true,
"spaces"
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
{
"limit": 140,
"ignore-pattern": "^import |^export {(.*?)}|class [a-zA-Z]+ implements |loadChildren:"
}
],
"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-trailing-whitespace": true,
"no-unnecessary-initializer": true,
"no-unused-expression": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
true,
"always",
"ignore-bound-class-methods"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"unified-signatures": true,
"variable-name": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"no-output-on-prefix": true,
"no-inputs-metadata-property": true,
"no-outputs-metadata-property": true,
"no-host-metadata-property": true,
"no-input-rename": true,
"no-output-rename": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment