From 768d0f64cbe2c8008b3f90e1c8a5b9a508250951 Mon Sep 17 00:00:00 2001 From: "pavel.a" Date: Mon, 11 Feb 2019 17:53:12 +0300 Subject: [PATCH] #136 Added Angular 7+ lib building support --- README.md | 23 ++-- angular.json | 76 +++++++++++ e2e/protractor.conf.js | 28 ++++ e2e/src/app.e2e-spec.ts | 23 ++++ e2e/src/app.po.ts | 11 ++ e2e/tsconfig.e2e.json | 13 ++ ng-package.json | 7 + package.json | 203 +++++++++++++--------------- public_api.ts | 7 + src/inline-editor.component.html | 9 +- src/inline-editor.component.spec.ts | 25 ++++ src/inline-editor.service.spec.ts | 12 ++ src/inline-editor.service.ts | 6 +- src/inputs/input.component.css | 19 +-- src/themes/bootstrap.css | 52 ------- src/themes/bootstrap.scss | 59 ++++++++ src/tsconfig.json | 29 ---- tsconfig.json | 48 +++---- tslint.json | 100 +++++++------- 19 files changed, 459 insertions(+), 291 deletions(-) create mode 100644 angular.json create mode 100644 e2e/protractor.conf.js create mode 100644 e2e/src/app.e2e-spec.ts create mode 100644 e2e/src/app.po.ts create mode 100644 e2e/tsconfig.e2e.json create mode 100644 ng-package.json create mode 100644 public_api.ts create mode 100644 src/inline-editor.component.spec.ts create mode 100644 src/inline-editor.service.spec.ts delete mode 100644 src/themes/bootstrap.css create mode 100644 src/themes/bootstrap.scss delete mode 100644 src/tsconfig.json diff --git a/README.md b/README.md index 693a91b..22d9663 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Native UI Inline-editor Angular (version 4+) component ([demo](demos)) +# Native UI Inline-editor Angular (version 7+) component ([demo](demos)) Follow me [![twitter](https://img.shields.io/twitter/follow/carlillo.svg?style=social&label=%20carlillo)](https://twitter.com/carlillo) to be notified about new releases. -ngx-inline-editor is a library of Angular (version 4+) that allows you to create editable elements. +ngx-inline-editor is a library of Angular (version 7+) that allows you to create editable elements. Such technique is also known as *click-to-edit* or *edit-in-place*. It is based on ideas of [angular-xeditable](https://github.com/vitalets/angular-xeditable) which is developed in AngularJS. @@ -10,13 +10,13 @@ It is based on ideas of [angular-xeditable](https://github.com/vitalets/angular- ![Version 0.1.0](https://github.com/qontu/ngx-inline-editor/raw/master/demos/basic/0.1.0.gif) ## Dependencies -Basically it does not depend on any libraries except Angular4 itself. +It depends on Font awesome v4.7.0 to show the icons. For themes you may need to include Twitter Bootstrap CSS. -### Angular 4+ Version +### Angular 7+ Version -Angular 4 is now stable. Therefore, if encountering errors using this -lib, ensure your version of Angular is compatible. The current version used to develop this lib is angular4 **^4.0.0**. +Angular 7 is now stable. Therefore, if encountering errors using this +lib, ensure your version of Angular is compatible. The current version used to develop this lib is angular4 **^7.2.0**. ## Controls & Features @@ -336,7 +336,7 @@ If the type is `select` then the default selected element is the first element o The `inline-editor` has the following basic theme which you can find in `dist/themes/bootstrap.css`: ```CSS -a.c-inline-editor { +:not([class='is-editing']) a.c-inline-editor { text-decoration: none; color: #428bca; border-bottom: dashed 1px #428bca; @@ -345,6 +345,9 @@ a.c-inline-editor { margin-right: 5px; margin-left: 5px; } +.btn { + margin-left:5px; +} .c-inline-editor.editable-empty, .c-inline-editor.editable-empty:hover, .c-inline-editor.editable-empty:focus, @@ -411,11 +414,7 @@ Thanks for understanding! 1. To generate all `*.js`, `*.js.map` and `*.d.ts` files: - `npm run build` - -2. To debug : - - `npm run build:watch` + `yarn build` ## Authors Carlos Caballero - [https://github.com/caballerog](hhttps://github.com/caballerog) diff --git a/angular.json b/angular.json new file mode 100644 index 0000000..b79587a --- /dev/null +++ b/angular.json @@ -0,0 +1,76 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "./", + "projects": { + "ngx-inline-editor": { + "root": "", + "sourceRoot": "src", + "projectType": "library", + "prefix": "ngx", + "schematics": { + "@schematics/angular:component": { + "styleext": "scss" + } + }, + "architect": { + "build": { + "builder": "@angular-devkit/build-ng-packagr:build", + "options": { + "tsConfig": "tsconfig.json", + "project": "ng-package.json" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "tsConfig": "tsconfig.spec.json", + "karmaConfig": "karma.conf.js" + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "tsconfig.json", + "tsconfig.spec.json" + ], + "exclude": [ + "**/node_modules/**" + ] + } + } + } + }, + "ngx-inline-editor-e2e": { + "root": "e2e/", + "projectType": "application", + "prefix": "", + "architect": { + "e2e": { + "builder": "@angular-devkit/build-angular:protractor", + "options": { + "protractorConfig": "e2e/protractor.conf.js", + "devServerTarget": "ngx-inline-editor:serve" + }, + "configurations": { + "production": { + "devServerTarget": "ngx-inline-editor:serve:production" + } + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": "e2e/tsconfig.e2e.json", + "exclude": [ + "**/node_modules/**" + ] + } + } + } + } + }, + "defaultProject": "ngx-inline-editor" +} diff --git a/e2e/protractor.conf.js b/e2e/protractor.conf.js new file mode 100644 index 0000000..86776a3 --- /dev/null +++ b/e2e/protractor.conf.js @@ -0,0 +1,28 @@ +// Protractor configuration file, see link for more information +// https://github.com/angular/protractor/blob/master/lib/config.ts + +const { SpecReporter } = require('jasmine-spec-reporter'); + +exports.config = { + allScriptsTimeout: 11000, + specs: [ + './src/**/*.e2e-spec.ts' + ], + capabilities: { + 'browserName': 'chrome' + }, + directConnect: true, + baseUrl: 'http://localhost:4200/', + framework: 'jasmine', + jasmineNodeOpts: { + showColors: true, + defaultTimeoutInterval: 30000, + print: function() {} + }, + onPrepare() { + require('ts-node').register({ + project: require('path').join(__dirname, './tsconfig.e2e.json') + }); + jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); + } +}; \ No newline at end of file diff --git a/e2e/src/app.e2e-spec.ts b/e2e/src/app.e2e-spec.ts new file mode 100644 index 0000000..e5bf870 --- /dev/null +++ b/e2e/src/app.e2e-spec.ts @@ -0,0 +1,23 @@ +import { AppPage } from './app.po'; +import { browser, logging } from 'protractor'; + +describe('workspace-project App', () => { + let page: AppPage; + + beforeEach(() => { + page = new AppPage(); + }); + + it('should display welcome message', () => { + page.navigateTo(); + expect(page.getTitleText()).toEqual('Welcome to ngx-inline-editor!'); + }); + + afterEach(async () => { + // Assert that there are no errors emitted from the browser + const logs = await browser.manage().logs().get(logging.Type.BROWSER); + expect(logs).not.toContain(jasmine.objectContaining({ + level: logging.Level.SEVERE, + })); + }); +}); diff --git a/e2e/src/app.po.ts b/e2e/src/app.po.ts new file mode 100644 index 0000000..72e463a --- /dev/null +++ b/e2e/src/app.po.ts @@ -0,0 +1,11 @@ +import { browser, by, element } from 'protractor'; + +export class AppPage { + navigateTo() { + return browser.get('/'); + } + + getTitleText() { + return element(by.css('app-root h1')).getText(); + } +} diff --git a/e2e/tsconfig.e2e.json b/e2e/tsconfig.e2e.json new file mode 100644 index 0000000..a6dd622 --- /dev/null +++ b/e2e/tsconfig.e2e.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/app", + "module": "commonjs", + "target": "es5", + "types": [ + "jasmine", + "jasminewd2", + "node" + ] + } +} \ No newline at end of file diff --git a/ng-package.json b/ng-package.json new file mode 100644 index 0000000..0d74f03 --- /dev/null +++ b/ng-package.json @@ -0,0 +1,7 @@ +{ + "$schema": "node_modules/ng-packagr/ng-package.schema.json", + "dest": "dist", + "lib": { + "entryFile": "./public_api.ts" + } +} diff --git a/package.json b/package.json index 60607c2..7150e7f 100644 --- a/package.json +++ b/package.json @@ -1,113 +1,98 @@ { - "name": "@qontu/ngx-inline-editor", - "version": "0.2.0-alpha.11", - "author": { - "name": "Carlos Caballero", - "email": "caballerog.carlos@gmail.com" - }, - "maintainers": [ - { - "name": "Carlos Caballero", - "email": "caballerog.carlos@gmail.com" + "name": "@qontu/ngx-inline-editor", + "version": "0.2.0-alpha.12", + "author": { + "name": "Carlos Caballero", + "email": "caballerog.carlos@gmail.com" }, - { - "name": "Toni Villena", - "email": "tonivj5@gmail.com" - } - ], - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/qontu/ngx-inline-editor" - }, - "bugs": { - "url": "https://github.com/qontu/ngx-inline-editor/issues" - }, - "keywords": [ - "angular", - "angular4" - ], - "main": "ngx-inline-editor.umd.js", - "module": "ngx-inline-editor.es5.js", - "es2015": "ngx-inline-editor.es2015.js", - "typings": "ngx-inline-editor.d.ts", - "scripts": { - "gulp": "node_modules/.bin/gulp", - "build": "node_modules/.bin/gulp build && echo 'To publish a new version of library, please use npm run publish'", - "build:watch": "node_modules/.bin/gulp", - "debug": "node_modules/.bin/gulp watch:debug", - "clean": "node_modules/.bin/gulp clean", - "commit": "node_modules/.bin/git-cz", - "lint": "tslint --type-check --project ./src/tsconfig.json src/**/*.ts", - "publish": "cd dist && npm publish", - "test": "karma start" - }, - "config": { - "commitizen": { - "path": "node_modules/cz-conventional-changelog" + "maintainers": [ + { + "name": "Carlos Caballero", + "email": "caballerog.carlos@gmail.com" + }, + { + "name": "Toni Villena", + "email": "tonivj5@gmail.com" + } + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/qontu/ngx-inline-editor" + }, + "bugs": { + "url": "https://github.com/qontu/ngx-inline-editor/issues" + }, + "keywords": [ + "angular", + "angular7" + ], + "main": "ngx-inline-editor.umd.js", + "module": "ngx-inline-editor.es5.js", + "es2015": "ngx-inline-editor.es2015.js", + "typings": "ngx-inline-editor.d.ts", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build": "ng build && yarn run css:build", + "test": "ng test", + "lint": "ng lint", + "e2e": "ng e2e", + "css:build": "scss-bundle -e ./src/themes/bootstrap.scss -d ./dist/themes/bootstrap.scss" + }, + "config": { + "commitizen": { + "path": "node_modules/cz-conventional-changelog" + } + }, + "dependencies": { + }, + "peerDependencies": { + "@angular/common": "^7.2.0", + "@angular/core": "^7.2.0", + "font-awesome": "^4.7.0" + }, + "devDependencies": { + "@angular/animations": "~7.2.0", + "@angular/common": "~7.2.0", + "@angular/compiler": "~7.2.0", + "@angular/core": "~7.2.0", + "@angular/forms": "~7.2.0", + "@angular/platform-browser": "~7.2.0", + "@angular/platform-browser-dynamic": "~7.2.0", + "@angular/router": "~7.2.0", + "bootstrap": "^4.2.1", + "core-js": "^2.5.4", + "font-awesome": "^4.7.0", + "rxjs": "~6.3.3", + "rxjs-compat": "6.1.0", + "scss-bundle": "^2.4.0", + "zone.js": "~0.8.26", + "@angular-devkit/build-angular": "~0.12.0", + "@angular-devkit/build-ng-packagr": "~0.12.0", + "@angular/cli": "~7.2.2", + "@angular/compiler-cli": "~7.2.0", + "@angular/language-service": "~7.2.0", + "@types/node": "~8.9.4", + "@types/jasmine": "~2.8.8", + "@types/jasminewd2": "~2.0.3", + "codelyzer": "~4.5.0", + "jasmine-core": "~2.99.1", + "jasmine-spec-reporter": "~4.2.1", + "karma": "~3.1.1", + "karma-chrome-launcher": "~2.2.0", + "karma-coverage-istanbul-reporter": "~2.0.1", + "karma-jasmine": "~1.1.2", + "karma-jasmine-html-reporter": "^0.2.2", + "ng-packagr": "^4.2.0", + "protractor": "~5.4.0", + "ts-node": "~7.0.0", + "tsickle": ">=0.34.0", + "tslib": "^1.9.0", + "tslint": "~5.11.0", + "typescript": "~3.2.2" + }, + "engines": { + "node": ">=6.0.0" } - }, - "dependencies": {}, - "peerDependencies": { - "@angular/common": "^4.0.0", - "@angular/core": "^4.0.0", - "@angular/forms": "^4.0.0" - }, - "devDependencies": { - "@angular/common": "^4.3.6", - "@angular/compiler": "^4.3.6", - "@angular/core": "^4.3.6", - "@angular/forms": "^4.3.6", - "@angular/platform-browser": "^4.3.6", - "@angular/platform-browser-dynamic": "^4.3.6", - "@types/del": "^2.2.32", - "@types/gulp": "4.0.3", - "@types/gulp-changed": "^0.0.31", - "@types/gulp-rename": "^0.0.32", - "@types/jasmine": "^2.5.47", - "@types/karma": "^0.13.36", - "@types/merge2": "^0.3.30", - "@types/node": "~7.0.13", - "@types/run-sequence": "^0.0.28", - "codelyzer": "^3.1.2", - "commitizen": "^2.9.6", - "conventional-changelog-lint": "^1.1.9", - "core-js": "^2.5.1", - "del": "^2.2.2", - "gulp": "^3.9.1", - "gulp-changed": "^3.1.0", - "gulp-inline-ng2-template": "^4.0.0", - "gulp-ngc": "^0.3.2", - "gulp-rename": "^1.2.2", - "gulp-rollup": "2.14.0", - "gulp-typescript": "^3.2.2", - "jasmine-core": "^2.6.4", - "karma": "^1.7.0", - "karma-chrome-launcher": "~2.2.0", - "karma-cli": "~1.0.1", - "karma-coverage-istanbul-reporter": "^0.2.0", - "karma-jasmine": "^1.1.0", - "karma-jasmine-diff-reporter": "^1.1.0", - "karma-jasmine-html-reporter": "^0.2.2", - "karma-mocha-reporter": "^2.2.3", - "karma-phantomjs-launcher": "^1.0.4", - "karma-sourcemap-loader": "^0.3.7", - "karma-typescript": "^3.0.4", - "karma-typescript-angular2-transform": "^1.0.0", - "merge2": "^1.0.3", - "node-watch": "^0.5.2", - "phantomjs-prebuilt": "~2.1.14", - "protractor": "~5.1.0", - "reflect-metadata": "~0.1.10", - "rollup": "^0.47.2", - "run-sequence": "^1.2.2", - "rxjs": "^5.4.3", - "ts-node": "~3.3.0", - "tslint": "^5.7.0", - "typescript": "~2.4.2", - "zone.js": "^0.8.17" - }, - "engines": { - "node": ">=6.0.0" - } } diff --git a/public_api.ts b/public_api.ts new file mode 100644 index 0000000..b1d180d --- /dev/null +++ b/public_api.ts @@ -0,0 +1,7 @@ +/* + * Public API Surface of inline-editor + */ + +export * from './src/inline-editor.service'; +export * from './src/inline-editor.component'; +export * from './src/inline-editor.module'; diff --git a/src/inline-editor.component.html b/src/inline-editor.component.html index 6dd88bf..daab059 100644 --- a/src/inline-editor.component.html +++ b/src/inline-editor.component.html @@ -1,16 +1,15 @@ -
+
{{ showText() }}
- - + -
diff --git a/src/inline-editor.component.spec.ts b/src/inline-editor.component.spec.ts new file mode 100644 index 0000000..edff0e7 --- /dev/null +++ b/src/inline-editor.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { InlineEditorComponent } from './inline-editor.component'; + +describe('InlineEditorComponent', () => { + let component: InlineEditorComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ InlineEditorComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(InlineEditorComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/inline-editor.service.spec.ts b/src/inline-editor.service.spec.ts new file mode 100644 index 0000000..ca52eb3 --- /dev/null +++ b/src/inline-editor.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { InlineEditorService } from './inline-editor.service'; + +describe('InlineEditorService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: InlineEditorService = TestBed.get(InlineEditorService); + expect(service).toBeTruthy(); + }); +}); diff --git a/src/inline-editor.service.ts b/src/inline-editor.service.ts index d45b46e..f5ffae3 100644 --- a/src/inline-editor.service.ts +++ b/src/inline-editor.service.ts @@ -1,7 +1,7 @@ import { InlineConfig } from "./types/inline-configs"; import { Subscription } from "rxjs/Subscription"; import { Events } from "./types/inline-editor-events.class"; -import { InlineEditorState } from "./types/inline-editor-state.class"; +import { InlineEditorState, InlineEditorStateOptions } from "./types/inline-editor-state.class"; import { EventEmitter } from "@angular/core"; export class InlineEditorService { @@ -32,6 +32,10 @@ export class InlineEditorService { return this.state.clone(); } + public getOptions(): InlineEditorStateOptions { + return this.state.clone().getState(); + } + public destroy() { Object.values(this.subscriptions).forEach(subscription => subscription.unsubscribe()); } diff --git a/src/inputs/input.component.css b/src/inputs/input.component.css index 6dbab06..59ed786 100644 --- a/src/inputs/input.component.css +++ b/src/inputs/input.component.css @@ -1,13 +1,16 @@ -a { - text-decoration: none; - color: #428bca; - border-bottom: dashed 1px #428bca; - cursor: pointer; - line-height: 2; - margin-right: 5px; - margin-left: 5px; +:not([class='is-editing']) a.c-inline-editor { + text-decoration: none; + color: #428bca; + border-bottom: dashed 1px #428bca; + cursor: pointer; + line-height: 2; + margin-right: 5px; + margin-left: 5px; } +.btn { + margin-left:5px; +} /* editable-empty */ diff --git a/src/themes/bootstrap.css b/src/themes/bootstrap.css deleted file mode 100644 index 3fa269c..0000000 --- a/src/themes/bootstrap.css +++ /dev/null @@ -1,52 +0,0 @@ -a.c-inline-editor { - text-decoration: none; - color: #428bca; - border-bottom: dashed 1px #428bca; - cursor: pointer; - line-height: 2; - margin-right: 5px; - margin-left: 5px; -} -.c-inline-editor.editable-empty, -.c-inline-editor.editable-empty:hover, -.c-inline-editor.editable-empty:focus, -.c-inline-editor.a.editable-empty, -.c-inline-editor.a.editable-empty:hover, -.c-inline-editor.a.editable-empty:focus { - font-style: italic; - color: #DD1144; - text-decoration: none; -} - -.c-inline-editor.inlineEditForm { - display: inline-block; - white-space: nowrap; - margin: 0; -} - -#inlineEditWrapper { - display: inline-block; -} - -.c-inline-editor.inlineEditForm input, -.c-inline-editor.select { - width: auto; - display: inline; -} - -.c-inline-editor.inline-editor-button-group { - display: inline-block; -} - -.c-inline-editor.editInvalid { - color: #a94442; - margin-bottom: 0; -} - -.c-inline-editor.error { - border-color: #a94442; -} - -[hidden].c-inline-editor { - display: none; -} diff --git a/src/themes/bootstrap.scss b/src/themes/bootstrap.scss new file mode 100644 index 0000000..945c0c9 --- /dev/null +++ b/src/themes/bootstrap.scss @@ -0,0 +1,59 @@ +:not([class='is-editing']) { + a.c-inline-editor { + text-decoration: none; + color: #428bca; + border-bottom: dashed 1px #428bca; + cursor: pointer; + line-height: 2; + margin-right: 5px; + margin-left: 5px; + } +} +.btn { + margin-left:5px; +} +.c-inline-editor { + &.editable-empty, + &.editable-empty:hover, + &.editable-empty:focus, + &.a.editable-empty, + &.a.editable-empty:hover, + &.a.editable-empty:focus { + font-style: italic; + color: #DD1144; + text-decoration: none; + } + + &.inlineEditForm { + display: inline-block; + white-space: nowrap; + margin: 0; + } + + &.inlineEditForm input, + &.select { + width: auto; + display: inline; + } + + &.inline-editor-button-group { + display: inline-block; + } + + &.editInvalid { + color: #a94442; + margin-bottom: 0; + } + + &.error { + border-color: #a94442; + } + + &[hidden] { + display: none; + } +} + +#inlineEditWrapper { + display: inline-block; +} diff --git a/src/tsconfig.json b/src/tsconfig.json deleted file mode 100644 index c21a469..0000000 --- a/src/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "compilerOptions": { - "declaration": true, - "module": "es2015", - "target": "es2015", - "stripInternal": true, - "outDir": "../build", - "rootDir": ".", - "lib": [ - "es2015", - "es2017.object", - "dom" - ], - "strictNullChecks": true, - "skipLibCheck": true, - "types": [] - }, - "angularCompilerOptions": { - "annotateForClosureCompiler": true, - "strictMetadataEmit": true, - "skipTemplateCodegen": true, - "flatModuleOutFile": "ngx-inline-editor.js", - "flatModuleId": "@qontu/ngx-inline-editor" - }, - "files": [ - "./inline-editor.module.ts" - ] -} diff --git a/tsconfig.json b/tsconfig.json index a812516..d83a58b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,28 +1,30 @@ { - "extends": "./tsconfig.base.json", + "compileOnSave": false, "compilerOptions": { - "target": "es2016", - "module": "commonjs", - "declaration": false, - "removeComments": true, - "noUnusedLocals": false, - "noLib": false, - "lib": [ - "es2016" - ], + "baseUrl": "./", + "outDir": "./dist/out-tsc", "sourceMap": true, + "declaration": false, + "module": "es2015", + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "importHelpers": true, + "target": "es5", "typeRoots": [ - "./node_modules/@types", - "./node_modules" + "node_modules/@types" + ], + "lib": [ + "es2018", + "dom" ], - "types": [ - "node" - ] - }, - "exclude": [ - "node_modules", - "dist", - "src" - ], - "compileOnSave": false -} + "paths": { + "inline-editor": [ + "dist/inline-editor" + ], + "inline-editor/*": [ + "dist/inline-editor/*" + ] + } + } +} \ No newline at end of file diff --git a/tslint.json b/tslint.json index 4c8dd6f..c740a7b 100644 --- a/tslint.json +++ b/tslint.json @@ -1,8 +1,9 @@ { "rulesDirectory": [ - "node_modules/codelyzer" + "codelyzer" ], "rules": { + "arrow-return-shorthand": true, "callable-types": true, "class-name": true, "comment-format": [ @@ -10,9 +11,15 @@ "check-space" ], "curly": true, + "deprecation": { + "severity": "warn" + }, "eofline": true, "forin": true, - "import-blacklist": [true, "rxjs"], + "import-blacklist": [ + true, + "rxjs/Rx" + ], "import-spacing": true, "indent": [ true, @@ -29,33 +36,15 @@ true, { "order": [ - "public-constructor", - "protected-constructor", - "private-constructor", - "public-instance-field", - "protected-instance-field", - "private-instance-field", - "public-static-field", - "protected-static-field", - "public-instance-method", - "protected-instance-method", - "private-instance-method", - "public-static-method", - "private-static-method", - "protected-static-method" + "static-field", + "instance-field", + "static-method", + "instance-method" ] } ], "no-arg": true, "no-bitwise": true, - "templates-use-public": true, - "invoke-injectable": true, - "use-input-property-decorator": true, - "use-output-property-decorator": true, - "use-host-property-decorator": true, - "no-input-rename": true, - "no-output-rename": true, - "radix": true, "no-console": [ true, "debug", @@ -66,43 +55,27 @@ ], "no-construct": true, "no-debugger": true, - "no-duplicate-variable": true, + "no-duplicate-super": true, "no-empty": false, "no-empty-interface": true, "no-eval": true, - "no-inferrable-types": [true, "ignore-params"], + "no-inferrable-types": [ + true, + "ignore-params" + ], + "no-misused-new": true, + "no-non-null-assertion": true, + "no-redundant-jsdoc": 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-use-before-declare": true, "no-var-keyword": true, "object-literal-sort-keys": false, - "object-literal-shorthand": true, - "object-literal-key-quotes": [ - true, "as-needed" - ], - "typeof-compare": true, - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "trailing-comma": [true, { - "multiline": "always", - "singleline": "never" - }], - "use-life-cycle-interface": true, - "use-pipe-transform-interface": true, - "directive-selector": [true, "attribute", "inline-editor", "camelCase"], - "component-selector": [true, "element", "inline-editor", "kebab-case"], - "prefer-const": true, "one-line": [ true, "check-open-brace", @@ -110,10 +83,12 @@ "check-else", "check-whitespace" ], + "prefer-const": true, "quotemark": [ true, - "double" + "single" ], + "radix": true, "semicolon": [ true, "always" @@ -122,6 +97,17 @@ 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, @@ -130,6 +116,16 @@ "check-operator", "check-separator", "check-type" - ] + ], + "no-output-on-prefix": true, + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": true, + "no-input-rename": true, + "no-output-rename": true, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": true, + "component-class-suffix": true, + "directive-class-suffix": true } }