diff --git a/package.json b/package.json index c83be15..e2c1c3f 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,28 @@ "private": false, "description": "", "main": "./lib/index.js", + "config": { + "validate-commit-msg": { + "types": [ + "cleanup", + "feat", + "unfeat", + "fix", + "docs", + "style", + "refactor", + "perf", + "test", + "build", + "ci", + "chore", + "revert", + "followup", + "improve", + "mock" + ] + } + }, "typings": "./lib/index", "module": "./lib.es2015/index.js", "jsnext:main": "./lib.es2015/index.js", diff --git a/src/interfaceSortKeysRule.ts b/src/interfaceSortKeysRule.ts index b3bcda9..ee8bf89 100644 --- a/src/interfaceSortKeysRule.ts +++ b/src/interfaceSortKeysRule.ts @@ -25,9 +25,9 @@ class InterfaceSortKeysRule extends Lint.RuleWalker { if (unsortedIndex !== -1) { const member = node.members[unsortedIndex]; if (ts.isIndexSignatureDeclaration(member)) { - this.addFailureAtNode(member.parameters[0], "This key is not sorted alphabetically"); + this.addFailureAtNode(member.parameters[0], `The key "${member.parameters[0].getChildAt(0).getText()}" is not sorted alphabetically`); } else if (ts.isPropertySignature(member)) { - this.addFailureAtNode(member.name, "This key is not sorted alphabetically"); + this.addFailureAtNode(member.name, `The key "${member.name.getText()}" is not sorted alphabetically`); } else { throw new Error(` Unknown Node Type! diff --git a/test/rules/interface-sort-keys/default/test.ts.lint b/test/rules/interface-sort-keys/default/test.ts.lint index f3bbe03..aa65bd5 100644 --- a/test/rules/interface-sort-keys/default/test.ts.lint +++ b/test/rules/interface-sort-keys/default/test.ts.lint @@ -14,7 +14,7 @@ export interface IAlphabet { aaa: string; bbb: string; cccAaa: string; - ~~~~~~ [This key is not sorted alphabetically] + ~~~~~~ [The key "cccAaa" is not sorted alphabetically] ccc: string; cccc: string; } @@ -24,14 +24,14 @@ export interface IAlphabet { bbb: string; ccc: string; cccc: string; - ~~~~ [This key is not sorted alphabetically] + ~~~~ [The key "cccc" is not sorted alphabetically] cccAaa: string; } export interface IAlphabet { aaa: string; ddd: { - ~~~ [This key is not sorted alphabetically] + ~~~ [The key "ddd" is not sorted alphabetically] dddAaa: string; dddBbb: string; } @@ -43,14 +43,14 @@ export interface IAlphabet { bbb: string; ddd: { dddBbb: string; - ~~~~~~ [This key is not sorted alphabetically] + ~~~~~~ [The key "dddBbb" is not sorted alphabetically] dddAaa: string; } } export interface ArrStr { [key: string]: string | number; // Must accommodate all members - ~~~~~~~~~~~ [This key is not sorted alphabetically] + ~~~~~~~~~~~ [The key "key" is not sorted alphabetically] [index: number]: string; // Can be a subset of string indexer