Skip to content

Commit

Permalink
Add husky pre-commit hook(#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
EzioLi01 authored Nov 17, 2022
1 parent 01b125c commit b2913d8
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"env": {
"browser": true,
"commonjs": true,
"es6": true
"es6": true,
"node": true
},
"rules": {
"quotes": [2, "single", { "avoidEscape": false, "allowTemplateLiterals": true }],
Expand Down
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run eslint
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@
"gulp": "^4.0.2",
"gulp-eslint": "^6.0.0",
"gulp-jsonlint": "^1.3.2",
"husky": "^8.0.2",
"in-publish": "^2.0.0",
"mstranslator": "^3.0.0",
"parse5": "^2.2.1",
"pretty-data": "^0.40.0"
},
"scripts": {
"update-loc": "node ./tools/i18n/update"
"update-loc": "node ./tools/i18n/update",
"eslint": "npx eslint .",
"prepare": "husky install"
}
}
1 change: 1 addition & 0 deletions tools/i18n/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ function findLowestNode(nodes) {
return lowestNode;
}

/*eslint-disable no-unused-vars*/
function getNodeDepth(node) {
var depth = 0;
var parentNode = node.parent;
Expand Down
3 changes: 2 additions & 1 deletion tools/i18n/xliff-json-conv.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ function parseJson(xlfJsons) {
var ids = Object.getOwnPropertyNames(items);

// Create an array of strings to be translated, for machine translation
// eslint-disable-next-line no-unused-vars
var fromStrings = ids.map(function (id) {
return items[id].text;
});

ids.forEach(function (id, index) {
ids.forEach(function (id) {
var item = items[id];

var transUnitNode = xliffDoc.createElement('trans-unit');
Expand Down

0 comments on commit b2913d8

Please sign in to comment.