(chore) add husky, lint-staged and prettier
This commit is contained in:
parent
2fce357306
commit
7d0d52429f
1103
package-lock.json
generated
1103
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
@ -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
8
tslint.commit.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"extends": ["./tslint.json", "tslint-etc"],
|
||||||
|
"jsRules": {},
|
||||||
|
"rules": {
|
||||||
|
"ordered-imports": false,
|
||||||
|
"no-unused-declaration": true
|
||||||
|
}
|
||||||
|
}
|
170
tslint.json
170
tslint.json
@ -1,53 +1,121 @@
|
|||||||
{
|
{
|
||||||
"rulesDirectory": [
|
"defaultSeverity": "error",
|
||||||
"node_modules/tslint-eslint-rules/dist/rules"
|
"extends": [
|
||||||
],
|
"tslint-config-prettier"
|
||||||
"rules": {
|
],
|
||||||
"indent": [true, "tabs"],
|
"rules": {
|
||||||
"semicolon": [true, "always", "ignore-interfaces"],
|
"arrow-return-shorthand": true,
|
||||||
"quotemark": [true, "single", "avoid-escape"],
|
"callable-types": true,
|
||||||
"only-arrow-functions": false,
|
"class-name": true,
|
||||||
"no-duplicate-variable": true,
|
"comment-format": [
|
||||||
"member-access": true,
|
true,
|
||||||
"member-ordering": [
|
"check-space"
|
||||||
true,
|
],
|
||||||
{
|
"curly": true,
|
||||||
"order": [
|
"deprecation": {
|
||||||
"public-static-field",
|
"severity": "warn"
|
||||||
"public-static-method",
|
},
|
||||||
"protected-static-field",
|
"eofline": true,
|
||||||
"protected-static-method",
|
"forin": true,
|
||||||
"private-static-field",
|
"import-spacing": true,
|
||||||
"private-static-method",
|
"indent": [
|
||||||
"public-instance-field",
|
true,
|
||||||
"protected-instance-field",
|
"tabs"
|
||||||
"private-instance-field",
|
],
|
||||||
"constructor",
|
"interface-over-type-literal": true,
|
||||||
"public-instance-method",
|
"label-position": true,
|
||||||
"protected-instance-method",
|
"max-line-length": [
|
||||||
"private-instance-method"
|
true,
|
||||||
]
|
220
|
||||||
}
|
],
|
||||||
],
|
"member-access": false,
|
||||||
"curly": true,
|
"member-ordering": [
|
||||||
"eofline": true,
|
true,
|
||||||
"no-trailing-whitespace": true,
|
{
|
||||||
"trailing-comma": [
|
"order": [
|
||||||
true,
|
"static-field",
|
||||||
{
|
"instance-field",
|
||||||
"multiline": "never",
|
"static-method",
|
||||||
"singleline": "never"
|
"instance-method"
|
||||||
}
|
]
|
||||||
],
|
}
|
||||||
"whitespace": [
|
],
|
||||||
true,
|
"no-arg": true,
|
||||||
"check-branch",
|
"no-bitwise": true,
|
||||||
"check-decl",
|
"no-console": [
|
||||||
"check-operator",
|
true,
|
||||||
"check-module",
|
"debug",
|
||||||
"check-separator",
|
"info",
|
||||||
"check-type",
|
"time",
|
||||||
"check-typecast"
|
"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-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,
|
||||||
|
{
|
||||||
|
"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-separator",
|
||||||
|
"check-type"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user