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 cc92ae8 commit 7c5bc31
Show file tree
Hide file tree
Showing 17 changed files with 1,096 additions and 771 deletions.
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

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

This file was deleted.

324 changes: 162 additions & 162 deletions .yarn/releases/yarn-4.1.0.cjs → .yarn/releases/yarn-4.1.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.1.0.cjs
yarnPath: .yarn/releases/yarn-4.1.1.cjs
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,4 @@ equires a browser that supports the Web Audio API.
Licensed under the MIT License.

- 2013 by imaya / GREE Inc.
- 2013-2023 by Logue
- 2013-2024 by Logue
107 changes: 107 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import globals from 'globals';
import eslintConfigPrettier from 'eslint-config-prettier';
import path from 'path';
import { fileURLToPath } from 'url';
import { FlatCompat } from '@eslint/eslintrc';
import pluginJs from '@eslint/js';
import pluginImport from 'eslint-plugin-import';

// mimic CommonJS variables -- not needed if using CommonJS
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: pluginJs.configs.recommended,
});

export default [
{
ignores: [
'.vscode/',
'.yarn/',
'dist/',
'public/',
'docs/',
'src/**/*.generated.*',
'eslint.config.js',
],
},
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
...compat.extends('standard'),
{
languageOptions: {
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
plugins: {
import: pluginImport,
},
settings: {
// This will do the trick
'import/parsers': {
espree: ['.js', '.cjs', '.mjs', '.jsx'],
},
'import/resolver': {
node: true,
alias: {
map: [
['@', './src'],
['~', './node_modules'],
],
extensions: ['.js', '.jsx'],
},
},
vite: {
configPath: './vite.config.ts',
},
},
rules: {
camelcase: 'off',
'no-unused-vars': 'warn',
// Fix for Vue setup style
'import/default': 'off',
// Fix for Vue setup style
'import/no-default-export': 'off',
// Sort Import Order.
// see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md#importorder-enforce-a-convention-in-module-import-order
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'parent',
'sibling',
'index',
'object',
'type',
],
pathGroups: [
// Vue Core
{
pattern:
'{vue,vue-router,vuex,@/stores,vue-i18n,pinia,vite,vitest,vitest/**,@vitejs/**,@vue/**}',
group: 'external',
position: 'before',
},
// Internal Codes
{
pattern: '{@/**}',
group: 'internal',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['builtin'],
alphabetize: {
order: 'asc',
},
'newlines-between': 'always',
},
],
},
},
// ...pluginVue.configs['flat/recommended'],
eslintConfigPrettier,
];
6 changes: 3 additions & 3 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"$schema": "https://json.schemastore.org/jsconfig",
"compilerOptions": {
"module": "ESNext",
"module": "NodeNext",
"target": "ESNext",
"moduleResolution": "nodenext",
"resolveJsonModule": true,
"checkJs": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"types": ["webmidi", "node"],
"types": ["webmidi", "node"]
},
"exclude": ["node_modules"],
"exclude": ["node_modules"]
}
34 changes: 20 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@logue/sf2synth",
"version": "0.6.3",
"version": "0.7.0",
"type": "module",
"description": "SoundFont2 Synthesizer",
"repository": {
Expand Down Expand Up @@ -63,10 +63,10 @@
"./dist/A320U-license.txt": "./dist/A320U-license.txt"
},
"engines": {
"node": ">=18.12.5",
"node": ">=20.12.7",
"yarn": ">=1.22.19"
},
"packageManager": "[email protected].0",
"packageManager": "[email protected].1",
"scripts": {
"dev": "vite",
"clean": "rimraf node_modules/.vite",
Expand All @@ -79,29 +79,35 @@
"prepare": "husky install"
},
"dependencies": {
"@logue/reverb": "^1.3.7",
"bootstrap": "^5.3.2"
"@logue/reverb": "^1.3.9",
"bootstrap": "^5.3.3"
},
"devDependencies": {
"@types/node": "^20.11.16",
"@eslint/eslintrc": "^3.0.2",
"@eslint/js": "^9.1.1",
"@types/node": "^20.12.7",
"@types/webmidi": "^2.0.10",
"eslint": "^8.56.0",
"eslint": "^8.0.1",
"eslint-config-google": "^0.14.0",
"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-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
"eslint-plugin-prettier": "^5.1.3",
"husky": "^9.0.10",
"eslint-plugin-promise": "^6.0.0",
"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",
"stylelint": "^16.2.1",
"sass": "1.75.0",
"stylelint": "^16.4.0",
"stylelint-config-recommended-scss": "^14.0.0",
"stylelint-order": "^6.0.4",
"stylelint-prettier": "^5.0.0",
"vite": "^5.0.12",
"vite": "^5.2.10",
"vite-plugin-banner": "^0.7.1",
"vite-plugin-checker": "^0.6.4"
},
Expand All @@ -122,4 +128,4 @@
"semver": "^7.5.3",
"yaml": "^2.3.2"
}
}
}
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import WebMidiLink from './wml';
import WebMidiApi from './web_midi_api';
import Parser from './sf2';
import Meta from './meta.js';
import Parser from './sf2.js';
import WebMidiApi from './web_midi_api.js';
import WebMidiLink from './wml.js';
import './wml.scss';

const SoundFont = {
Expand Down
2 changes: 1 addition & 1 deletion src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class Loader {
this.progressOuter = document.createElement('div');
this.progressOuter.className = 'progress';
this.progressOuter.role = 'progressbar';
this.progressOuter.ariaLabel = `Loading Progress`;
this.progressOuter.ariaLabel = 'Loading Progress';
this.progressOuter.ariaValueMin = '0';
this.progressOuter.ariaValueNow = '0';
this.progressOuter.ariaValueMax = '100';
Expand Down
4 changes: 2 additions & 2 deletions src/riff.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ export class Riff {
/** @type {number} */
this.offset = this.ip;
/** @type {boolean} */
this.padding = optParams.padding !== void 0 ? optParams.padding : true;
this.padding = optParams.padding !== undefined ? optParams.padding : true;
/** @type {boolean} */
this.bigEndian =
optParams.bigEndian !== void 0 ? optParams.bigEndian : false;
optParams.bigEndian !== undefined ? optParams.bigEndian : false;
}

/** @returns {void} */
Expand Down
46 changes: 23 additions & 23 deletions src/sf2.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,16 +628,16 @@ export default class Parser {
samples.push(sample);

sampleHeader.push({
sampleName: sampleName,
start: start,
end: end,
startLoop: startLoop,
endLoop: endLoop,
sampleRate: sampleRate,
originalPitch: originalPitch,
pitchCorrection: pitchCorrection,
sampleLink: sampleLink,
sampleType: sampleType,
sampleName,
start,
end,
startLoop,
endLoop,
sampleRate,
originalPitch,
pitchCorrection,
sampleLink,
sampleType,
});
}
}
Expand Down Expand Up @@ -673,8 +673,8 @@ export default class Parser {
}

return {
sample: sample,
multiply: multiply,
sample,
multiply,
};
}

Expand Down Expand Up @@ -704,12 +704,12 @@ export default class Parser {
// Dest Oper
code = data[ip++] | (data[ip++] << 8);
key = this.GeneratorEnumeratorTable[code];
if (key === void 0) {
if (!key) {
// Amount
output.push({
type: key,
value: {
code: code,
code,
amount: data[ip] | (((data[ip + 1] << 8) << 16) >> 16),
lo: data[ip++],
hi: data[ip++],
Expand Down Expand Up @@ -778,11 +778,11 @@ export default class Parser {
while (ip < size) {
code = data[ip++] | (data[ip++] << 8);
key = this.GeneratorEnumeratorTable[code];
if (key === void 0) {
if (!key) {
output.push({
type: key,
value: {
code: code,
code,
amount: data[ip] | (((data[ip + 1] << 8) << 16) >> 16),
lo: data[ip++],
hi: data[ip++],
Expand Down Expand Up @@ -927,18 +927,18 @@ export default class Parser {
});

instrument =
presetGenerator.generator['instrument'] !== void 0
? presetGenerator.generator['instrument'].amount
: presetModulator.modulator['instrument'] !== void 0
? presetModulator.modulator['instrument'].amount
presetGenerator.generator.instrument !== undefined
? presetGenerator.generator.instrument.amount
: presetModulator.modulator.instrument !== undefined
? presetModulator.modulator.instrument.amount
: null;
}

output.push({
name: preset[i].presetName,
info: zoneInfo,
header: preset[i],
instrument: instrument,
instrument,
});
}

Expand Down Expand Up @@ -1078,8 +1078,8 @@ export default class Parser {
}

return {
modgen: modgen,
modgenInfo: modgenInfo,
modgen,
modgenInfo,
};
}
}
Loading

0 comments on commit 7c5bc31

Please sign in to comment.