(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'",
"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": {
"type": "git",
"url": "https://github.com/biesbjerg/ngx-translate-extract.git"
@ -52,10 +70,15 @@
"@types/node": "^12.7.5",
"@types/yargs": "^13.0.2",
"chai": "^4.2.0",
"husky": "^3.0.5",
"lint-staged": "^9.2.5",
"mocha": "^6.2.0",
"prettier": "^1.18.2",
"ts-node": "^8.4.1",
"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": [
"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": [
"node_modules/tslint-eslint-rules/dist/rules"
"defaultSeverity": "error",
"extends": [
"tslint-config-prettier"
],
"rules": {
"indent": [true, "tabs"],
"semicolon": [true, "always", "ignore-interfaces"],
"quotemark": [true, "single", "avoid-escape"],
"only-arrow-functions": false,
"no-duplicate-variable": true,
"member-access": true,
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"comment-format": [
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": [
true,
{
"order": [
"public-static-field",
"public-static-method",
"protected-static-field",
"protected-static-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"
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"curly": true,
"eofline": true,
"no-arg": 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,
"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,
{
"multiline": "never",
"singleline": "never"
"call-signature": "nospace",
"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": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type",
"check-typecast"
"check-type"
]
}
}