@typescript-eslint/no-non-null-assertion を黙らせる

This commit is contained in:
hina 2020-06-06 19:12:00 +09:00
parent 2693d340c6
commit b9ed86b69a
No known key found for this signature in database
GPG Key ID: B666B2A137443F76
4 changed files with 8 additions and 0 deletions

View File

@ -1,9 +1,12 @@
import * as Chart from 'chart.js';
const graph = document.getElementById('global-count-graph') as HTMLCanvasElement;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const labels = JSON.parse(document.getElementById('global-count-labels')!.textContent as string);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const data = JSON.parse(document.getElementById('global-count-data')!.textContent as string);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
new Chart(graph.getContext('2d')!, {
type: 'bar',
data: {

View File

@ -59,6 +59,7 @@
return this.each(function () {
$(this)
.on('show.bs.modal', function (event) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const target = $(event.relatedTarget!);
const modal = $(this);
modal.find('.modal-body .date-label').text(target.data('date'));

View File

@ -10,6 +10,7 @@ if (document.getElementById('cal-heatmap')) {
weekStartOnMonday: false,
start: subMonths(new Date(), 9),
range: 10,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
data: JSON.parse(document.getElementById('count-by-day')!.textContent as string),
legend: [1, 2, 3, 4],
});

View File

@ -2,10 +2,12 @@ import * as CalHeatMap from 'cal-heatmap';
import * as Chart from 'chart.js';
import { addMonths, format } from 'date-fns';
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const graphData = JSON.parse(document.getElementById('graph-data')!.textContent as string);
function createLineGraph(id: string, labels: string[], data: any) {
const context = (document.getElementById(id) as HTMLCanvasElement).getContext('2d');
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return new Chart(context!, {
type: 'line',
data: {
@ -47,6 +49,7 @@ function createLineGraph(id: string, labels: string[], data: any) {
function createBarGraph(id: string, labels: string[], data: any) {
const context = (document.getElementById(id) as HTMLCanvasElement).getContext('2d');
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
new Chart(context!, {
type: 'bar',
data: {