Skip to content

Generated directive class name should have 'Directive' suffix #1217

Closed
abhiit89/angular-cli
#13

Description

@Blasz
Version
$ ng --version
(node:20286) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
angular-cli: 1.0.0-beta.6
node: 6.2.1
os: linux x64
Repro steps

The following generate command produces a directive class name without the 'Directive' suffix.

$ ng g directive shared/directives/wrap-if
(node:20210) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
installing directive
  create src/app/shared/directives/wrap-if.directive.spec.ts
  create src/app/shared/directives/wrap-if.directive.ts

src/app/shared/directives/wrap-if.directive.ts

import { Directive } from '@angular/core';

@Directive({
  selector: '[wrap-if]'
})
export class WrapIf {

  constructor() {}

}

As per the styleguide,

Do append the symbol name with the suffix that it represents.
...
export class ValidationDirective

The generated class name should be WrapIfDirective.

Activity

  1. added
    P1Impacts a large percentage of users; if a workaround exists it is partial or overly painful
    on Aug 19, 2016
  2. filipesilva commented on Aug 19, 2016

    @filipesilva
    Contributor

    @Brocco could you have a look please?

  3. self-assigned this
    on Aug 19, 2016
  4. added a commit that references this issue on Aug 19, 2016
    6e73121
  5. added a commit that references this issue on Aug 21, 2016
    f9e76e6
  6. Blasz commented on Sep 22, 2016

    @Blasz
    Author

    The associated spec file of the directive still imports the wrong directive name:

    /* tslint:disable:no-unused-variable */
    
    import { TestBed, async } from '@angular/core/testing';
    import { HoverEvent } from './hover-event.directive';
    
    describe('Directive: HoverEvent', () => {
      it('should create an instance', () => {
        let directive = new HoverEventDirective();
        expect(directive).toBeTruthy();
      });
    });
    

    Is this better suited to a new issue or can this one be re-opened?

  7. hansl commented on Sep 22, 2016

    @hansl
    Contributor

    What version are you using? ng version

  8. Blasz commented on Sep 22, 2016

    @Blasz
    Author
    $ ng version
    Could not start watchman; falling back to NodeWatcher for file system events.
    Visit http://ember-cli.com/user-guide/#watchman for more info.
    angular-cli: 1.0.0-beta.15
    node: 6.2.1
    os: linux x64
    
  9. hansl commented on Sep 22, 2016

    @hansl
    Contributor

    Okay I'll reopen this and assign it to @Brocco.

  10. reopened this on Sep 22, 2016
  11. Brocco commented on Sep 24, 2016

    @Brocco
    Contributor

    This has been resolved via PR #1940 and will be included in the next release

  12. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  13. locked and limited conversation to collaborators on Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1Impacts a large percentage of users; if a workaround exists it is partial or overly painfuleffort1: easy (hours)type: bug/fix

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions