Skip to content

Commit

Permalink
Merge pull request #1213 from rvilarl/migration/eslintUpdate
Browse files Browse the repository at this point in the history
Update `.eslintrc` with new rules and sort order.
  • Loading branch information
ronyeh authored Nov 4, 2021
2 parents 5113a69 + dffd1f3 commit f79be12
Show file tree
Hide file tree
Showing 57 changed files with 138 additions and 66 deletions.
35 changes: 29 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
"parserOptions": {
"project": "tsconfig.json"
},
"plugins": ["@typescript-eslint", "prettier", "simple-import-sort"],
"plugins": ["@typescript-eslint", "prettier", "simple-import-sort", "import"],
"rules": {
"no-console": 1, // Means warning
"prettier/prettier": 2, // Means error
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error"
"no-console": "warn",
"prettier/prettier": "warn",
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
"import/first": "error",
"import/no-duplicates": "error",
"import/newline-after-import": "warn"
},
"overrides": [
{
Expand All @@ -22,7 +25,27 @@
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-inferrable-types": "off"
"@typescript-eslint/no-inferrable-types": "off",
"simple-import-sort/imports": [
"warn",
{
"groups": [
// Vex goes first!
["^.*/vex$"],
["^.*/vexflow_test_helpers$"],
// Side effect imports.
["^\\u0000"],
// Packages.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
["^@?\\w"],
// Absolute imports and other imports such as Vue-style `@/foo`.
// Anything not matched in another group.
["^"],
// All other relative imports (anything that starts with a dot).
["^\\."]
]
}
]
}
},
{
Expand Down
3 changes: 1 addition & 2 deletions src/clefnote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// MIT License

import { BoundingBox } from './boundingbox';
import { Clef } from './clef';
import { ClefType } from './clef';
import { Clef, ClefType } from './clef';
import { Glyph } from './glyph';
import { ModifierContext } from './modifiercontext';
import { Note } from './note';
Expand Down
3 changes: 1 addition & 2 deletions src/repeatnote.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// [VexFlow](http://vexflow.com) - Copyright (c) Mohit Muthanna 2010.

import { Glyph } from './glyph';
import { GlyphNote } from './glyphnote';
import { GlyphNoteOptions } from './glyphnote';
import { GlyphNote, GlyphNoteOptions } from './glyphnote';
import { NoteStruct } from './note';
import { Tables } from './tables';

Expand Down
3 changes: 1 addition & 2 deletions src/stavenote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import { ModifierContextState } from './modifiercontext';
import { Note, NoteStruct } from './note';
import { NoteHead } from './notehead';
import { Stave } from './stave';
import { Stem } from './stem';
import { StemOptions } from './stem';
import { Stem, StemOptions } from './stem';
import { StemmableNote } from './stemmablenote';
import { Tables } from './tables';
import { defined, log, midLine, RuntimeError, warn } from './util';
Expand Down
3 changes: 1 addition & 2 deletions src/stemmablenote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
// `StemmableNote` is an abstract interface for notes with optional stems.
// Examples of stemmable notes are `StaveNote` and `TabNote`

import { Glyph } from './glyph';
import { GlyphProps } from './glyph';
import { Glyph, GlyphProps } from './glyph';
import { Note, NoteStruct } from './note';
import { Stem, StemOptions } from './stem';
import { Tables } from './tables';
Expand Down
3 changes: 2 additions & 1 deletion tests/accidental_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//
// Accidental Tests

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Accidental } from '../src/accidental';
import { Beam } from '../src/beam';
import { Factory } from '../src/factory';
Expand All @@ -19,7 +21,6 @@ import { TickContext } from '../src/tickcontext';
import { TimeSigNote } from '../src/timesignote';
import { isCategory } from '../src/typeguard';
import { Voice } from '../src/voice';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

const AccidentalTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/annotation_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
// Did a previous version of the API accept a number as the fourth argument?
// We removed the fourth argument from all of our test cases.

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Annotation } from '../src/annotation';
import { Beam } from '../src/beam';
import { Bend } from '../src/bend';
Expand All @@ -21,7 +23,6 @@ import { TabStave } from '../src/tabstave';
import { Tickable } from '../src/tickable';
import { Vibrato } from '../src/vibrato';
import { Voice } from '../src/voice';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

const AnnotationTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/articulation_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//
// Articulation Tests

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Articulation } from '../src/articulation';
import { Beam } from '../src/beam';
import { Flow } from '../src/flow';
Expand All @@ -15,7 +17,6 @@ import { StaveNote } from '../src/stavenote';
import { TabNote } from '../src/tabnote';
import { TabStave } from '../src/tabstave';
import { Voice } from '../src/voice';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

const ArticulationTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/auto_beam_formatting_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
// TODO: Beam.generateBeams(voice.getTickables() as StemmableNote[], ...) requires a cast to StemmableNote[].
// Is there a cleaner way to handle this?

import { concat, TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Beam } from '../src/beam';
import { EasyScore } from '../src/easyscore';
import { Fraction } from '../src/fraction';
import { Stem } from '../src/stem';
import { StemmableNote } from '../src/stemmablenote';
import { concat, TestOptions, VexFlowTests } from './vexflow_test_helpers';

const AutoBeamFormattingTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/bach_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
//
// Bach Demo

import { concat, TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Factory } from '../src/factory';
import { Registry } from '../src/registry';
import { BarlineType } from '../src/stavebarline';
import { StaveNote } from '../src/stavenote';
import { concat, TestOptions, VexFlowTests } from './vexflow_test_helpers';

const BachDemoTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/barline_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
//
// Barline Tests

import { Barline, BarlineType } from '../src/stavebarline';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Barline, BarlineType } from '../src/stavebarline';

const BarlineTests = {
Start(): void {
QUnit.module('Barline');
Expand Down
3 changes: 2 additions & 1 deletion tests/beam_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@

// TODO: Factory.Beam()'s 'notes' argument is a StemmableNote[], but we only have access to Tickable[].

import { concat, TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Beam } from '../src/beam';
import { StaveNoteStruct } from '../src/stavenote';
import { Stem } from '../src/stem';
import { StemmableNote } from '../src/stemmablenote';
import { TabNoteStruct } from '../src/tabnote';
import { Voice } from '../src/voice';
import { concat, TestOptions, VexFlowTests } from './vexflow_test_helpers';

const BeamTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/bend_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//
// Bend Tests

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Bend, BendPhrase } from '../src/bend';
import { Formatter } from '../src/formatter';
import { ModifierContext } from '../src/modifiercontext';
Expand All @@ -11,7 +13,6 @@ import { ContextBuilder } from '../src/renderer';
import { TabNote, TabNoteStruct } from '../src/tabnote';
import { TabStave } from '../src/tabstave';
import { TickContext } from '../src/tickcontext';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

const BendTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/boundingboxcomputation_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
//
// BoundingBoxComputation Tests

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { BoundingBoxComputation } from '../src/boundingboxcomputation';
import { Glyph, OutlineCode } from '../src/glyph';
import { RenderContext } from '../src/rendercontext';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

const BoundingBoxComputationTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/chordsymbol_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
//
// ChordSymbol Tests

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Accidental } from '../src/accidental';
import { ChordSymbol } from '../src/chordsymbol';
import { Factory } from '../src/factory';
import { Formatter } from '../src/formatter';
import { Stave } from '../src/stave';
import { StaveNote } from '../src/stavenote';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

const ChordSymbolTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/curve_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
//
// Curve Tests

import { concat, TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { CurvePosition } from '../src/curve';
import { BuilderOptions } from '../src/easyscore';
import { Factory } from '../src/factory';
import { StaveNote } from '../src/stavenote';
import { concat, TestOptions, VexFlowTests } from './vexflow_test_helpers';

const CurveTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/dot_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//
// Dot Tests

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Beam } from '../src/beam';
import { ModifierContext } from '../src/modifiercontext';
import { Note } from '../src/note';
Expand All @@ -11,7 +13,6 @@ import { ContextBuilder } from '../src/renderer';
import { Stave } from '../src/stave';
import { StaveNote } from '../src/stavenote';
import { TickContext } from '../src/tickcontext';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

const DotTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/easyscore_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
//
// EasyScore Tests

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Articulation } from '../src/articulation';
import { EasyScore } from '../src/easyscore';
import { FretHandFinger } from '../src/frethandfinger';
import { Modifier } from '../src/modifier';
import { StaveConnector } from '../src/staveconnector';
import { Stem } from '../src/stem';
import { Tuplet } from '../src/tuplet';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

const EasyScoreTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/factory_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
//
// Factory Tests

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Factory } from '../src/factory';
import { Barline } from '../src/stavebarline';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

const FactoryTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/formatter_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//
// Formatter Tests

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Annotation } from '../src/annotation';
import { Beam } from '../src/beam';
import { Bend } from '../src/bend';
Expand All @@ -16,7 +18,6 @@ import { StaveConnector } from '../src/staveconnector';
import { StaveNote } from '../src/stavenote';
import { Voice, VoiceTime } from '../src/voice';
import { MockTickable } from './mocks';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

const FormatterTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/ghostnote_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
//
// GhostNote Tests

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { EasyScore } from '../src/easyscore';
import { Factory } from '../src/factory';
import { StaveNote } from '../src/stavenote';
import { StemmableNote } from '../src/stemmablenote';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

const GhostNoteTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/glyphnote_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
//
// GlyphNote Tests

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { ChordSymbol } from '../src/chordsymbol';
import { Glyph } from '../src/glyph';
import { Note } from '../src/note';
import { Registry } from '../src/registry';
import { StaveConnector } from '../src/staveconnector';
import { Voice } from '../src/voice';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

const GlyphNoteTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/gracenote_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@

// TODO: In the 'stem' test (aka Grace Note Stem › SVG + Petaluma in flow.html), the Petaluma note heads are not scaled down properly.

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Beam } from '../src/beam';
import { Factory } from '../src/factory';
import { Formatter } from '../src/formatter';
import { GraceNote, GraceNoteStruct } from '../src/gracenote';
import { StaveNote, StaveNoteStruct } from '../src/stavenote';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

const GraceNoteTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/gracetabnote_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//
// GraceTabNote Tests

import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Flow } from '../src/flow';
import { Formatter } from '../src/formatter';
import { GraceNoteGroup } from '../src/gracenotegroup';
Expand All @@ -12,7 +14,6 @@ import { ContextBuilder } from '../src/renderer';
import { TabNote, TabNoteStruct } from '../src/tabnote';
import { TabStave } from '../src/tabstave';
import { Voice } from '../src/voice';
import { TestOptions, VexFlowTests } from './vexflow_test_helpers';

const GraceTabNoteTests = {
Start(): void {
Expand Down
3 changes: 2 additions & 1 deletion tests/key_clef_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
// Clef Key Signature Tests
//

import { MAJOR_KEYS, MINOR_KEYS, TestOptions, VexFlowTests } from './vexflow_test_helpers';

import { Glyph } from '../src/glyph';
import { KeySignature } from '../src/keysignature';
import { ContextBuilder } from '../src/renderer';
import { Stave } from '../src/stave';
import { Tables } from '../src/tables';
import { MAJOR_KEYS, MINOR_KEYS, TestOptions, VexFlowTests } from './vexflow_test_helpers';

const ClefKeySignatureTests = {
Start(): void {
Expand Down
Loading

0 comments on commit f79be12

Please sign in to comment.