Skip to content

Commit

Permalink
eslintをflat configに移行。
Browse files Browse the repository at this point in the history
依存関係を更新
  • Loading branch information
logue committed Apr 25, 2024
1 parent d6bf881 commit 7e59841
Show file tree
Hide file tree
Showing 18 changed files with 652 additions and 437 deletions.
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

37 changes: 0 additions & 37 deletions .eslintrc.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Recomposer file (\*.rcm) support.
## License

Copyright © 2013 imaya / GREE Inc.
Copyright © 2013-2023 by Logue.
Copyright © 2013-2024 by Logue.

[PSGConverter.js](https://github.com/logue/PSGConverter) Copyright © 2006-2012 by Logue.

Expand Down
40 changes: 24 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"url": "https://logue.dev"
}
],
"version": "0.5.6",
"version": "0.6.0",
"license": "MIT",
"repository": {
"type": "git",
Expand Down Expand Up @@ -54,7 +54,7 @@
}
},
"engines": {
"node": ">=18.12.5",
"node": ">=20.12.7",
"yarn": ">=1.22.19"
},
"packageManager": "[email protected]",
Expand All @@ -69,31 +69,36 @@
"prepare": "husky install"
},
"dependencies": {
"encoding-japanese": "^2.0.0",
"ini": "^4.1.1"
"encoding-japanese": "^2.1.0",
"ini": "^4.1.2"
},
"devDependencies": {
"@eslint/eslintrc": "^3.0.2",
"@eslint/js": "^9.1.1",
"@popperjs/core": "^2.11.8",
"@types/ini": "^4.1.0",
"@zip.js/zip.js": "^2.7.34",
"bootstrap": "5.3.2",
"@zip.js/zip.js": "^2.7.43",
"bootstrap": "5.3.3",
"bootstrap-icons": "^1.11.3",
"buffer": "^6.0.3",
"dseg": "^0.46.0",
"eslint": "^8.56.0",
"eslint-config-google": "^0.14.0",
"eslint": "^9.1.1",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^17.3.1",
"eslint-plugin-prettier": "^5.1.3",
"husky": "^9.0.10",
"eslint-plugin-promise": "^6.1.1",
"globals": "^15.0.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"query-string": "^8.2.0",
"query-string": "^9.0.0",
"rimraf": "^5.0.5",
"sass": "^1.70.0",
"sass": "^1.75.0",
"streamsaver": "^2.0.6",
"vite": "^5.0.12",
"vite": "^5.2.10",
"vite-plugin-banner": "^0.7.1",
"vite-plugin-checker": "^0.6.4"
},
Expand All @@ -107,10 +112,13 @@
"*": "prettier -w -u"
},
"resolutions": {
"json5": "^2.2.3",
"get-func-name": ">=2.0.2",
"ip": ">=2.0.1",
"json5": ">=2.2.3",
"lodash": ">=4.17.21",
"postcss": "^8.4.31",
"semver": "^7.5.3",
"yaml": "^2.3.2"
"postcss": ">=8.4.31",
"semver": ">=7.5.3",
"tar": ">=6.2.1",
"yaml": ">=2.3.2"
}
}
15 changes: 8 additions & 7 deletions src-docs/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import QueryString from 'query-string';
import Player from '@/player.js';
import * as zip from '@zip.js/zip.js';
import { Tab, Tooltip } from 'bootstrap';
import QueryString from 'query-string';
import { createWriteStream } from 'streamsaver';
import * as zip from '@zip.js/zip.js';

import Player from '@/player.js';
import './style.scss';

formLock(true);
Expand Down Expand Up @@ -415,7 +416,7 @@ async function loadSample(zipfile) {
});

// セレクトボックスに流し込む
entries.forEach((/** @type {import('@zip.js/zip.js').Entry}*/ entry) => {
entries.forEach((/** @type {import('@zip.js/zip.js').Entry} */ entry) => {
const ext = entry.filename
.slice(entry.filename.lastIndexOf('.'))
.toLowerCase();
Expand All @@ -437,7 +438,7 @@ async function loadSample(zipfile) {
// 初期値が一番上の項目になるとつまらないのでランダム化
const prev = select.selectedIndex;
let next = prev;
while (prev == next) {
while (prev === next) {
next = ~~(select.length * Math.random());
}
select.selectedIndex = next;
Expand Down Expand Up @@ -651,7 +652,7 @@ window.onmessage = (/** @type {MessageEvent} */ e) => {
if (select.selectedIndex !== 0) {
// ループで最初に戻った場合(player.positionがリセットされた場合)
// 次の曲を選択
if (select.selectedIndex == files.options.length) {
if (select.selectedIndex === files.options.length) {
// 末尾の場合最初に戻る
files.selectedIndex = 0;
} else {
Expand Down Expand Up @@ -756,7 +757,7 @@ setInterval(() => {

/** @type {HTMLSelectElement} */
const files = document.getElementById('files');
if (files.selectedIndex == files.options.length) {
if (files.selectedIndex === files.options.length) {
// 末尾の場合最初に戻る
files.selectedIndex = 0;
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Meta from './meta';
import Player from './player';
import Parser from './smf';
import {
MabiIcco,
MakiMabiSequence,
MapleStory2Mml,
ThreeMacroLanguageEditor,
PSGConverter,
} from './mabi_mml_parser';
import Meta from './meta';
import Player from './player';
import Parser from './smf';

const SMF = {
Player,
Expand Down
5 changes: 4 additions & 1 deletion src/mabi_mml_parser/3mle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { MetaEvent, ChannelEvent, SystemExclusiveEvent } from '../midi_event';

import PSGConverter from './PSGConverter';
import MakiMabiSequence from './mms';

Expand All @@ -17,13 +18,15 @@ export default class ThreeMacroLanguageEditor extends MakiMabiSequence {
constructor(input, optParams = {}) {
super(input, optParams);
}

/**
*/
parse() {
this.parseHeader();
this.parseTracks();
this.toPlainTrack();
}

/**
*/
parseHeader() {
Expand Down Expand Up @@ -119,7 +122,7 @@ export default class ThreeMacroLanguageEditor extends MakiMabiSequence {
if (!Object.prototype.hasOwnProperty.call(mmls, no)) {
continue;
}
if (settings[no] !== void 0) {
if (settings[no]) {
data[no] = {
mml: mmls[no],
name: settings[no].name || '',
Expand Down
5 changes: 3 additions & 2 deletions src/mabi_mml_parser/PSGConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default class PSGConverter {
a: 9,
b: 11,
};

/** @type {number} ベロシティの倍率 */
static VELOCITY_MAGNIFICATION = 7; // 127÷15≒8.4

Expand Down Expand Up @@ -119,7 +120,7 @@ export default class PSGConverter {
let value = 0;

/** @type {string[]} 音長(L)、オクターブ(O<>)、テンポ(T)、ベロシティ(V)をパース */
const matches = RegExp(/([lotv<>])([1-9]\d*|0?)(\.?)(&?)/).exec(message);
const matches = /([lotv<>])([1-9]\d*|0?)(\.?)(&?)/.exec(message);

if (matches) {
command = matches[1].toLowerCase();
Expand Down Expand Up @@ -183,7 +184,7 @@ export default class PSGConverter {
: currentOctave + 1;
break;
}
} else if (RegExp(/([a-gn])([+#-]?)(\d*)(\.?)(&?)/).exec(message)) {
} else if (/([a-gn])([+#-]?)(\d*)(\.?)(&?)/.exec(message)) {
// ノート命令(CDEFGAB)、絶対音階指定(N)をパース

/** @type {number} 音階 */
Expand Down
4 changes: 2 additions & 2 deletions src/mabi_mml_parser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* @license MIT
*/

import ThreeMacroLanguageEditor from './3mle';
import PSGConverter from './PSGConverter';
import MabiIcco from './mmi';
import MakiMabiSequence from './mms';
import MapleStory2Mml from './ms2mml';
import ThreeMacroLanguageEditor from './3mle';
import PSGConverter from './PSGConverter';

export {
MabiIcco,
Expand Down
4 changes: 3 additions & 1 deletion src/mabi_mml_parser/mmi.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { MetaEvent, ChannelEvent, SystemExclusiveEvent } from '../midi_event';

import PSGConverter from './PSGConverter';
import MakiMabiSequence from './mms';

Expand All @@ -18,6 +19,7 @@ export default class MabiIcco extends MakiMabiSequence {
'songProgram',
'panpot',
];

/**
* @param {ArrayBuffer} input
* @param {Object=} optParams
Expand Down Expand Up @@ -180,7 +182,7 @@ export default class MabiIcco extends MakiMabiSequence {
// 複数の奏者でコーラスが指定されていた場合、男性女性用関係なく一番うしろのコーラスで指定された音色でマージされる。
currentCh = 15;
}
if (mmls[chord] === void 0) {
if (!mmls[chord]) {
continue;
}

Expand Down
5 changes: 4 additions & 1 deletion src/mabi_mml_parser/mms.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { parse } from 'ini';
import { convert } from 'encoding-japanese';
import { parse } from 'ini';

import { MetaEvent, ChannelEvent, SystemExclusiveEvent } from '../midi_event';

import PSGConverter from './PSGConverter';

/**
Expand Down Expand Up @@ -53,6 +54,7 @@ export default class MakiMabiSequence {
this.parseTracks();
this.toPlainTrack();
}

/**
* ヘッダーメタ情報をパース
*/
Expand Down Expand Up @@ -100,6 +102,7 @@ export default class MakiMabiSequence {
delete this.input.infomation;
delete this.input['mms-file'];
}

/**
* MML parse
*/
Expand Down
3 changes: 2 additions & 1 deletion src/mabi_mml_parser/ms2mml.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { MetaEvent } from '../midi_event';
import MakiMabiSequence from './mms';

import PSGConverter from './PSGConverter';
import MakiMabiSequence from './mms';

/**
* @classdesc MapleStory2 Mml Parser
Expand Down
1 change: 1 addition & 0 deletions src/midi_event.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class MetaEvent extends MidiEvent {
0x59: 'KeySignature',
0x7f: 'SequencerSpecific',
};

/**
* @param {string} subtype
* @param {number} deltaTime delta time.
Expand Down
6 changes: 3 additions & 3 deletions src/mld.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ export default class Mld {
id: pos,
type: 'internal',
subType: 'ProgramChange',
time: time,
time,
part: mfiEvent.value.part,
instrument:
(prevEvent.value.instrument << 6) | mfiEvent.value.instrument,
Expand Down Expand Up @@ -815,7 +815,7 @@ export default class Mld {
/** @type {Array.<number>} */
const table = [0, 12, -24, -12];

if (table[octaveShift] !== void 0) {
if (table[octaveShift]) {
return key + table[octaveShift];
}

Expand Down Expand Up @@ -878,7 +878,7 @@ export default class Mld {
return array;
}

if (this.dataInformation.copy !== void 0) {
if (this.dataInformation.copy) {
/** @type {Array.<number>} */
let copy = stringToArray(this.dataInformation.copy);

Expand Down
Loading

0 comments on commit 7e59841

Please sign in to comment.