[ADF-1103] Add custom tslint rules to avoid unwanted Class and File name prefix (#2087)

* custom tslint rules adf project name files

* filename and class prefix rule

* filename process service mock

* fix spec filename

* fix demo shell

* rename mock

* alias deprecated name class

* core rename services

* fix pacakge.json adf-rules

* add exclude in whitelist
This commit is contained in:
Eugenio Romano
2017-07-15 21:59:31 +01:00
parent 77c8ef459f
commit a8eac42c05
215 changed files with 3442 additions and 946 deletions

View File

@@ -21,10 +21,10 @@ import { MdButtonModule, MdCardModule, MdCheckboxModule, MdIconModule, MdInputMo
import { CoreModule } from 'ng2-alfresco-core';
import { DataTableModule } from 'ng2-alfresco-datatable';
import { ActivitiContentComponent } from './src/components/activiti-content.component';
import { ActivitiForm } from './src/components/activiti-form.component';
import { ActivitiStartFormComponent } from './src/components/activiti-start-form.component';
import { ADFFormListComponent } from './src/components/adf-form-list.component';
import { FormFieldComponent } from './src/components/form-field/form-field.component';
import { FormListComponent } from './src/components/form-list.component';
import { FormComponent } from './src/components/form.component';
import { StartFormComponent } from './src/components/start-form.component';
import { MASK_DIRECTIVE, WIDGET_DIRECTIVES } from './src/components/widgets/index';
import { ActivitiAlfrescoContentService } from './src/services/activiti-alfresco.service';
import { ActivitiContentService } from './src/services/activiti-content-service';
@@ -34,10 +34,10 @@ import { FormService } from './src/services/form.service';
import { NodeService } from './src/services/node.service';
import { WidgetVisibilityService } from './src/services/widget-visibility.service';
export * from './src/components/activiti-form.component';
export * from './src/components/adf-form-list.component';
export * from './src/components/form.component';
export * from './src/components/form-list.component';
export * from './src/components/activiti-content.component';
export * from './src/components/activiti-start-form.component';
export * from './src/components/start-form.component';
export * from './src/services/form.service';
export * from './src/services/activiti-content-service';
export * from './src/components/widgets/index';
@@ -46,13 +46,26 @@ export * from './src/services/node.service';
export * from './src/services/form-rendering.service';
export * from './src/events/index';
// Old deprecated import
import {ActivitiContentComponent as ActivitiContent} from './src/components/activiti-content.component';
import {FormComponent as ActivitiForm} from './src/components/form.component';
import {StartFormComponent as ActivitiStartForm} from './src/components/start-form.component';
export {FormComponent as ActivitiForm} from './src/components/form.component';
export {ActivitiContentComponent as ActivitiContent} from './src/components/activiti-content.component';
export {StartFormComponent as ActivitiStartForm} from './src/components/start-form.component';
export const ACTIVITI_FORM_DIRECTIVES: any[] = [
ActivitiForm,
ADFFormListComponent,
FormComponent,
FormListComponent,
ActivitiContentComponent,
ActivitiStartFormComponent,
StartFormComponent,
FormFieldComponent,
...WIDGET_DIRECTIVES
...WIDGET_DIRECTIVES,
// Old Deprecated export
ActivitiForm,
ActivitiContent,
ActivitiStartForm
];
export const ACTIVITI_FORM_PROVIDERS: any[] = [

View File

@@ -22,14 +22,14 @@ import { DataTableModule } from 'ng2-alfresco-datatable';
import { Observable } from 'rxjs/Rx';
import { EcmModelService } from '../services/ecm-model.service';
import { FormService } from '../services/form.service';
import { ADFFormListComponent } from './adf-form-list.component';
import { FormListComponent } from './form-list.component';
declare let jasmine: any;
describe('TaskAttachmentList', () => {
let component: ADFFormListComponent;
let fixture: ComponentFixture<ADFFormListComponent>;
let component: FormListComponent;
let fixture: ComponentFixture<FormListComponent>;
let service: FormService;
let componentHandler: any;
@@ -40,7 +40,7 @@ describe('TaskAttachmentList', () => {
DataTableModule
],
declarations: [
ADFFormListComponent
FormListComponent
],
providers: [
FormService,
@@ -63,7 +63,7 @@ describe('TaskAttachmentList', () => {
beforeEach(async(() => {
fixture = TestBed.createComponent(ADFFormListComponent);
fixture = TestBed.createComponent(FormListComponent);
component = fixture.componentInstance;
service = TestBed.get(FormService);

View File

@@ -21,10 +21,10 @@ import { FormService } from './../services/form.service';
@Component({
selector: 'adf-form-list',
templateUrl: './adf-form-list.component.html',
styleUrls: ['./adf-form-list.component.css']
templateUrl: './form-list.component.html',
styleUrls: ['./form-list.component.css']
})
export class ADFFormListComponent implements OnChanges {
export class FormListComponent implements OnChanges {
@Input()
forms: any [] = [];

View File

@@ -18,18 +18,18 @@
import { SimpleChange } from '@angular/core';
import { LogService } from 'ng2-alfresco-core';
import { Observable } from 'rxjs/Rx';
import { fakeForm } from '../assets/activiti-form.component.mock';
import { fakeForm } from '../assets/form.component.mock';
import { FormService } from './../services/form.service';
import { NodeService } from './../services/node.service';
import { WidgetVisibilityService } from './../services/widget-visibility.service';
import { ActivitiForm } from './activiti-form.component';
import { FormComponent } from './form.component';
import { FormFieldModel, FormFieldTypes, FormModel, FormOutcomeEvent, FormOutcomeModel } from './widgets/index';
describe('ActivitiForm', () => {
describe('FormComponent', () => {
let componentHandler: any;
let formService: FormService;
let formComponent: ActivitiForm;
let formComponent: FormComponent;
let visibilityService: WidgetVisibilityService;
let nodeService: NodeService;
let logService: LogService;
@@ -45,7 +45,7 @@ describe('ActivitiForm', () => {
spyOn(visibilityService, 'refreshVisibility').and.stub();
formService = new FormService(null, null, logService);
nodeService = new NodeService(null);
formComponent = new ActivitiForm(formService, visibilityService, null, nodeService, logService);
formComponent = new FormComponent(formService, visibilityService, null, nodeService, logService);
});
it('should upgrade MDL content on view checked', () => {
@@ -325,7 +325,7 @@ describe('ActivitiForm', () => {
it('should save form on [save] outcome click', () => {
let formModel = new FormModel();
let outcome = new FormOutcomeModel(formModel, {
id: ActivitiForm.SAVE_OUTCOME_ID,
id: FormComponent.SAVE_OUTCOME_ID,
name: 'Save',
isSystem: true
});
@@ -341,7 +341,7 @@ describe('ActivitiForm', () => {
it('should complete form on [complete] outcome click', () => {
let formModel = new FormModel();
let outcome = new FormOutcomeModel(formModel, {
id: ActivitiForm.COMPLETE_OUTCOME_ID,
id: FormComponent.COMPLETE_OUTCOME_ID,
name: 'Complete',
isSystem: true
});
@@ -357,7 +357,7 @@ describe('ActivitiForm', () => {
it('should emit form saved event on custom outcome click', () => {
let formModel = new FormModel();
let outcome = new FormOutcomeModel(formModel, {
id: ActivitiForm.CUSTOM_OUTCOME_ID,
id: FormComponent.CUSTOM_OUTCOME_ID,
name: 'Custom',
isSystem: true
});
@@ -666,7 +666,7 @@ describe('ActivitiForm', () => {
it('should prevent default outcome execution', () => {
let outcome = new FormOutcomeModel(new FormModel(), {
id: ActivitiForm.CUSTOM_OUTCOME_ID,
id: FormComponent.CUSTOM_OUTCOME_ID,
name: 'Custom'
});
@@ -683,7 +683,7 @@ describe('ActivitiForm', () => {
it('should not prevent default outcome execution', () => {
let outcome = new FormOutcomeModel(new FormModel(), {
id: ActivitiForm.CUSTOM_OUTCOME_ID,
id: FormComponent.CUSTOM_OUTCOME_ID,
name: 'Custom'
});
@@ -740,7 +740,7 @@ describe('ActivitiForm', () => {
formComponent.form = formModel;
let outcome = new FormOutcomeModel(new FormModel(), {
id: ActivitiForm.CUSTOM_OUTCOME_ID,
id: FormComponent.CUSTOM_OUTCOME_ID,
name: 'Custom'
});
@@ -766,7 +766,7 @@ describe('ActivitiForm', () => {
expect(formModel.isValid).toBeFalsy();
let outcome = new FormOutcomeModel(new FormModel(), {
id: ActivitiForm.SAVE_OUTCOME_ID,
id: FormComponent.SAVE_OUTCOME_ID,
name: FormOutcomeModel.SAVE_ACTION
});
@@ -788,7 +788,7 @@ describe('ActivitiForm', () => {
expect(formModel.isValid).toBeFalsy();
let outcome = new FormOutcomeModel(new FormModel(), {
id: ActivitiForm.CUSTOM_OUTCOME_ID,
id: FormComponent.CUSTOM_OUTCOME_ID,
name: 'Custom'
});
@@ -812,7 +812,7 @@ describe('ActivitiForm', () => {
});
let outcome = new FormOutcomeModel(new FormModel(), {
id: ActivitiForm.CUSTOM_OUTCOME_ID,
id: FormComponent.CUSTOM_OUTCOME_ID,
name: 'Custom'
});

View File

@@ -31,10 +31,10 @@ declare var componentHandler: any;
@Component({
selector: 'adf-form, activiti-form',
templateUrl: './activiti-form.component.html',
styleUrls: ['./activiti-form.component.css']
templateUrl: './form.component.html',
styleUrls: ['./form.component.css']
})
export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
export class FormComponent implements OnInit, AfterViewChecked, OnChanges {
static SAVE_OUTCOME_ID: string = '$save';
static COMPLETE_OUTCOME_ID: string = '$complete';
@@ -227,22 +227,22 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
}
if (outcome.isSystem) {
if (outcome.id === ActivitiForm.SAVE_OUTCOME_ID) {
if (outcome.id === FormComponent.SAVE_OUTCOME_ID) {
this.saveTaskForm();
return true;
}
if (outcome.id === ActivitiForm.COMPLETE_OUTCOME_ID) {
if (outcome.id === FormComponent.COMPLETE_OUTCOME_ID) {
this.completeTaskForm();
return true;
}
if (outcome.id === ActivitiForm.START_PROCESS_OUTCOME_ID) {
if (outcome.id === FormComponent.START_PROCESS_OUTCOME_ID) {
this.completeTaskForm();
return true;
}
if (outcome.id === ActivitiForm.CUSTOM_OUTCOME_ID) {
if (outcome.id === FormComponent.CUSTOM_OUTCOME_ID) {
this.onTaskSaved(this.form);
this.storeFormAsMetadata();
return true;

View File

@@ -27,7 +27,7 @@ import { EcmModelService } from './../services/ecm-model.service';
import { FormService } from './../services/form.service';
import { WidgetVisibilityService } from './../services/widget-visibility.service';
import { ActivitiContentComponent } from './activiti-content.component';
import { ActivitiStartFormComponent } from './activiti-start-form.component';
import { StartFormComponent } from './start-form.component';
import { FormFieldComponent } from './form-field/form-field.component';
import { MASK_DIRECTIVE } from './widgets/index';
import { WIDGET_DIRECTIVES } from './widgets/index';
@@ -36,8 +36,8 @@ describe('ActivitiStartForm', () => {
let componentHandler: any;
let formService: FormService;
let component: ActivitiStartFormComponent;
let fixture: ComponentFixture<ActivitiStartFormComponent>;
let component: StartFormComponent;
let fixture: ComponentFixture<StartFormComponent>;
let getStartFormSpy: jasmine.Spy;
const exampleId1 = 'my:process1';
@@ -50,7 +50,7 @@ describe('ActivitiStartForm', () => {
MdInputModule,
CoreModule.forRoot()],
declarations: [
ActivitiStartFormComponent,
StartFormComponent,
FormFieldComponent,
ActivitiContentComponent,
...WIDGET_DIRECTIVES,
@@ -67,7 +67,7 @@ describe('ActivitiStartForm', () => {
beforeEach(() => {
fixture = TestBed.createComponent(ActivitiStartFormComponent);
fixture = TestBed.createComponent(StartFormComponent);
component = fixture.componentInstance;
formService = fixture.debugElement.injector.get(FormService);

View File

@@ -19,7 +19,7 @@ import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output,
import { AlfrescoTranslationService, LogService } from 'ng2-alfresco-core';
import { FormService } from './../services/form.service';
import { WidgetVisibilityService } from './../services/widget-visibility.service';
import { ActivitiForm } from './activiti-form.component';
import { FormComponent } from './form.component';
import { ContentLinkModel } from './widgets/core/content-link.model';
import { FormOutcomeModel } from './widgets/core/index';
@@ -38,14 +38,14 @@ import { FormOutcomeModel } from './widgets/core/index';
* {formSaved} EventEmitter - This event is fired when the form is saved, it pass all the value in the form.
* {formCompleted} EventEmitter - This event is fired when the form is completed, it pass all the value in the form.
*
* @returns {ActivitiForm} .
* @returns {FormComponent} .
*/
@Component({
selector: 'adf-start-form, activiti-start-form',
templateUrl: './activiti-start-form.component.html',
styleUrls: ['./activiti-form.component.css']
templateUrl: './start-form.component.html',
styleUrls: ['./form.component.css']
})
export class ActivitiStartFormComponent extends ActivitiForm implements OnChanges, OnInit {
export class StartFormComponent extends FormComponent implements OnChanges, OnInit {
@Input()
processDefinitionId: string;

View File

@@ -99,7 +99,6 @@ export const WIDGET_DIRECTIVES: any[] = [
PeopleWidgetComponent,
DateWidgetComponent,
AmountWidgetComponent,
DynamicTableWidgetComponent,
DateEditorComponent,
DropdownEditorComponent,