Skip to content

Commit

Permalink
Merge pull request #194 from ActivityWatch/dev/eslint-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Apr 29, 2020
2 parents 7242bed + 187c7e5 commit 4973c62
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
9 changes: 8 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@
"@typescript-eslint/no-var-requires": ["off"],
"@typescript-eslint/no-explicit-any": ["off"],
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/no-this-alias": "warn",
"@typescript-eslint/no-unused-vars": ["warn", {"argsIgnorePattern": "^_"}],
"@typescript-eslint/no-this-alias": [
"warn",
{
"allowDestructuring": true,
"allowedNames": ["that"]
}
],
"prefer-rest-params": "warn",
"no-shadow": [
"warn",
Expand Down
4 changes: 2 additions & 2 deletions src/components/CategoryEditTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ div
span(v-if="cls.rule.type === 'regex'") Rule ({{cls.rule.type}}): #[code {{cls.rule.regex}}]
span(v-else, style="color: #888") No rule
span.float-right
b-btn.ml-1(size="sm", variant="outline-secondary", @click="showEditModal($event)" style="border: 0;" pill)
b-btn.ml-1(size="sm", variant="outline-secondary", @click="showEditModal()" style="border: 0;" pill)
icon(name="edit")
b-btn.ml-1(size="sm", variant="outline-success", @click="addSubclass(cls)" style="border: 0;" pill)
icon(name="plus")
Expand Down Expand Up @@ -103,7 +103,7 @@ export default {
// TODO: Move button to edit modal?
this.$store.commit('settings/removeClass', cls);
},
showEditModal(event) {
showEditModal() {
this.$refs.edit.show();
},
checkFormValidity() {
Expand Down
4 changes: 2 additions & 2 deletions src/components/ErrorBoundary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export default {
name: 'ErrorBoundary',
data() {
return {
errors: []
errors: [],
};
},
errorCaptured(err, vm, info) {
errorCaptured(err, _vm, _info) {
// console.error("Error captured!");
// console.error(err, vm, info);
Expand Down
14 changes: 7 additions & 7 deletions src/mixins/asyncErrorCaptured.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ function handleError(error, vm, info) {

export default {
beforeCreate: function() {
const _self = this;
const that = this;
const methods = this.$options.methods || {};
for (var key in methods) {
var original = methods[key];
methods[key] = function() {
for (const key in methods) {
const original = methods[key];
methods[key] = function(...args) {
try {
const result = original.apply(this, arguments);
const result = original.apply(this, args);
// let's analyse what is returned from the method
if (result && typeof result.then === 'function' && typeof result.catch === 'function') {
// this looks like a Promise. let's handle it's errors:
return result.catch(function(err) {
handleError(err, _self, key);
handleError(err, that, key);
});
} else return result;
} catch (e) {
handleError(e, _self, key);
handleError(e, that, key);
}
};
}
Expand Down

0 comments on commit 4973c62

Please sign in to comment.