Skip to content

Commit

Permalink
Merge pull request #49 from MrSuddenJoy/deepsource-autofix-3ca8757a
Browse files Browse the repository at this point in the history
refactor: fix `// @ts-ignore` to `// @ts-expect-error`
  • Loading branch information
MrSuddenJoy authored Jun 18, 2024
2 parents 8dc5d24 + dd59a54 commit c2d0e47
Show file tree
Hide file tree
Showing 17 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion resources/js/components/comments/form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import VueMarkdown from '../forms/markdown.vue';
import VuePromp from '../forms/prompt.vue';
import {default as mixins} from '../mixins/user';
// @ts-ignore
// @ts-expect-error
@Component({
components: {
'vue-avatar': VueAvatar,
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/dropdown-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Component from "vue-class-component";
import { mixin as clickaway } from 'vue-clickaway';
// @ts-ignore
// @ts-expect-error
@Component({
mixins: [ clickaway ]
})
Expand Down
6 changes: 3 additions & 3 deletions resources/js/components/forms/tags-inline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@
}
selectTag(event) {
// @ts-ignore
// @ts-expect-error
if (this.dropdown.getSelected()) {
// @ts-ignore
// @ts-expect-error
this.applyTag(this.dropdown.getSelected()['name']);
event.preventDefault(); // prevent submitting the form
Expand All @@ -149,7 +149,7 @@
private applyTag(name: string) {
this.toggleTag({ name });
// @ts-ignore
// @ts-expect-error
// hiding dropdown resets internal index of selected position. it's important because otherwise pressing enter would apply
// last selected tag
this.dropdown.hideDropdown();
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/forum/form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export default class VueForm extends Vue {
addItem() {
store.commit('poll/addItem');
// @ts-ignore
// @ts-expect-error
this.$nextTick(() => this.$refs['poll-items'][this.$refs['poll-items'].length - 1].$el.focus());
}
Expand Down
8 changes: 4 additions & 4 deletions resources/js/components/forum/post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export default class VuePost extends Vue {
store.commit('posts/edit', this.post);
if (this.post.is_editing) {
// @ts-ignore
// @ts-expect-error
this.$nextTick(() => this.form.markdown.focus());
}
}
Expand All @@ -412,17 +412,17 @@ export default class VuePost extends Vue {
this.isCommenting = !this.isCommenting;
if (this.isCommenting) {
// @ts-ignore
// @ts-expect-error
this.$nextTick(() => this.commentForm.focus());
}
}
deletePost(confirm = false, reasonId: number | null = null) {
if (confirm) {
// @ts-ignore
// @ts-expect-error
this.deleteModal.open();
} else {
// @ts-ignore
// @ts-expect-error
this.deleteModal.close();
store.dispatch('posts/delete', {post: this.post, reasonId}).then(() => this.isCollapsed = true);
}
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/mixins/microblog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class MicroblogMixin extends Vue {
store.commit('microblogs/TOGGLE_EDIT', microblog);

if (microblog.is_editing) {
// @ts-ignore
// @ts-expect-error
this.$nextTick(() => this.form.markdown.focus());
this.isWrapped = false;
}
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/searchbar/decorators/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import Decorator from './decorator.vue';

@Component
export default class JobDecorator extends Decorator {
// @ts-ignore
// @ts-expect-error
text = this.item.title;
}
2 changes: 1 addition & 1 deletion resources/js/components/searchbar/decorators/microblog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Decorator from './decorator.vue';

@Component
export default class MicroblogDecorator extends Decorator {
// @ts-ignore
// @ts-expect-error
text = this.item.text;
}

Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/searchbar/decorators/wiki.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import Decorator from './decorator.vue';

@Component
export default class WikiDecorator extends Decorator {
// @ts-ignore
// @ts-expect-error
text = this.item.title;
}
4 changes: 2 additions & 2 deletions resources/js/components/searchbar/mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export default class DecoratorMixin extends Vue {
item!: Object;

protected highlight(text) {
// @ts-ignore
// @ts-expect-error
if (!this.value) {
return text;
}

// @ts-ignore
// @ts-expect-error
const value = this.value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');

const ascii = value.normalize('NFD').replace(/[\u0300-\u036f]/gu, "");
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/searchbar/searchbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
import VueUserDecorator from './decorators/user.vue';
import { HitCategory, Contexts, Models } from '@/types/search';
// @ts-ignore
// @ts-expect-error
@Component({
mixins: [ clickaway ],
store,
Expand Down Expand Up @@ -141,7 +141,7 @@
mounted() {
document.addEventListener('keydown', this.shortcutSupport);
// @ts-ignore
// @ts-expect-error
history.onpushstate = window.onpopstate = () => {
// wait for location to really change before setting up new url
setTimeout(() => this.makeParams(), 0);
Expand Down
2 changes: 1 addition & 1 deletion resources/js/pages/forum/homepage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default Vue.extend({
return false;
}

// @ts-ignore
// @ts-expect-error
return topic.tags.filter(tag => this.tagNames.includes(tag.name)).length > 0;
}
},
Expand Down
2 changes: 1 addition & 1 deletion resources/js/pages/forum/posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default Vue.extend({
},
computed: {
markdownRef(): VueMarkdown {
// @ts-ignore
// @ts-expect-error
return this.$refs['js-submit-form'].$refs['markdown']!;
},
...mapGetters('posts', ['posts', 'totalPages', 'currentPage']),
Expand Down
2 changes: 1 addition & 1 deletion resources/js/pages/microblog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ new Vue({
},
mounted() {
document.getElementById('js-skeleton')?.remove();
// @ts-ignore
// @ts-expect-error
this.liveNotifications();
},
methods: {
Expand Down
6 changes: 3 additions & 3 deletions resources/js/pages/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,13 @@ new Vue({
const pushState = history.pushState;

history.pushState = function(state) {
// @ts-ignore
// @ts-expect-error
if (typeof history.onpushstate == "function") {
// @ts-ignore
// @ts-expect-error
history.onpushstate({state: state});
}

// @ts-ignore
// @ts-expect-error
return pushState.apply(history, arguments);
};
})(window.history);
4 changes: 2 additions & 2 deletions resources/js/plugins/autosave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ export const install = (Vue) => {

Vue.prototype.$saveDraft = (key: string, value: string) => {
try {
// @ts-ignore
// @ts-expect-error
localStorage.setItem(key, JSON.stringify({
'content': value,
'timestamp': currentTime
}));
}
catch (e) {
// @ts-ignore
// @ts-expect-error
localStorage.clear();
}
};
Expand Down
4 changes: 2 additions & 2 deletions resources/js/tests/store/modules/microblogs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ describe('microblog mutation', () => {
mutations.ADD_COMMENT(state, { parent, comment });

expect(parent.id! in state.data).toBeTruthy();
// @ts-ignore
// @ts-expect-error
expect(state.data[parent.id!].comments[comment.id]).toBeInstanceOf(Object);
// @ts-ignore
// @ts-expect-error
expect(state.data[parent.id!].comments_count).toBe(1);
});

Expand Down

0 comments on commit c2d0e47

Please sign in to comment.