(chore) add husky, lint-staged and prettier

This commit is contained in:
Kim Biesbjerg 2019-09-18 14:11:12 +02:00
parent 2fce357306
commit 7d0d52429f
4 changed files with 1254 additions and 54 deletions

1103
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,24 @@
"lint": "tslint --force './src/**/*.ts'", "lint": "tslint --force './src/**/*.ts'",
"test": "mocha -r ts-node/register tests/**/*.spec.ts" "test": "mocha -r ts-node/register tests/**/*.spec.ts"
}, },
"husky": {
"hooks": {
"pre-commit": "lint-staged && npm test"
}
},
"prettier": {
"trailingComma": "none",
"printWidth": 145,
"useTabs": true,
"singleQuote": true
},
"lint-staged": {
"{src,tests}/**/*.{ts}": [
"tslint --project tsconfig.json -c tslint.commit.json --fix",
"prettier --write",
"git add"
]
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/biesbjerg/ngx-translate-extract.git" "url": "https://github.com/biesbjerg/ngx-translate-extract.git"
@ -52,10 +70,15 @@
"@types/node": "^12.7.5", "@types/node": "^12.7.5",
"@types/yargs": "^13.0.2", "@types/yargs": "^13.0.2",
"chai": "^4.2.0", "chai": "^4.2.0",
"husky": "^3.0.5",
"lint-staged": "^9.2.5",
"mocha": "^6.2.0", "mocha": "^6.2.0",
"prettier": "^1.18.2",
"ts-node": "^8.4.1", "ts-node": "^8.4.1",
"tslint": "^5.20.0", "tslint": "^5.20.0",
"tslint-eslint-rules": "^5.4.0" "tslint-config-prettier": "^1.18.0",
"tslint-eslint-rules": "^5.4.0",
"tslint-etc": "^1.7.0"
}, },
"bundledDependencies": [ "bundledDependencies": [
"flat" "flat"

8
tslint.commit.json Normal file
View File

@ -0,0 +1,8 @@
{
"extends": ["./tslint.json", "tslint-etc"],
"jsRules": {},
"rules": {
"ordered-imports": false,
"no-unused-declaration": true
}
}

View File

@ -1,53 +1,121 @@
{ {
"rulesDirectory": [ "defaultSeverity": "error",
"node_modules/tslint-eslint-rules/dist/rules" "extends": [
"tslint-config-prettier"
], ],
"rules": { "rules": {
"indent": [true, "tabs"], "arrow-return-shorthand": true,
"semicolon": [true, "always", "ignore-interfaces"], "callable-types": true,
"quotemark": [true, "single", "avoid-escape"], "class-name": true,
"only-arrow-functions": false, "comment-format": [
"no-duplicate-variable": true, true,
"member-access": true, "check-space"
],
"curly": true,
"deprecation": {
"severity": "warn"
},
"eofline": true,
"forin": true,
"import-spacing": true,
"indent": [
true,
"tabs"
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
220
],
"member-access": false,
"member-ordering": [ "member-ordering": [
true, true,
{ {
"order": [ "order": [
"public-static-field", "static-field",
"public-static-method", "instance-field",
"protected-static-field", "static-method",
"protected-static-method", "instance-method"
"private-static-field",
"private-static-method",
"public-instance-field",
"protected-instance-field",
"private-instance-field",
"constructor",
"public-instance-method",
"protected-instance-method",
"private-instance-method"
] ]
} }
], ],
"curly": true, "no-arg": true,
"eofline": true, "no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-super": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [
false,
"ignore-params"
],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true, "no-trailing-whitespace": true,
"trailing-comma": [ "no-unnecessary-initializer": true,
"no-unused-expression": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
true,
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true, true,
{ {
"multiline": "never", "call-signature": "nospace",
"singleline": "never" "index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
} }
], ],
"unified-signatures": true,
"variable-name": [
true,
"ban-keywords",
"allow-pascal-case",
"check-format"
],
"whitespace": [ "whitespace": [
true, true,
"check-branch", "check-branch",
"check-decl", "check-decl",
"check-operator", "check-operator",
"check-module",
"check-separator", "check-separator",
"check-type", "check-type"
"check-typecast"
] ]
} }
} }