Browse Source
Merge pull request #6593 from abpframework/build/tslint-variable-name-and-member-ordering
Modified variable-name rule and removed member-ordering rule
pull/6601/head
Bunyamin Coskuner
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
18 additions and
20 deletions
-
npm/ng-packs/packages/core/src/lib/utils/string-utils.ts
-
npm/ng-packs/tslint.json
|
|
|
@ -1,12 +1,12 @@ |
|
|
|
export function createTokenParser(format: string) { |
|
|
|
return (string: string) => { |
|
|
|
return (str: string) => { |
|
|
|
const tokens: string[] = []; |
|
|
|
const regex = format.replace(/\./g, '\\.').replace(/\{\s?([0-9a-zA-Z]+)\s?\}/g, (_, token) => { |
|
|
|
tokens.push(token); |
|
|
|
return '(.+)'; |
|
|
|
}); |
|
|
|
|
|
|
|
const matches = (string.match(regex) || []).slice(1); |
|
|
|
const matches = (str.match(regex) || []).slice(1); |
|
|
|
|
|
|
|
return matches.reduce((acc, v, i) => { |
|
|
|
const key = tokens[i]; |
|
|
|
|
|
|
|
@ -3,10 +3,7 @@ |
|
|
|
"rulesDirectory": ["node_modules/codelyzer"], |
|
|
|
"rules": { |
|
|
|
"align": { |
|
|
|
"options": [ |
|
|
|
"parameters", |
|
|
|
"statements" |
|
|
|
] |
|
|
|
"options": ["parameters", "statements"] |
|
|
|
}, |
|
|
|
"array-type": false, |
|
|
|
"contextual-lifecycle": true, |
|
|
|
@ -15,9 +12,7 @@ |
|
|
|
"eofline": true, |
|
|
|
"import-spacing": true, |
|
|
|
"indent": { |
|
|
|
"options": [ |
|
|
|
"spaces" |
|
|
|
] |
|
|
|
"options": ["spaces"] |
|
|
|
}, |
|
|
|
"max-line-length": [true, 140], |
|
|
|
"no-consecutive-blank-lines": false, |
|
|
|
@ -77,13 +72,8 @@ |
|
|
|
"import-blacklist": [true, "rxjs/Rx"], |
|
|
|
"interface-over-type-literal": true, |
|
|
|
"interface-name": [true, "never-prefix"], |
|
|
|
"member-access": [false], |
|
|
|
"member-ordering": [ |
|
|
|
true, |
|
|
|
{ |
|
|
|
"order": ["static-field", "instance-field", "static-method", "instance-method"] |
|
|
|
} |
|
|
|
], |
|
|
|
"member-access": false, |
|
|
|
"member-ordering": false, |
|
|
|
"no-arg": true, |
|
|
|
"no-bitwise": true, |
|
|
|
"no-conflicting-lifecycle": true, |
|
|
|
@ -134,9 +124,17 @@ |
|
|
|
"unified-signatures": true, |
|
|
|
"use-lifecycle-interface": true, |
|
|
|
"use-pipe-transform-interface": true, |
|
|
|
"variable-name": false, |
|
|
|
"prefer-for-of": false |
|
|
|
, "whitespace": { |
|
|
|
"variable-name": { |
|
|
|
"options": [ |
|
|
|
"ban-keywords", |
|
|
|
"check-format", |
|
|
|
"allow-leading-underscore", |
|
|
|
"allow-pascal-case", |
|
|
|
"allow-snake-case" |
|
|
|
] |
|
|
|
}, |
|
|
|
"prefer-for-of": true, |
|
|
|
"whitespace": { |
|
|
|
"options": [ |
|
|
|
"check-branch", |
|
|
|
"check-decl", |
|
|
|
@ -146,5 +144,5 @@ |
|
|
|
"check-typecast" |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|