Skip to content

Commit 34dc67d

Browse files
committed
upgrade tslint codelyzer, fix test
* Fixes existing lint errors. * mport FormsModule for required test modules * Fix failing unit test message on travis Reference: angular/angular-cli#7296 * Removes yarn due to failing tests on travis only.
1 parent 37866b4 commit 34dc67d

13 files changed

+50
-6313
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ addons:
1212
- google-chrome
1313
packages:
1414
- google-chrome-stable
15-
cache: yarn
1615
env:
1716
global:
1817
- GH_REF: 'github.com/inveniosoftware-contrib/ng2-json-editor.git'
@@ -22,6 +21,7 @@ before_install:
2221
- export CHROME_BIN=chromium-browser
2322
- export DISPLAY=:99.0
2423
- sh -e /etc/init.d/xvfb start
24+
after_install: npm ls
2525
before_deploy:
2626
- npm run build
2727
- npm run copy

gulpfile.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@ var extReplace = require('gulp-ext-replace');
2727
var ngc = require('gulp-ngc');
2828
var del = require('del');
2929
var tsLint = require('gulp-tslint');
30+
var Linter = require('tslint').Linter;
31+
var tsLintProgram = Linter.createProgram('./src/tsconfig.json');
3032
var inlineResources = require('inline-ng2-resources');
3133
var KarmaServer = require('karma').Server;
3234
var runSequence = require('run-sequence');
3335

3436
// run tslint
3537
gulp.task('tslint', () => {
36-
return gulp.src('./src/**/*.ts')
38+
return gulp.src('./src/**/*.ts', { base: '.' })
3739
.pipe(tsLint({
38-
configuration: 'tslint.json',
40+
program: tsLintProgram,
3941
formatter: 'prose'
4042
}))
4143
.pipe(tsLint.report({

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"build": "gulp build",
2020
"start": "npm run build && npm run serve",
2121
"serve": "ng serve",
22-
"lint": "tslint \"src/**/*.ts\"",
23-
"test:unit": "ng test --code-coverage --watch=false",
22+
"lint": "tslint --project ./src/tsconfig.json \"src/**/*.ts\"",
23+
"test:unit": "ng test --code-coverage --sourcemaps=false --watch=false",
2424
"test": "npm-run-all build test:unit e2e:travis",
2525
"pree2e": "webdriver-manager update",
2626
"e2e": "protractor",
@@ -71,7 +71,7 @@
7171
"@types/mousetrap": "^1.5.32",
7272
"@types/node": "~6.0.60",
7373
"bootstrap-sass": "^3.3.7",
74-
"codelyzer": "~2.0.0-beta.1",
74+
"codelyzer": "~3.2.0",
7575
"copyfiles": "^1.2.0",
7676
"core-js": "^2.4.1",
7777
"coveralls": "^2.11.12",
@@ -81,7 +81,7 @@
8181
"gulp-ext-replace": "^0.3.0",
8282
"gulp-ngc": "^0.1.2",
8383
"gulp-sass": "^2.3.2",
84-
"gulp-tslint": "^7.0.1",
84+
"gulp-tslint": "^8.1.2",
8585
"inline-ng2-resources": "1.1.0",
8686
"jasmine-core": "~2.5.2",
8787
"jasmine-spec-reporter": "~3.2.0",
@@ -98,7 +98,7 @@
9898
"rxjs": "^5.0.1",
9999
"ts-helpers": "^1.1.1",
100100
"ts-node": "1.2.1",
101-
"tslint": "^4.3.0",
101+
"tslint": "^5.0.0",
102102
"typedoc": "^0.5.5",
103103
"typescript": "~2.3.0",
104104
"util-deprecate": "^1.0.2",

src/autocomplete-input/autocomplete-input.component.spec.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222

2323
import { HttpModule } from '@angular/http';
24+
import { FormsModule } from '@angular/forms';
2425
import {
2526
async,
2627
ComponentFixture,
@@ -71,7 +72,8 @@ describe('AutocompleteInputComponent', () => {
7172
],
7273
imports: [
7374
Ng2BootstrapModule.forRoot(),
74-
HttpModule
75+
HttpModule,
76+
FormsModule
7577
],
7678
providers: [
7779
{ provide: RemoteAutocompletionService, useClass: MockRemoteAutocompletionService },

src/json-editor.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,4 @@ export {
157157
PatchesConsoleTabComponent,
158158
ErrorsConsoleTabComponent,
159159
AddPatchViewComponent
160-
}
160+
};

src/primitive-field/primitive-field.component.spec.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
ComponentFixture,
2626
TestBed
2727
} from '@angular/core/testing';
28+
import { FormsModule } from '@angular/forms';
2829
import { Ng2BootstrapModule } from 'ngx-bootstrap';
2930
import { Observable } from 'rxjs/Observable';
3031
import { ReplaySubject } from 'rxjs/ReplaySubject';
@@ -96,7 +97,8 @@ describe('PrimitiveFieldComponent', () => {
9697
PatchActionsComponent
9798
],
9899
imports: [
99-
Ng2BootstrapModule.forRoot()
100+
Ng2BootstrapModule.forRoot(),
101+
FormsModule
100102
],
101103
providers: [
102104
AppGlobalsService,

src/searchable-dropdown/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { SearchableDropdownComponent } from './searchable-dropdown.component'
1+
export { SearchableDropdownComponent } from './searchable-dropdown.component';

src/searchable-dropdown/searchable-dropdown.component.spec.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
ComponentFixture,
2626
TestBed,
2727
} from '@angular/core/testing';
28+
import { FormsModule } from '@angular/forms';
2829
import { Ng2BootstrapModule } from 'ngx-bootstrap';
2930

3031
import { SearchableDropdownComponent } from './searchable-dropdown.component';
@@ -52,7 +53,8 @@ describe('SearchableDropdownComponent', () => {
5253
SearchableDropdownComponent,
5354
],
5455
imports: [
55-
Ng2BootstrapModule.forRoot()
56+
Ng2BootstrapModule.forRoot(),
57+
FormsModule
5658
]
5759
}).compileComponents();
5860
}));

src/shared/interfaces/view-template-config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ export interface ViewTemplateConfig {
1818
* - false if the fields to edit should be hidden by default
1919
*/
2020
showEditForm: (item: Map<string, any>) => boolean;
21-
};
21+
}

src/shared/services/katex.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class KatexService {
8585
}
8686

8787
return -1;
88-
};
88+
}
8989

9090
private splitAtDelimiters(startData: Array<KatexData>, leftDelim: string, rightDelim: string, display: boolean): Array<KatexData> {
9191
const finalData = [];

src/tree-menu/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ import { TreeMenuItemComponent } from './tree-menu-item.component';
44
export {
55
TreeMenuComponent,
66
TreeMenuItemComponent
7-
}
7+
};

tslint.json

+26-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
"curly": true,
1313
"eofline": true,
1414
"forin": true,
15-
"import-blacklist": [true, "rxjs"],
15+
"import-blacklist": [
16+
true,
17+
"rxjs"
18+
],
1619
"import-spacing": true,
1720
"indent": [
1821
true,
@@ -27,8 +30,14 @@
2730
"member-access": false,
2831
"member-ordering": [
2932
true,
30-
"static-before-instance",
31-
"variables-before-functions"
33+
{
34+
"order": [
35+
"static-field",
36+
"instance-field",
37+
"static-method",
38+
"instance-method"
39+
]
40+
}
3241
],
3342
"no-arg": true,
3443
"no-bitwise": true,
@@ -70,6 +79,7 @@
7079
],
7180
"radix": true,
7281
"semicolon": [
82+
true,
7383
"always"
7484
],
7585
"triple-equals": [
@@ -97,9 +107,18 @@
97107
"check-separator",
98108
"check-type"
99109
],
100-
101-
"directive-selector": [true, "attribute", "", "camelCase"],
102-
"component-selector": [true, "element", "", "kebab-case"],
110+
"directive-selector": [
111+
true,
112+
"attribute",
113+
"",
114+
"camelCase"
115+
],
116+
"component-selector": [
117+
true,
118+
"element",
119+
"",
120+
"kebab-case"
121+
],
103122
"use-input-property-decorator": true,
104123
"use-output-property-decorator": true,
105124
"use-host-property-decorator": true,
@@ -113,4 +132,4 @@
113132
"templates-use-public": false,
114133
"invoke-injectable": true
115134
}
116-
}
135+
}

0 commit comments

Comments
 (0)