diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..47c17dd --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,50 @@ +{ + "root": true, + "ignorePatterns": [ + "projects/**/*" + ], + "overrides": [ + { + "files": [ + "*.ts" + ], + "parserOptions": { + "project": [ + "tsconfig.json" + ], + "createDefaultProgram": true + }, + "extends": [ + "plugin:@angular-eslint/recommended", + "plugin:@angular-eslint/template/process-inline-templates" + ], + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "app", + "style": "camelCase" + } + ], + "@angular-eslint/component-selector": [ + "error", + { + "type": "element", + "prefix": "app", + "style": "kebab-case" + } + ] + } + }, + { + "files": [ + "*.html" + ], + "extends": [ + "plugin:@angular-eslint/template/recommended" + ], + "rules": {} + } + ] +} diff --git a/angular.json b/angular.json index cf04de0..95a5daf 100644 --- a/angular.json +++ b/angular.json @@ -1,111 +1,125 @@ { - "$schema": "./node_modules/@angular/cli/lib/config/schema.json", - "version": 1, - "newProjectRoot": "projects", - "projects": { - "sakai": { - "projectType": "application", - "schematics": { - "@schematics/angular:component": { - "style": "scss" - } - }, - "root": "", - "sourceRoot": "src", - "prefix": "app", - "architect": { - "build": { - "builder": "@angular-devkit/build-angular:browser", - "options": { - "outputPath": "dist/sakai-ng", - "index": "src/index.html", - "main": "src/main.ts", - "polyfills": "src/polyfills.ts", - "tsConfig": "tsconfig.app.json", - "inlineStyleLanguage": "scss", - "assets": [ - "src/favicon.ico", - "src/assets" - ], - "styles": [ - "src/styles.scss" - ], - "allowedCommonJsDependencies": ["chart.js"] - }, - "configurations": { - "production": { - "budgets": [ - { - "type": "initial", - "maximumWarning": "3mb", - "maximumError": "5mb" - }, - { - "type": "anyComponentStyle", - "maximumWarning": "6kb", - "maximumError": "10kb" - } - ], - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.prod.ts" - } - ], - "outputHashing": "all" - }, - "development": { - "buildOptimizer": false, - "optimization": false, - "vendorChunk": true, - "extractLicenses": false, - "sourceMap": true, - "namedChunks": true - } - }, - "defaultConfiguration": "production" - }, - "serve": { - "builder": "@angular-devkit/build-angular:dev-server", - "configurations": { - "production": { - "browserTarget": "sakai:build:production" - }, - "development": { - "browserTarget": "sakai:build:development" - } - }, - "defaultConfiguration": "development" - }, - "extract-i18n": { - "builder": "@angular-devkit/build-angular:extract-i18n", - "options": { - "browserTarget": "sakai:build" - } - }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "src/test.ts", - "polyfills": "src/polyfills.ts", - "tsConfig": "tsconfig.spec.json", - "karmaConfig": "karma.conf.js", - "inlineStyleLanguage": "scss", - "assets": [ - "src/favicon.ico", - "src/assets" - ], - "styles": [ - "src/styles.scss" - ], - "scripts": [] - } - } - } + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "sakai": { + "projectType": "application", + "schematics": { + "@schematics/angular:component": { + "style": "scss" } - }, - "defaultProject": "sakai", - "cli": { - "analytics": false + }, + "root": "", + "sourceRoot": "src", + "prefix": "app", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/sakai-ng", + "index": "src/index.html", + "main": "src/main.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.app.json", + "inlineStyleLanguage": "scss", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.scss" + ], + "allowedCommonJsDependencies": [ + "chart.js" + ] + }, + "configurations": { + "production": { + "budgets": [ + { + "type": "initial", + "maximumWarning": "3mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" + } + ], + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ], + "outputHashing": "all" + }, + "development": { + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "configurations": { + "production": { + "browserTarget": "sakai:build:production" + }, + "development": { + "browserTarget": "sakai:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "sakai:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.spec.json", + "karmaConfig": "karma.conf.js", + "inlineStyleLanguage": "scss", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.scss" + ], + "scripts": [] + } + }, + "lint": { + "builder": "@angular-eslint/builder:lint", + "options": { + "lintFilePatterns": [ + "src/**/*.ts", + "src/**/*.html" + ] + } + } + } } + }, + "defaultProject": "sakai", + "cli": { + "analytics": false, + "schematicCollections": [ + "@angular-eslint/schematics" + ] + } } diff --git a/package.json b/package.json index 10eb66d..0fc38c5 100644 --- a/package.json +++ b/package.json @@ -1,52 +1,61 @@ { - "name": "sakai-ng", - "version": "14.0.4-SNAPSHOT", - "scripts": { - "ng": "ng", - "start": "ng serve", - "build": "ng build", - "watch": "ng build --watch --configuration development", - "test": "ng test" - }, - "private": true, - "dependencies": { - "@angular/animations": "~14.0.0", - "@angular/cdk": "~14.0.0", - "@angular/common": "~14.0.0", - "@angular/compiler": "~14.0.0", - "@angular/core": "~14.0.0", - "@angular/forms": "~14.0.0", - "@angular/platform-browser": "~14.0.0", - "@angular/platform-browser-dynamic": "~14.0.0", - "@angular/router": "~14.0.0", - "chart.js": "^3.3.2", - "primeflex": "^3.2.0", - "primeicons": "6.0.1", - "primeng": "14.1.2", - "rxjs": "~7.5.0", - "tslib": "^2.3.0", - "web-animations-js": "^2.3.2", - "zone.js": "~0.11.4" - }, - "devDependencies": { - "@angular-devkit/build-angular": "^14.2.6", - "@angular/cli": "~14.0.3", - "@angular/compiler-cli": "~14.0.0", - "@types/jasmine": "~3.10.0", - "@types/jasminewd2": "~2.0.8", - "@types/node": "^12.11.1", - "codelyzer": "^6.0.0", - "jasmine-core": "~3.10.0", - "jasmine-spec-reporter": "~5.0.0", - "karma": "~6.3.0", - "karma-chrome-launcher": "~3.1.0", - "karma-coverage": "~2.2.0", - "karma-coverage-istanbul-reporter": "~3.0.3", - "karma-jasmine": "~4.0.0", - "karma-jasmine-html-reporter": "~1.7.0", - "protractor": "~7.0.0", - "ts-node": "~8.3.0", - "tslint": "~6.1.0", - "typescript": "~4.7.2" - } -} + "name": "sakai-ng", + "version": "14.0.4-SNAPSHOT", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build": "ng build", + "watch": "ng build --watch --configuration development", + "test": "ng test", + "lint": "ng lint" + }, + "private": true, + "dependencies": { + "@angular/animations": "~14.0.0", + "@angular/cdk": "~14.0.0", + "@angular/common": "~14.0.0", + "@angular/compiler": "~14.0.0", + "@angular/core": "~14.0.0", + "@angular/forms": "~14.0.0", + "@angular/platform-browser": "~14.0.0", + "@angular/platform-browser-dynamic": "~14.0.0", + "@angular/router": "~14.0.0", + "chart.js": "^3.3.2", + "primeflex": "^3.2.0", + "primeicons": "6.0.1", + "primeng": "14.1.2", + "rxjs": "~7.5.0", + "tslib": "^2.3.0", + "web-animations-js": "^2.3.2", + "zone.js": "~0.11.4" + }, + "devDependencies": { + "@angular-devkit/build-angular": "^14.2.6", + "@angular-eslint/builder": "14.1.2", + "@angular-eslint/eslint-plugin": "14.1.2", + "@angular-eslint/eslint-plugin-template": "14.1.2", + "@angular-eslint/schematics": "14.1.2", + "@angular-eslint/template-parser": "14.1.2", + "@angular/cli": "~14.0.3", + "@angular/compiler-cli": "~14.0.0", + "@types/jasmine": "~3.10.0", + "@types/jasminewd2": "~2.0.8", + "@types/node": "^12.11.1", + "@typescript-eslint/eslint-plugin": "5.37.0", + "@typescript-eslint/parser": "5.37.0", + "codelyzer": "^6.0.0", + "eslint": "^8.23.1", + "jasmine-core": "~3.10.0", + "jasmine-spec-reporter": "~5.0.0", + "karma": "~6.3.0", + "karma-chrome-launcher": "~3.1.0", + "karma-coverage": "~2.2.0", + "karma-coverage-istanbul-reporter": "~3.0.3", + "karma-jasmine": "~4.0.0", + "karma-jasmine-html-reporter": "~1.7.0", + "protractor": "~7.0.0", + "ts-node": "~8.3.0", + "tslint": "~6.1.0", + "typescript": "~4.7.2" + } +} \ No newline at end of file diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 2bba850..f7b5e9b 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,10 +1,11 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { PrimeNGConfig } from 'primeng/api'; + @Component({ selector: 'app-root', templateUrl: './app.component.html' }) -export class AppComponent { +export class AppComponent implements OnInit { constructor(private primengConfig: PrimeNGConfig) { } diff --git a/src/app/demo/components/pages/timeline/timelinedemo.component.ts b/src/app/demo/components/pages/timeline/timelinedemo.component.ts index 1cb03a1..738a53b 100644 --- a/src/app/demo/components/pages/timeline/timelinedemo.component.ts +++ b/src/app/demo/components/pages/timeline/timelinedemo.component.ts @@ -1,11 +1,11 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { PrimeIcons } from 'primeng/api'; @Component({ templateUrl: './timelinedemo.component.html', styleUrls: ['./timelinedemo.scss'] }) -export class TimelineDemoComponent { +export class TimelineDemoComponent implements OnInit { events1: any[] = []; diff --git a/src/app/demo/components/primeblocks/blockviewer/blockviewer.component.ts b/src/app/demo/components/primeblocks/blockviewer/blockviewer.component.ts index d68dfd5..4e6d35d 100644 --- a/src/app/demo/components/primeblocks/blockviewer/blockviewer.component.ts +++ b/src/app/demo/components/primeblocks/blockviewer/blockviewer.component.ts @@ -6,6 +6,7 @@ enum BlockView { } @Component({ + // eslint-disable-next-line @angular-eslint/component-selector selector: 'block-viewer', template: `