Skip to content

Angular 9 and EsLint #15

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

Open
wants to merge 1 commit 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
221 changes: 221 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
{
"env": {
"browser": true,
"node": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"overrides": [
{
"files": [
",*.component.ts"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"plugins": [
"@angular-eslint/template"
],
"processor": "@angular-eslint/template/extract-inline-html"
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint/eslint-plugin",
"import"
],
"rules": {
"@angular-eslint/component-class-suffix": "error",
"@angular-eslint/directive-class-suffix": "error",
"@angular-eslint/no-input-rename": "error",
"@angular-eslint/no-output-on-prefix": "error",
"@angular-eslint/no-output-rename": "error",
"@angular-eslint/use-pipe-transform-interface": "error",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "off",
"@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`?"
}
}
}
],
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/dot-notation": "error",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/member-ordering": "error",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "error",
"@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-unused-expressions": "error",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/quotes": [
"error",
"single"
],
"@typescript-eslint/triple-slash-reference": [
"error",
{
"path": "always",
"types": "prefer-import",
"lib": "always"
}
],
"@typescript-eslint/unified-signatures": "error",
"arrow-parens": [
"off",
"always"
],
"camelcase": "error",
"comma-dangle": "off",
"complexity": "off",
"constructor-super": "error",
"eqeqeq": [
"error",
"smart"
],
"guard-for-in": "error",
"id-blacklist": [
"error",
"any",
"Number",
"number",
"String",
"string",
"Boolean",
"boolean",
"Undefined",
"undefined"
],
"id-match": "error",
"import/no-deprecated": "warn",
"import/order": "off",
"max-classes-per-file": "off",
"max-len": [
"error",
{
"code": 140
}
],
"new-parens": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-cond-assign": "error",
"no-console": [
"error",
{
"allow": [
"log",
"warn",
"dir",
"timeLog",
"assert",
"clear",
"count",
"countReset",
"group",
"groupEnd",
"table",
"dirxml",
"error",
"groupCollapsed",
"Console",
"profile",
"profileEnd",
"timeStamp",
"context"
]
}
],
"no-debugger": "error",
"no-empty": "off",
"no-eval": "error",
"no-fallthrough": "error",
"no-invalid-this": "off",
"no-multiple-empty-lines": "off",
"no-new-wrappers": "error",
"no-restricted-imports": [
"error",
"rxjs/Rx"
],
"no-shadow": [
"error",
{
"hoist": "all"
}
],
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-underscore-dangle": "error",
"no-unsafe-finally": "error",
"no-unused-labels": "error",
"no-var": "error",
"object-shorthand": "error",
"one-var": [
"error",
"never"
],
"prefer-const": "error",
"quote-props": [
"error",
"as-needed"
],
"radix": "error",
"spaced-comment": [
"error",
"always",
{
"markers": [
"/"
]
}
],
"use-isnan": "error",
"valid-typeof": "off"
}
}
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ import { Component, ElementRef, OnDestroy, OnInit } from '@angular/core';

@Component({
selector: 'datatable',
template:""
template:''
})
export class DataTableComponent implements OnDestroy, OnInit {
private ui : webix.ui.datatable;
private ui: webix.ui.datatable;

constructor(root: ElementRef) {
this.ui = <webix.ui.datatable> webix.ui({
container: root.nativeElement
this.ui = webix.ui({
container: root.nativeElement,
view:"datatable", autoConfig:true, url:"data.php"
})
}) as webix.ui.datatable
}

ngOnInit(){
ngOnInit(): void {
this.ui.resize();
}
ngOnDestroy(){
ngOnDestroy(): void {
this.ui.destructor();
}
}
Expand Down Expand Up @@ -80,10 +80,10 @@ export class FilmService {
**app/components/datatable.ts**
```js
constructor(private films: FilmService, root: ElementRef) {
this.ui = <webix.ui.datatable> webix.ui({
this.ui = webix.ui({
container: root.nativeElement,
view:"datatable", autoConfig:true, data: this.films.getFilms()
})
}) as webix.ui.datatable
}
```

Expand All @@ -93,7 +93,7 @@ You can add a public method to the component to call any necessary public method

**app/components/datatable.js**
```js
addRow(){
addRow(): void{
this.ui.add({ title:"New row" });
}
```
Expand All @@ -105,17 +105,17 @@ You can expose events of Webix component through the `@Output` property:
**app/components/datatable.js**
```js
export class DataTableComponent implements OnDestroy, OnInit {
@Output() rowSelected = new EventEmitter<Film>();
private ui : webix.ui.datatable;
@Output() onRowSelect = new EventEmitter<Film>();

constructor(private films: FilmService, root: ElementRef) {
this.ui = <webix.ui.datatable> webix.ui({
this.ui = webix.ui({
container: root.nativeElement,
view:"datatable", autoConfig:true, data: this.films.getFilms(),
on:{
onAfterSelect: (id) => this.onRowSelect.emit(this.ui.getItem(id))
onAfterSelect: (id) => this.rowSelected.emit(this.ui.getItem(id))
}
})
}) as webix.ui.datatable
}
```

Expand All @@ -140,7 +140,7 @@ You can handle it in the parent component like this:
})
export class HTMLLayoutComponent {
private selectedFilm: Film;
fillInfo(film : Film){
fillInfo(film : Film): void{
this.selectedFilm = film;
}
}
Expand All @@ -161,15 +161,15 @@ export class MyLayoutComponent implements OnDestroy, OnInit {
private ui : webix.ui.datatable;

constructor(private films: FilmService, root: ElementRef) {
this.ui = <webix.ui.layout> webix.ui({
this.ui = webix.ui({
container: root.nativeElement,
view:"layout",
rows:[
some,
other,
{ cols:[ views, here ] }
]
})
}) as webix.ui.layout
}
```

Expand Down Expand Up @@ -206,7 +206,7 @@ There is no way to define *routerLink* attributes inside of Webix UI.
You need to use the `onItemClick` event of a component, if you need to route to a different view:

```js
this.ui = <webix.ui.menu>webix.ui({
this.ui = webix.ui({
container: root.nativeElement,
view: "menu", layout: "y", minHeight: 200, select: true,
data: [
Expand All @@ -217,7 +217,7 @@ You need to use the `onItemClick` event of a component, if you need to route to
on: {
onItemClick: (id) => this.router.navigate([id])
}
})
}) as webix.ui.menu
```

### Limitations
Expand Down
Loading