From bae72d2bea6124f64b7d68256363cb8e40920f45 Mon Sep 17 00:00:00 2001 From: sschmid Date: Wed, 20 Jan 2021 17:47:46 +0100 Subject: [PATCH] lint: configure eslintrc, fix all lint errors, remove tslint from project --- .eslintrc.js | 8 ++++---- package.json | 4 +--- src/Common/DataObjects/Fraction.ts | 2 +- src/Common/DataObjects/Pitch.ts | 8 ++++---- src/MusicalScore/Graphical/DrawingEnums.ts | 1 - src/MusicalScore/Graphical/EngravingRules.ts | 4 ++-- src/MusicalScore/Graphical/GraphicalMusicSheet.ts | 3 +-- src/MusicalScore/Graphical/GraphicalSlur.ts | 10 ++++------ src/MusicalScore/Graphical/MusicSheetCalculator.ts | 4 ---- src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts | 12 ++++++------ .../Graphical/VexFlow/VexFlowMusicSheetCalculator.ts | 4 ++-- .../Graphical/VexFlow/VexFlowVoiceEntry.ts | 2 +- src/MusicalScore/ScoreIO/InstrumentReader.ts | 8 +++----- src/MusicalScore/ScoreIO/MusicSheetReader.ts | 3 ++- .../ScoreIO/MusicSymbolModules/ArticulationReader.ts | 2 +- .../ScoreIO/MusicSymbolModules/ChordSymbolReader.ts | 8 ++++---- .../ScoreIO/MusicSymbolModules/ExpressionReader.ts | 8 ++++---- .../ScoreIO/MusicSymbolModules/LyricsReader.ts | 2 +- src/MusicalScore/VoiceData/NoteType.ts | 1 - src/OpenSheetMusicDisplay/OSMDOptions.ts | 2 +- test/Common/FileIO/Mxl_Test.ts | 6 +++--- .../Graphical/VexFlow/VexFlowConverter_Clef_Test.ts | 1 - .../Graphical/VexFlow/VexFlowMeasure_Test.ts | 2 +- .../VexFlow/VexFlowMusicSheetDrawer_Test.ts | 2 +- .../ScoreCalculation/MusicSheetCalculator_Test.ts | 2 +- test/MusicalScore/ScoreIO/Key_Test.ts | 1 - test/MusicalScore/ScoreIO/MusicSheetReader_Test.ts | 2 +- test/MusicalScore/VoiceData/NoteType_Test.ts | 1 - 28 files changed, 49 insertions(+), 64 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index e79e4e82c..3e2813a60 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -55,7 +55,7 @@ module.exports = { "error", { "multiline": { - "delimiter": "none", + "delimiter": "semi", "requireLast": true }, "singleline": { @@ -119,7 +119,7 @@ module.exports = { ],*/ "id-match": "error", "jsdoc/check-alignment": "error", - "jsdoc/check-indentation": "error", + "jsdoc/check-indentation": "off", "jsdoc/newline-after-description": "off", "max-len": [ "error", @@ -162,10 +162,10 @@ module.exports = { "no-fallthrough": "error", "no-multiple-empty-lines": "off", "no-new-wrappers": "error", - "no-null/no-null": "error", + "no-null/no-null": "off", "no-redeclare": "error", "no-trailing-spaces": "error", - "no-underscore-dangle": "error", + "no-underscore-dangle": "off", "no-unused-labels": "error", "no-var": "error", "prefer-const": "error", diff --git a/package.json b/package.json index 4902c0b08..49bf37cf5 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "typings": "build/dist/src/", "scripts": { "docs": "typedoc --out ./build/docs --name OpenSheetMusicDisplay --module commonjs --target ES2017 --ignoreCompilerErrors --mode file ./src", - "eslint": "eslint .", + "eslint": "eslint . --ext .ts src/", "lint": "eslint -c .eslintrc.js --ext .ts src/", "test": "karma start --single-run --no-auto-watch", "test:watch": "karma start --no-single-run --auto-watch --browsers ChromeNoSecurity", @@ -109,8 +109,6 @@ "pre-commit": "^1.2.2", "svg2pdf.js": "^1.5.0", "ts-loader": "^4.1.0", - "tslint": "^5.14.0", - "tslint-loader": "^3.5.4", "typedoc": "^0.17.3", "typescript": "^3.9.5", "webpack": "^4.43.0", diff --git a/src/Common/DataObjects/Fraction.ts b/src/Common/DataObjects/Fraction.ts index 820223049..a53c35340 100644 --- a/src/Common/DataObjects/Fraction.ts +++ b/src/Common/DataObjects/Fraction.ts @@ -81,7 +81,7 @@ export class Fraction { * @param denominator * @param wholeValue - the integer number, needed for values greater than 1 * @param simplify - If simplify is true, then the fraction is simplified - * to make both the numerator and denominator coprime, and less than maximumAllowedNumber. + * to make both the numerator and denominator coprime, and less than maximumAllowedNumber. */ constructor(numerator: number = 0, denominator: number = 1, wholeValue: number = 0, simplify: boolean = true) { this.numerator = numerator; diff --git a/src/Common/DataObjects/Pitch.ts b/src/Common/DataObjects/Pitch.ts index e3feed76d..7eda6273e 100644 --- a/src/Common/DataObjects/Pitch.ts +++ b/src/Common/DataObjects/Pitch.ts @@ -12,7 +12,7 @@ export enum NoteEnum { /** Describes Accidental types. * Do not use the number values of these enum members directly for calculation anymore. * To use these for pitch calculation, use pitch.AccidentalHalfTones() - * or Pitch.HalfTonesFromAccidental(accidentalEnum). + * or Pitch.HalfTonesFromAccidental(accidentalEnum). */ export enum AccidentalEnum { SHARP, @@ -70,15 +70,15 @@ export class Pitch { * @param the input pitch * @param the number of halftones to transpose with * @returns ret[0] = the transposed fundamental. - * ret[1] = the octave shift (not the new octave!) + * ret[1] = the octave shift (not the new octave!) * @constructor */ - public static CalculateTransposedHalfTone(pitch: Pitch, transpose: number): { halftone: number; overflow: number; } { + public static CalculateTransposedHalfTone(pitch: Pitch, transpose: number): { halftone: number, overflow: number } { const newHalfTone: number = pitch.fundamentalNote + pitch.AccidentalHalfTones + transpose; return Pitch.WrapAroundCheck(newHalfTone, 12); } - public static WrapAroundCheck(value: number, limit: number): { halftone: number; overflow: number; } { + public static WrapAroundCheck(value: number, limit: number): { halftone: number, overflow: number } { let overflow: number = 0; while (value < 0) { diff --git a/src/MusicalScore/Graphical/DrawingEnums.ts b/src/MusicalScore/Graphical/DrawingEnums.ts index b2787fe02..cb6e0cbb8 100644 --- a/src/MusicalScore/Graphical/DrawingEnums.ts +++ b/src/MusicalScore/Graphical/DrawingEnums.ts @@ -41,7 +41,6 @@ export enum OutlineAndFillStyleEnum { Comment10 } -// tslint:disable-next-line:max-line-length A linebreak would be more confusing here export const OUTLINE_AND_FILL_STYLE_DICT: Dictionary = new Dictionary(); OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.BaseWritingColor, "Thistle"); diff --git a/src/MusicalScore/Graphical/EngravingRules.ts b/src/MusicalScore/Graphical/EngravingRules.ts index 168fc9f99..ce299faab 100644 --- a/src/MusicalScore/Graphical/EngravingRules.ts +++ b/src/MusicalScore/Graphical/EngravingRules.ts @@ -207,8 +207,8 @@ export class EngravingRules { public MaxInstructionsConstValue: number; public NoteDistances: number[] = [1.0, 1.0, 1.3, 1.6, 2.0, 2.5, 3.0, 4.0]; public NoteDistancesScalingFactors: number[] = [1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0]; - public DurationDistanceDict: {[_: number]: number; } = {}; - public DurationScalingDistanceDict: {[_: number]: number; } = {}; + public DurationDistanceDict: {[_: number]: number } = {}; + public DurationScalingDistanceDict: {[_: number]: number } = {}; public AlignRests: number; // 0 = false, 1 = true, 2 = auto public FillEmptyMeasuresWithWholeRest: FillEmptyMeasuresWithWholeRests | number; diff --git a/src/MusicalScore/Graphical/GraphicalMusicSheet.ts b/src/MusicalScore/Graphical/GraphicalMusicSheet.ts index a3912b4aa..89d009108 100644 --- a/src/MusicalScore/Graphical/GraphicalMusicSheet.ts +++ b/src/MusicalScore/Graphical/GraphicalMusicSheet.ts @@ -393,7 +393,6 @@ export class GraphicalMusicSheet { const containers: VerticalGraphicalStaffEntryContainer[] = this.verticalGraphicalStaffEntryContainers; let leftIndex: number = 0; let rightIndex: number = containers.length - 1; - let foundIndex: number; let leftTS: Fraction = undefined; let rightTS: Fraction = undefined; if (musicTimestamp.lte(containers[containers.length - 1].AbsoluteTimestamp)) { @@ -429,7 +428,7 @@ export class GraphicalMusicSheet { const diffTS: number = rightTS.RealValue - musicTimestamp.RealValue; // estimate the interpolated index - foundIndex = rightIndex - (diffTS / diff); + const foundIndex: number = rightIndex - (diffTS / diff); return Math.min(foundIndex, this.verticalGraphicalStaffEntryContainers.length); } diff --git a/src/MusicalScore/Graphical/GraphicalSlur.ts b/src/MusicalScore/Graphical/GraphicalSlur.ts index 5e686c30b..4e59f4ca8 100644 --- a/src/MusicalScore/Graphical/GraphicalSlur.ts +++ b/src/MusicalScore/Graphical/GraphicalSlur.ts @@ -152,9 +152,8 @@ export class GraphicalSlur extends GraphicalCurve { // clockwise/counterclockwise Rotation // after Rotation end2.Y must be 0 // Inverse of RotationMatrix = TransposeMatrix of RotationMatrix - let rotationMatrix: Matrix2D, transposeMatrix: Matrix2D; - rotationMatrix = Matrix2D.getRotationMatrix(startEndLineAngleRadians); - transposeMatrix = rotationMatrix.getTransposeMatrix(); + const rotationMatrix: Matrix2D = Matrix2D.getRotationMatrix(startEndLineAngleRadians); + const transposeMatrix: Matrix2D = rotationMatrix.getTransposeMatrix(); end2 = rotationMatrix.vectorMultiplication(end2); const transformedPoints: PointF2D[] = this.calculateTranslatedAndRotatedPointListAbove(points, startX, startY, rotationMatrix); @@ -323,9 +322,8 @@ export class GraphicalSlur extends GraphicalCurve { // clockwise/counterclockwise Rotation // after Rotation end2.Y must be 0 // Inverse of RotationMatrix = TransposeMatrix of RotationMatrix - let rotationMatrix: Matrix2D, transposeMatrix: Matrix2D; - rotationMatrix = Matrix2D.getRotationMatrix(-startEndLineAngleRadians); - transposeMatrix = rotationMatrix.getTransposeMatrix(); + const rotationMatrix: Matrix2D = Matrix2D.getRotationMatrix(-startEndLineAngleRadians); + const transposeMatrix: Matrix2D = rotationMatrix.getTransposeMatrix(); end2 = rotationMatrix.vectorMultiplication(end2); const transformedPoints: PointF2D[] = this.calculateTranslatedAndRotatedPointListBelow(points, startX, startY, rotationMatrix); diff --git a/src/MusicalScore/Graphical/MusicSheetCalculator.ts b/src/MusicalScore/Graphical/MusicSheetCalculator.ts index f71d46128..077d93227 100644 --- a/src/MusicalScore/Graphical/MusicSheetCalculator.ts +++ b/src/MusicalScore/Graphical/MusicSheetCalculator.ts @@ -2331,11 +2331,7 @@ export abstract class MusicSheetCalculator { accidentalCalculator.checkAccidental(graphicalNote, pitch); } - // // needed to disable linter, as it doesn't recognize the existing usage of this method. - // // ToDo: check if a newer version doesn't have the problem. - // /* tslint:disable:no-unused-variable */ // private createStaffEntryForTieNote(measure: StaffMeasure, absoluteTimestamp: Fraction, openTie: Tie): GraphicalStaffEntry { - // /* tslint:enable:no-unused-variable */ // let graphicalStaffEntry: GraphicalStaffEntry; // graphicalStaffEntry = MusicSheetCalculator.symbolFactory.createStaffEntry(openTie.Start.ParentStaffEntry, measure); // graphicalStaffEntry.relInMeasureTimestamp = Fraction.minus(absoluteTimestamp, measure.parentSourceMeasure.AbsoluteTimestamp); diff --git a/src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts b/src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts index b93803179..84bbe8b99 100644 --- a/src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts +++ b/src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts @@ -62,7 +62,7 @@ export class VexFlowMeasure extends GraphicalMeasure { /** octaveOffset according to active clef */ public octaveOffset: number = 3; /** The VexFlow Voices in the measure */ - public vfVoices: { [voiceID: number]: Vex.Flow.Voice; } = {}; + public vfVoices: { [voiceID: number]: Vex.Flow.Voice } = {}; /** Call this function (if present) to x-format all the voices in the measure */ public formatVoices: (width: number, parent: VexFlowMeasure) => void; /** The VexFlow Ties in the measure */ @@ -74,17 +74,17 @@ export class VexFlowMeasure extends GraphicalMeasure { /** VexFlow StaveConnectors (vertical lines) */ protected connectors: Vex.Flow.StaveConnector[] = []; /** Intermediate object to construct beams */ - private beams: { [voiceID: number]: [Beam, VexFlowVoiceEntry[]][]; } = {}; + private beams: { [voiceID: number]: [Beam, VexFlowVoiceEntry[]][] } = {}; /** Beams created by (optional) autoBeam function. */ private autoVfBeams: Vex.Flow.Beam[]; /** Beams of tuplet notes created by (optional) autoBeam function. */ private autoTupletVfBeams: Vex.Flow.Beam[]; /** VexFlow Beams */ - private vfbeams: { [voiceID: number]: Vex.Flow.Beam[]; }; + private vfbeams: { [voiceID: number]: Vex.Flow.Beam[] }; /** Intermediate object to construct tuplets */ - protected tuplets: { [voiceID: number]: [Tuplet, VexFlowVoiceEntry[]][]; } = {}; + protected tuplets: { [voiceID: number]: [Tuplet, VexFlowVoiceEntry[]][] } = {}; /** VexFlow Tuplets */ - private vftuplets: { [voiceID: number]: Vex.Flow.Tuplet[]; } = {}; + private vftuplets: { [voiceID: number]: Vex.Flow.Tuplet[] } = {}; // The engraving rules of OSMD. public rules: EngravingRules; @@ -1243,7 +1243,7 @@ export class VexFlowMeasure extends GraphicalMeasure { protected createOrnaments(): void { for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) { const graphicalStaffEntry: VexFlowStaffEntry = (this.staffEntries[idx] as VexFlowStaffEntry); - const gvoices: { [voiceID: number]: GraphicalVoiceEntry; } = graphicalStaffEntry.graphicalVoiceEntries; + const gvoices: { [voiceID: number]: GraphicalVoiceEntry } = graphicalStaffEntry.graphicalVoiceEntries; for (const voiceID in gvoices) { if (gvoices.hasOwnProperty(voiceID)) { diff --git a/src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts b/src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts index 093448551..8e19a4b21 100644 --- a/src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts +++ b/src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts @@ -148,7 +148,7 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator { if (!measure) { continue; } - const mvoices: { [voiceID: number]: Vex.Flow.Voice; } = (measure as VexFlowMeasure).vfVoices; + const mvoices: { [voiceID: number]: Vex.Flow.Voice } = (measure as VexFlowMeasure).vfVoices; const voices: Vex.Flow.Voice[] = []; for (const voiceID in mvoices) { if (mvoices.hasOwnProperty(voiceID)) { @@ -1045,7 +1045,7 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator { // Generate all Graphical Slurs and attach them to the staffline protected calculateSlurs(): void { - const openSlursDict: { [staffId: number]: GraphicalSlur[]; } = {}; + const openSlursDict: { [staffId: number]: GraphicalSlur[] } = {}; for (const graphicalMeasure of this.graphicalMusicSheet.MeasureList[0]) { //let i: number = 0; i < this.graphicalMusicSheet.MeasureList[0].length; i++) { openSlursDict[graphicalMeasure.ParentStaff.idInMusicSheet] = []; } diff --git a/src/MusicalScore/Graphical/VexFlow/VexFlowVoiceEntry.ts b/src/MusicalScore/Graphical/VexFlow/VexFlowVoiceEntry.ts index 99950c283..64eb821c9 100644 --- a/src/MusicalScore/Graphical/VexFlow/VexFlowVoiceEntry.ts +++ b/src/MusicalScore/Graphical/VexFlow/VexFlowVoiceEntry.ts @@ -107,7 +107,7 @@ export class VexFlowVoiceEntry extends GraphicalVoiceEntry { } } if (colorBeam) { - if (vfStaveNote.beam !== null && vfStaveNote.beam.setStyle) { + if (vfStaveNote.beam?.setStyle) { vfStaveNote.beam.setStyle({ fillStyle: noteheadColor, strokeStyle: noteheadColor}); } } diff --git a/src/MusicalScore/ScoreIO/InstrumentReader.ts b/src/MusicalScore/ScoreIO/InstrumentReader.ts index 54b68ef7a..07a611545 100644 --- a/src/MusicalScore/ScoreIO/InstrumentReader.ts +++ b/src/MusicalScore/ScoreIO/InstrumentReader.ts @@ -73,7 +73,7 @@ export class InstrumentReader { private musicSheet: MusicSheet; private slurReader: SlurReader; private instrument: Instrument; - private voiceGeneratorsDict: { [n: number]: VoiceGenerator; } = {}; + private voiceGeneratorsDict: { [n: number]: VoiceGenerator } = {}; private staffMainVoiceGeneratorDict: { [staffId: number]: VoiceGenerator } = {}; private inSourceMeasureInstrumentIndex: number; private divisions: number = 0; @@ -252,10 +252,8 @@ export class InstrumentReader { let noteTypeXml: NoteType = NoteType.UNDEFINED; if (typeNode) { const sizeAttr: Attr = typeNode.attribute("size"); - if (sizeAttr !== undefined && sizeAttr !== null) { - if (sizeAttr.value === "cue") { - isCueNote = true; - } + if (sizeAttr?.value === "cue") { + isCueNote = true; } noteTypeXml = NoteTypeHandler.StringToNoteType(typeNode.value); } diff --git a/src/MusicalScore/ScoreIO/MusicSheetReader.ts b/src/MusicalScore/ScoreIO/MusicSheetReader.ts index 78b11c4d6..aace9e7b2 100644 --- a/src/MusicalScore/ScoreIO/MusicSheetReader.ts +++ b/src/MusicalScore/ScoreIO/MusicSheetReader.ts @@ -195,7 +195,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ { } private initializeReading(partList: IXmlElement[], partInst: IXmlElement[], instrumentReaders: InstrumentReader[]): void { - const instrumentDict: { [_: string]: Instrument; } = this.createInstrumentGroups(partList); + const instrumentDict: { [_: string]: Instrument } = this.createInstrumentGroups(partList); this.completeNumberOfStaves = this.getCompleteNumberOfStavesFromXml(partInst); if (partInst.length !== 0) { this.repetitionInstructionReader.MusicSheet = this.musicSheet; @@ -571,6 +571,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ { } const creditJustify: string = creditChild.attribute("justify")?.value; const creditY: string = creditChild.attribute("default-y")?.value; + // eslint-disable-next-line no-null/no-null const creditYGiven: boolean = creditY !== undefined && creditY !== null; const creditYInfo: number = creditYGiven ? parseFloat(creditY) : Number.MIN_VALUE; if (creditYGiven && creditYInfo > systemYCoordinates) { diff --git a/src/MusicalScore/ScoreIO/MusicSymbolModules/ArticulationReader.ts b/src/MusicalScore/ScoreIO/MusicSymbolModules/ArticulationReader.ts index 5641dd0cf..718b8ab72 100644 --- a/src/MusicalScore/ScoreIO/MusicSymbolModules/ArticulationReader.ts +++ b/src/MusicalScore/ScoreIO/MusicSymbolModules/ArticulationReader.ts @@ -155,7 +155,7 @@ export class ArticulationReader { currentTechnicalInstruction.value = nodeFingering.value; currentTechnicalInstruction.placement = PlacementEnum.NotYetDefined; const placement: Attr = nodeFingering.attribute("placement"); - if (placement !== undefined && placement !== null) { + if (placement) { switch (placement.value) { case "above": currentTechnicalInstruction.placement = PlacementEnum.Above; diff --git a/src/MusicalScore/ScoreIO/MusicSymbolModules/ChordSymbolReader.ts b/src/MusicalScore/ScoreIO/MusicSymbolModules/ChordSymbolReader.ts index ef9c7d1db..cfc556b96 100644 --- a/src/MusicalScore/ScoreIO/MusicSymbolModules/ChordSymbolReader.ts +++ b/src/MusicalScore/ScoreIO/MusicSymbolModules/ChordSymbolReader.ts @@ -39,7 +39,7 @@ export class ChordSymbolReader { let rootAlteration: AccidentalEnum = AccidentalEnum.NONE; if (rootAlter) { try { - rootAlteration = Pitch.AccidentalFromHalfTones(parseInt(rootAlter.value, undefined)); + rootAlteration = Pitch.AccidentalFromHalfTones(parseInt(rootAlter.value, 10)); } catch (ex) { const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError", "Invalid chord symbol"); @@ -94,7 +94,7 @@ export class ChordSymbolReader { let bassAlteration: AccidentalEnum = AccidentalEnum.NONE; if (bassAlter) { try { - bassAlteration = Pitch.AccidentalFromHalfTones(parseInt(bassAlter.value, undefined)); + bassAlteration = Pitch.AccidentalFromHalfTones(parseInt(bassAlter.value, 10)); } catch (ex) { const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError", "Invalid chord symbol"); @@ -118,7 +118,7 @@ export class ChordSymbolReader { let value: number; try { - value = parseInt(degreeValue.value.trim(), undefined); + value = parseInt(degreeValue.value.trim(), 10); } catch (ex) { const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError", "Invalid chord symbol"); @@ -129,7 +129,7 @@ export class ChordSymbolReader { let alter: AccidentalEnum; try { - alter = Pitch.AccidentalFromHalfTones(parseInt(degreeAlter.value, undefined)); + alter = Pitch.AccidentalFromHalfTones(parseInt(degreeAlter.value, 10)); } catch (ex) { const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError", "Invalid chord symbol"); diff --git a/src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts b/src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts index fd088b79c..74571e7b6 100644 --- a/src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts +++ b/src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts @@ -72,7 +72,7 @@ export class ExpressionReader { } const placeAttr: IXmlAttribute = xmlNode.attribute("placement"); - if (placeAttr !== undefined && placeAttr !== null) { + if (placeAttr) { try { const placementString: string = placeAttr.value; if (placementString === "below") { @@ -96,21 +96,21 @@ export class ExpressionReader { const dynamicsNode: IXmlElement = directionTypeNode.element("dynamics"); if (dynamicsNode) { const defAttr: IXmlAttribute = dynamicsNode.attribute("default-y"); - if (defAttr !== undefined && defAttr !== null) { + if (defAttr) { this.readExpressionPlacement(defAttr, "read dynamics y pos"); } } const wedgeNode: IXmlElement = directionTypeNode.element("wedge"); if (wedgeNode) { const defAttr: IXmlAttribute = wedgeNode.attribute("default-y"); - if (defAttr !== undefined && defAttr !== null) { + if (defAttr) { this.readExpressionPlacement(defAttr, "read wedge y pos"); } } const wordsNode: IXmlElement = directionTypeNode.element("words"); if (wordsNode) { const defAttr: IXmlAttribute = wordsNode.attribute("default-y"); - if (defAttr !== undefined && defAttr !== null) { + if (defAttr) { this.readExpressionPlacement(defAttr, "read words y pos"); } } diff --git a/src/MusicalScore/ScoreIO/MusicSymbolModules/LyricsReader.ts b/src/MusicalScore/ScoreIO/MusicSymbolModules/LyricsReader.ts index 1e15d9b07..c55a2d338 100644 --- a/src/MusicalScore/ScoreIO/MusicSymbolModules/LyricsReader.ts +++ b/src/MusicalScore/ScoreIO/MusicSymbolModules/LyricsReader.ts @@ -6,7 +6,7 @@ import {ITextTranslation} from "../../Interfaces/ITextTranslation"; import {MusicSheet} from "../../MusicSheet"; export class LyricsReader { - private openLyricWords: { [_: number]: LyricWord; } = {}; + private openLyricWords: { [_: number]: LyricWord } = {}; private currentLyricWord: LyricWord; private musicSheet: MusicSheet; diff --git a/src/MusicalScore/VoiceData/NoteType.ts b/src/MusicalScore/VoiceData/NoteType.ts index 1328b0053..c8d998788 100644 --- a/src/MusicalScore/VoiceData/NoteType.ts +++ b/src/MusicalScore/VoiceData/NoteType.ts @@ -24,7 +24,6 @@ export enum NoteType { } export class NoteTypeHandler { - // tslint:disable-next-line: variable-name public static NoteTypeXmlValues: string[] = ["", "1024th", "512th", "256th", "128th", "64th", "32nd", "16th", "eigth", "quarter", "half", "whole", "breve", "long", "maxima"]; // alternative to array: use switch/case diff --git a/src/OpenSheetMusicDisplay/OSMDOptions.ts b/src/OpenSheetMusicDisplay/OSMDOptions.ts index 4c287e98c..906005040 100644 --- a/src/OpenSheetMusicDisplay/OSMDOptions.ts +++ b/src/OpenSheetMusicDisplay/OSMDOptions.ts @@ -4,7 +4,7 @@ import { FontStyles } from "../Common/Enums/FontStyles"; /** Possible options for the OpenSheetMusicDisplay constructor and osmd.setOptions(). None are mandatory. * Note that after using setOptions(), you have to call osmd.render() again to make changes visible. * Example: osmd.setOptions({defaultColorRest: "#AAAAAA", drawSubtitle: false}); osmd.render(); - * + * * Note that some additional, usually more small scale options are available in EngravingRules, * though not all of them are meant to be manipulated. * The OSMDOptions are the main options we support. diff --git a/test/Common/FileIO/Mxl_Test.ts b/test/Common/FileIO/Mxl_Test.ts index b13ed9443..1e12fa5e8 100644 --- a/test/Common/FileIO/Mxl_Test.ts +++ b/test/Common/FileIO/Mxl_Test.ts @@ -1,12 +1,12 @@ +/* eslint-disable @typescript-eslint/no-unused-expressions */ import { IXmlElement } from "../../../src/Common/FileIO/Xml"; import { TestUtils } from "../../Util/TestUtils"; import { MXLHelper } from "../../../src/Common/FileIO/Mxl"; -/* tslint:disable:no-unused-expression */ describe("MXL Tests", () => { // Generates a test for a mxl file name function testFile(scoreName: string): void { - it(`reads ${scoreName}`, (done: MochaDone) => { + it(`reads ${scoreName}`, (done: Mocha.Done) => { // Load the xml file content const mxl: string = TestUtils.getMXL(scoreName); chai.expect(mxl).to.not.be.undefined; @@ -35,7 +35,7 @@ describe("MXL Tests", () => { } // Test failure - it("Corrupted file", (done: MochaDone) => { + it("Corrupted file", (done: Mocha.Done) => { MXLHelper.MXLtoIXmlElement("").then( (score: IXmlElement) => { chai.expect(score).to.not.be.undefined; diff --git a/test/MusicalScore/Graphical/VexFlow/VexFlowConverter_Clef_Test.ts b/test/MusicalScore/Graphical/VexFlow/VexFlowConverter_Clef_Test.ts index e6f0cb295..d66d877de 100644 --- a/test/MusicalScore/Graphical/VexFlow/VexFlowConverter_Clef_Test.ts +++ b/test/MusicalScore/Graphical/VexFlow/VexFlowConverter_Clef_Test.ts @@ -2,7 +2,6 @@ import {IXmlElement} from "../../../../src/Common/FileIO/Xml"; import {MusicSheet} from "../../../../src/MusicalScore/MusicSheet"; import {MusicSheetReader} from "../../../../src/MusicalScore/ScoreIO/MusicSheetReader"; -/* tslint:disable:no-unused-expression */ describe("Clef Converter MusicXML to VexFlow", () => { let reader: MusicSheetReader; diff --git a/test/MusicalScore/Graphical/VexFlow/VexFlowMeasure_Test.ts b/test/MusicalScore/Graphical/VexFlow/VexFlowMeasure_Test.ts index 14f0e1991..586a5411f 100644 --- a/test/MusicalScore/Graphical/VexFlow/VexFlowMeasure_Test.ts +++ b/test/MusicalScore/Graphical/VexFlow/VexFlowMeasure_Test.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-expressions */ import {GraphicalMusicSheet} from "../../../../src/MusicalScore/Graphical/GraphicalMusicSheet"; import {IXmlElement} from "../../../../src/Common/FileIO/Xml"; import {MusicSheet} from "../../../../src/MusicalScore/MusicSheet"; @@ -10,7 +11,6 @@ import {GraphicalMeasure} from "../../../../src/MusicalScore/Graphical/Graphical import {MusicSheetCalculator} from "../../../../src/MusicalScore/Graphical/MusicSheetCalculator"; import {EngravingRules} from "../../../../src/MusicalScore/Graphical/EngravingRules"; -/* tslint:disable:no-unused-expression */ describe("VexFlow Measure", () => { it("GraphicalMusicSheet", (done: MochaDone) => { diff --git a/test/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer_Test.ts b/test/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer_Test.ts index 0ea360e47..a29e4208b 100644 --- a/test/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer_Test.ts +++ b/test/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer_Test.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-expressions */ import {VexFlowMusicSheetDrawer} from "../../../../src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer"; import {GraphicalMusicSheet} from "../../../../src/MusicalScore/Graphical/GraphicalMusicSheet"; import {MusicSheet} from "../../../../src/MusicalScore/MusicSheet"; @@ -8,7 +9,6 @@ import {IXmlElement} from "../../../../src/Common/FileIO/Xml"; import {VexFlowBackend} from "../../../../src/MusicalScore/Graphical/VexFlow/VexFlowBackend"; import {CanvasVexFlowBackend} from "../../../../src/MusicalScore/Graphical/VexFlow/CanvasVexFlowBackend"; -/* tslint:disable:no-unused-expression */ describe("VexFlow Music Sheet Drawer", () => { it("draws sheet \"Clementi pt. 1\"", (done: MochaDone) => { diff --git a/test/MusicalScore/ScoreCalculation/MusicSheetCalculator_Test.ts b/test/MusicalScore/ScoreCalculation/MusicSheetCalculator_Test.ts index e547d5478..478b4fab2 100644 --- a/test/MusicalScore/ScoreCalculation/MusicSheetCalculator_Test.ts +++ b/test/MusicalScore/ScoreCalculation/MusicSheetCalculator_Test.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-expressions */ import {MusicSheetReader} from "../../../src/MusicalScore/ScoreIO/MusicSheetReader"; import {MusicSheet} from "../../../src/MusicalScore/MusicSheet"; import {IXmlElement} from "../../../src/Common/FileIO/Xml"; @@ -8,7 +9,6 @@ import {VexFlowTextMeasurer} from "../../../src/MusicalScore/Graphical/VexFlow/V import {TestUtils} from "../../Util/TestUtils"; import {EngravingRules} from "../../../src"; -/* tslint:disable:no-unused-expression */ describe("Music Sheet Calculator", () => { const filename: string = "MuzioClementi_SonatinaOpus36No1_Part1.xml"; const reader: MusicSheetReader = new MusicSheetReader(); diff --git a/test/MusicalScore/ScoreIO/Key_Test.ts b/test/MusicalScore/ScoreIO/Key_Test.ts index ad0fcd64e..59b21b989 100644 --- a/test/MusicalScore/ScoreIO/Key_Test.ts +++ b/test/MusicalScore/ScoreIO/Key_Test.ts @@ -11,7 +11,6 @@ import { RhythmInstruction, RhythmSymbolEnum } from "../../../src/MusicalScore/V let reader: MusicSheetReader; let parser: DOMParser; -/* tslint:disable:no-unused-expression */ describe("MusicXML parser for element 'key'", () => { before((): void => { diff --git a/test/MusicalScore/ScoreIO/MusicSheetReader_Test.ts b/test/MusicalScore/ScoreIO/MusicSheetReader_Test.ts index 831546eae..4d310feac 100644 --- a/test/MusicalScore/ScoreIO/MusicSheetReader_Test.ts +++ b/test/MusicalScore/ScoreIO/MusicSheetReader_Test.ts @@ -1,8 +1,8 @@ +/* eslint-disable @typescript-eslint/no-unused-expressions */ import {MusicSheetReader} from "../../../src/MusicalScore/ScoreIO/MusicSheetReader"; import {MusicSheet} from "../../../src/MusicalScore/MusicSheet"; import {IXmlElement} from "../../../src/Common/FileIO/Xml"; -/* tslint:disable:no-unused-expression */ describe("Music Sheet Reader", () => { const path: string = "test/data/MuzioClementi_SonatinaOpus36No1_Part1.xml"; const reader: MusicSheetReader = new MusicSheetReader(); diff --git a/test/MusicalScore/VoiceData/NoteType_Test.ts b/test/MusicalScore/VoiceData/NoteType_Test.ts index 78dac8cfb..72ef2f415 100644 --- a/test/MusicalScore/VoiceData/NoteType_Test.ts +++ b/test/MusicalScore/VoiceData/NoteType_Test.ts @@ -1,6 +1,5 @@ import { NoteType, NoteTypeHandler } from "../../../src/MusicalScore/VoiceData/NoteType"; -/* tslint:disable:no-unused-expression */ describe("NoteType", () => { it("parses 32nd note correctly (sample value)", (done: MochaDone) => { chai.expect(NoteTypeHandler.StringToNoteType("32nd")).to.equal(NoteType._32nd);