2017-01-19 8 views
1

이 내 tslint.json 파일 : 나는 케밥의 경우를 설정 기기 선택기 이름을 가지고케밥의 경우 각 2 선택기 (tslint)에서

{ 
    "rulesDirectory": [ 
    "node_modules/codelyzer" 
    ], 
    "rules": { 
    "class-name": true, 
    "comment-format": [ 
     true, 
     "check-space" 
    ], 
    "curly": true, 
    "eofline": true, 
    "forin": false, 
    "indent": [ 
     true, 
     "spaces" 
    ], 
    "label-position": true, 
    "label-undefined": true, 
    "max-line-length": [ 
     true, 
     140 
    ], 
    "member-access": false, 
    "member-ordering": [ 
     true, 
     "static-before-instance", 
     "variables-before-functions" 
    ], 
    "no-arg": true, 
    "no-bitwise": true, 
    "no-console": [ 
     true, 
     "debug", 
     "info", 
     "time", 
     "timeEnd", 
     "trace" 
    ], 
    "no-construct": true, 
    "no-debugger": true, 
    "no-duplicate-key": true, 
    "no-duplicate-variable": true, 
    "no-empty": false, 
    "no-eval": true, 
    "no-inferrable-types": true, 
    "no-shadowed-variable": true, 
    "no-string-literal": false, 
    "no-switch-case-fall-through": true, 
    "no-trailing-whitespace": false, 
    "no-unused-expression": true, 
    "no-unused-variable": true, 
    "no-unreachable": true, 
    "no-use-before-declare": true, 
    "no-var-keyword": true, 
    "object-literal-sort-keys": false, 
    "one-line": [ 
     true, 
     "check-open-brace", 
     "check-catch", 
     "check-else", 
     "check-whitespace" 
    ], 
    "quotemark": [ 
     true, 
     "single" 
    ], 
    "radix": true, 
    "semicolon": [ 
     "always" 
    ], 
    "triple-equals": [ 
     true, 
     "allow-null-check" 
    ], 
    "typedef-whitespace": [ 
     true, 
     { 
     "call-signature": "nospace", 
     "index-signature": "nospace", 
     "parameter": "nospace", 
     "property-declaration": "nospace", 
     "variable-declaration": "nospace" 
     } 
    ], 
    "variable-name": false, 
    "whitespace": [ 
     true, 
     "check-branch", 
     "check-decl", 
     "check-operator", 
     "check-separator", 
     "check-type" 
    ], 

    "directive-selector-prefix": [false, "app"], 
    "component-selector-prefix": [false, "app"], 
    "directive-selector-name": [true, "camelCase"], 
    "component-selector-name": [false, "kebab-case"], 
    "directive-selector-type": [true, "attribute"], 
    "component-selector-type": [true, "element"], 
    "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 
    } 
} 

. 보푸라기를 실행하면 다음과 같은 내용의 구성 요소에 오류가 발생합니다 ... 구성 요소 "AdminComponent"의 선택기 이름을 kebab-case로 지정해야합니다.

하지만 구성 요소 정의에 갈 때,이 그것이 무엇이다 : 나는 어떻게 고칠 수 ...

@Component({ 
    selector: 'admin', 
    templateUrl: 'admin.component.html', 
    styleUrls: ['admin.component.css'], 
    providers: [] 
}) 

선택기는 하나 개의 단어이며, 케밥의 경우 선택을 필요로하지 않습니다 이?

답변

3

이 경고를 방지하는 방법을 알고,하지만 당신은 선택의 이름을 자신의 접두사를 사용해야 공식 각도 스타일 가이드에 관한하지 마십시오

https://angular.io/styleguide#02-07

에 대한 사용자 정의 접두사를 사용하십니까 구성 요소 선택자. 예를 들어 toh라는 접두사는 Tour of Heroes에서 나오며 admin 접두어는 관리 기능 영역을 나타냅니다.

왜? 다른 앱 및 기본 HTML 요소의 요소와 요소 이름의 충돌을 방지합니다.