mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-26 03:23:11 +00:00
linting
This commit is contained in:
parent
8d75c16f20
commit
10c27a99e1
20 changed files with 966 additions and 612 deletions
90
.eslintrc.cjs
Normal file
90
.eslintrc.cjs
Normal file
|
@ -0,0 +1,90 @@
|
|||
module.exports = {
|
||||
parser: "@typescript-eslint/parser",
|
||||
plugins: ["jsdoc", "html"],
|
||||
extends: ["plugin:@typescript-eslint/recommended"],
|
||||
rules: {
|
||||
"prefer-rest-params": "off",
|
||||
"@typescript-eslint/ban-ts-ignore": "off",
|
||||
"@typescript-eslint/ban-ts-comment" : "off",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"jsdoc/check-alignment": 1,
|
||||
"jsdoc/check-param-names": ["error"],
|
||||
// "jsdoc/check-examples": ["error"],
|
||||
"jsdoc/check-indentation": [
|
||||
"error",
|
||||
{ excludeTags: ["example", "param"] },
|
||||
],
|
||||
"dot-location": ["error", "property"],
|
||||
"linebreak-style": ["error", "unix"],
|
||||
eqeqeq: ["error"],
|
||||
curly: ["error", "all"],
|
||||
"dot-notation": ["error"],
|
||||
"no-throw-literal": ["error"],
|
||||
"no-useless-call": ["error"],
|
||||
"no-unmodified-loop-condition": ["error"],
|
||||
"quote-props": ["error", "as-needed"],
|
||||
quotes: ["error", "double"],
|
||||
"no-shadow": "error",
|
||||
"no-console": ["error", { allow: ["warn"] }],
|
||||
"@typescript-eslint/no-object-literal-type-assertion": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"sort-imports": [
|
||||
"error",
|
||||
{
|
||||
ignoreCase: true,
|
||||
ignoreDeclarationSort: true,
|
||||
ignoreMemberSort: false,
|
||||
memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
|
||||
},
|
||||
],
|
||||
"no-lonely-if": ["error"],
|
||||
semi: ["error", "always"],
|
||||
"no-cond-assign": ["error", "always"],
|
||||
indent: "off",
|
||||
"no-var": "error",
|
||||
"prefer-arrow-callback": "error",
|
||||
"@typescript-eslint/indent": [
|
||||
"error",
|
||||
"tab",
|
||||
{ SwitchCase: 1, MemberExpression: 2 },
|
||||
],
|
||||
"@typescript-eslint/explicit-member-accessibility": "off",
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"no-multi-spaces": ["error"],
|
||||
"array-bracket-spacing": ["error", "never"],
|
||||
"block-spacing": ["error", "always"],
|
||||
"func-call-spacing": ["error", "never"],
|
||||
"key-spacing": ["error", { beforeColon: false, afterColon: true }],
|
||||
"brace-style": ["error", "1tbs"],
|
||||
"space-in-parens": ["error", "never"],
|
||||
"eol-last": ["error", "always"],
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-use-before-define": "off",
|
||||
"@typescript-eslint/array-type": "off",
|
||||
"spaced-comment": [
|
||||
"error",
|
||||
"always",
|
||||
{
|
||||
line: { exceptions: ["-"] },
|
||||
block: { balanced: true },
|
||||
},
|
||||
],
|
||||
"lines-between-class-members": "off",
|
||||
"no-multiple-empty-lines": ["error", { max: 1, maxEOF: 1, maxBOF: 0 }],
|
||||
"no-unneeded-ternary": ["error"],
|
||||
"object-curly-spacing": ["error", "always"],
|
||||
"space-unary-ops": ["error", { words: true, nonwords: false }],
|
||||
"block-spacing": ["error", "always"],
|
||||
"keyword-spacing": ["error", { before: true }],
|
||||
"space-before-function-paren": [
|
||||
"error",
|
||||
{ anonymous: "never", named: "never", asyncArrow: "always" },
|
||||
],
|
||||
"comma-spacing": ["error", { before: false, after: true }],
|
||||
"arrow-spacing": ["error", { before: true, after: true }],
|
||||
"space-before-blocks": [
|
||||
"error",
|
||||
{ functions: "always", keywords: "always", classes: "always" },
|
||||
],
|
||||
},
|
||||
};
|
73
.eslintrc.js
73
.eslintrc.js
|
@ -1,73 +0,0 @@
|
|||
module.exports = {
|
||||
"parser": '@typescript-eslint/parser',
|
||||
"plugins": [
|
||||
'@typescript-eslint',
|
||||
"jsdoc",
|
||||
"html"
|
||||
],
|
||||
"extends": ["plugin:@typescript-eslint/recommended"],
|
||||
"rules": {
|
||||
"prefer-rest-params": "off",
|
||||
"@typescript-eslint/ban-ts-ignore": "off",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"jsdoc/check-alignment": 1,
|
||||
"jsdoc/check-param-names": ["error"],
|
||||
"jsdoc/check-examples": ["error"],
|
||||
"jsdoc/check-indentation": ["error", { "excludeTags": ["example", "param"] }],
|
||||
"dot-location": ["error", "property"],
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"eqeqeq": ["error"],
|
||||
"curly": ["error", "all"],
|
||||
"dot-notation": ["error"],
|
||||
"no-throw-literal": ["error"],
|
||||
"no-useless-call": ["error"],
|
||||
"no-unmodified-loop-condition": ["error"],
|
||||
"quote-props": ["error", "as-needed"],
|
||||
"quotes": ["error", "double"],
|
||||
"no-shadow": "error",
|
||||
"no-console": ["error", { "allow": ["warn"] }],
|
||||
"@typescript-eslint/no-object-literal-type-assertion": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"sort-imports": ["error", {
|
||||
"ignoreCase": true,
|
||||
"ignoreDeclarationSort": true,
|
||||
"ignoreMemberSort": false,
|
||||
"memberSyntaxSortOrder": ["none", "all", "multiple", "single"]
|
||||
}],
|
||||
"no-lonely-if": ["error"],
|
||||
"semi": ["error", "always"],
|
||||
"no-cond-assign": ["error", "always"],
|
||||
"indent": "off",
|
||||
"no-var": "error",
|
||||
"prefer-arrow-callback": "error",
|
||||
"@typescript-eslint/indent": ["error", "tab", { "SwitchCase": 1, "MemberExpression": 2 }],
|
||||
"@typescript-eslint/explicit-member-accessibility": "off",
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"no-multi-spaces": ["error"],
|
||||
"array-bracket-spacing": ["error", "never"],
|
||||
"block-spacing": ["error", "always"],
|
||||
"func-call-spacing": ["error", "never"],
|
||||
"key-spacing": ["error", { "beforeColon": false, "afterColon": true }],
|
||||
"brace-style": ["error", "1tbs"],
|
||||
"space-in-parens": ["error", "never"],
|
||||
"eol-last": ["error", "always"],
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-use-before-define": "off",
|
||||
"@typescript-eslint/array-type": "off",
|
||||
"spaced-comment": ["error", "always", {
|
||||
"line": { "exceptions": ["-"] },
|
||||
"block": { "balanced": true },
|
||||
}],
|
||||
"lines-between-class-members": "off",
|
||||
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 1, "maxBOF": 0 }],
|
||||
"no-unneeded-ternary": ["error"],
|
||||
"object-curly-spacing": ["error", "always"],
|
||||
"space-unary-ops": ["error", { "words": true, "nonwords": false }],
|
||||
"block-spacing": ["error", "always"],
|
||||
"keyword-spacing": ["error", { "before": true }],
|
||||
"space-before-function-paren": ["error", { "anonymous": "never", "named": "never", "asyncArrow": "always" }],
|
||||
"comma-spacing": ["error", { "before": false, "after": true }],
|
||||
"arrow-spacing": ["error", { "before": true, "after": true }],
|
||||
"space-before-blocks": ["error", { "functions": "always", "keywords": "always", "classes": "always" }]
|
||||
}
|
||||
};
|
|
@ -7,7 +7,7 @@ import { readOnly } from "../../core/util/Interface";
|
|||
|
||||
export interface LimiterOptions extends ToneAudioNodeOptions {
|
||||
threshold: Decibels;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Limiter will limit the loudness of an incoming signal.
|
||||
|
|
|
@ -605,8 +605,8 @@ const EnvelopeCurves: EnvelopeCurveMap = (() => {
|
|||
In: cosineCurve,
|
||||
Out: reverseCurve(cosineCurve),
|
||||
},
|
||||
exponential: "exponential" as "exponential",
|
||||
linear: "linear" as "linear",
|
||||
exponential: "exponential" as const,
|
||||
linear: "linear" as const,
|
||||
ripple: {
|
||||
In: rippleCurve,
|
||||
Out: invertCurve(rippleCurve),
|
||||
|
|
|
@ -88,9 +88,9 @@ export class FeedbackCombFilter extends ToneAudioWorklet<FeedbackCombFilterOptio
|
|||
|
||||
onReady(node: AudioWorkletNode) {
|
||||
connectSeries(this.input, node, this.output);
|
||||
const delayTime = node.parameters.get("delayTime") as AudioParam;;
|
||||
const delayTime = node.parameters.get("delayTime") as AudioParam;
|
||||
this.delayTime.setParam(delayTime);
|
||||
const feedback = node.parameters.get("feedback") as AudioParam;;
|
||||
const feedback = node.parameters.get("feedback") as AudioParam;
|
||||
this.resonance.setParam(feedback);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ export class TickSource<TypeName extends "bpm" | "hertz"> extends ToneWithContex
|
|||
static getDefaults(): TickSourceOptions {
|
||||
return Object.assign({
|
||||
frequency: 1,
|
||||
units: "hertz" as "hertz",
|
||||
units: "hertz" as const,
|
||||
}, ToneWithContext.getDefaults());
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ export class AutoFilter extends LFOEffect<AutoFilterOptions> {
|
|||
baseFrequency: 200,
|
||||
octaves: 2.6,
|
||||
filter: {
|
||||
type: "lowpass" as "lowpass",
|
||||
type: "lowpass" as const,
|
||||
rolloff: -12 as -12,
|
||||
Q: 1,
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ export class Chebyshev extends Effect<ChebyshevOptions> {
|
|||
static getDefaults(): ChebyshevOptions {
|
||||
return Object.assign(Effect.getDefaults(), {
|
||||
order: 1,
|
||||
oversample: "none" as "none"
|
||||
oversample: "none" as const
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ export class Chorus extends StereoFeedbackEffect<ChorusOptions> {
|
|||
frequency: 1.5,
|
||||
delayTime: 3.5,
|
||||
depth: 0.7,
|
||||
type: "sine" as "sine",
|
||||
type: "sine" as const,
|
||||
spread: 180,
|
||||
feedback: 0,
|
||||
wet: 0.5,
|
||||
|
|
|
@ -68,14 +68,14 @@ export abstract class MidSideEffect<Options extends MidSideEffectOptions> extend
|
|||
/**
|
||||
* Connect the mid chain of the effect
|
||||
*/
|
||||
protected connectEffectMid(...nodes: OutputNode[]): void{
|
||||
protected connectEffectMid(...nodes: OutputNode[]): void {
|
||||
this._midSend.chain(...nodes, this._midReturn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect the side chain of the effect
|
||||
*/
|
||||
protected connectEffectSide(...nodes: OutputNode[]): void{
|
||||
protected connectEffectSide(...nodes: OutputNode[]): void {
|
||||
this._sideSend.chain(...nodes, this._sideReturn);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ export class StereoEffect<Options extends StereoEffectOptions> extends ToneAudio
|
|||
/**
|
||||
* Connect the left part of the effect
|
||||
*/
|
||||
protected connectEffectLeft(...nodes: OutputNode[]): void{
|
||||
protected connectEffectLeft(...nodes: OutputNode[]): void {
|
||||
this._split.connect(nodes[0], 0, 0);
|
||||
connectSeries(...nodes);
|
||||
connect(nodes[nodes.length-1], this._merge, 0, 0);
|
||||
|
@ -77,7 +77,7 @@ export class StereoEffect<Options extends StereoEffectOptions> extends ToneAudio
|
|||
/**
|
||||
* Connect the right part of the effect
|
||||
*/
|
||||
protected connectEffectRight(...nodes: OutputNode[]): void{
|
||||
protected connectEffectRight(...nodes: OutputNode[]): void {
|
||||
this._split.connect(nodes[0], 1, 0);
|
||||
connectSeries(...nodes);
|
||||
connect(nodes[nodes.length-1], this._merge, 0, 1);
|
||||
|
|
|
@ -111,7 +111,7 @@ export class Tremolo extends StereoEffect<TremoloOptions> {
|
|||
static getDefaults(): TremoloOptions {
|
||||
return Object.assign(StereoEffect.getDefaults(), {
|
||||
frequency: 10,
|
||||
type: "sine" as "sine",
|
||||
type: "sine" as const,
|
||||
depth: 0.5,
|
||||
spread: 180,
|
||||
});
|
||||
|
|
|
@ -79,7 +79,7 @@ export class Vibrato extends Effect<VibratoOptions> {
|
|||
maxDelay: 0.005,
|
||||
frequency: 5,
|
||||
depth: 0.1,
|
||||
type: "sine" as "sine"
|
||||
type: "sine" as const
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ export class Pattern<ValueType> extends Loop<PatternOptions<ValueType>> {
|
|||
|
||||
static getDefaults(): PatternOptions<any> {
|
||||
return Object.assign(Loop.getDefaults(), {
|
||||
pattern: "up" as "up",
|
||||
pattern: "up" as const,
|
||||
values: [],
|
||||
callback: noOp,
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
import { expect } from "chai";
|
||||
import { BasicTests } from "test/helper/Basic";
|
||||
import { CompareToFile } from "test/helper/CompareToFile";
|
||||
|
|
|
@ -138,7 +138,7 @@ export class Sampler extends Instrument<SamplerOptions> {
|
|||
return Object.assign(Instrument.getDefaults(), {
|
||||
attack: 0,
|
||||
baseUrl: "",
|
||||
curve: "exponential" as "exponential",
|
||||
curve: "exponential" as const,
|
||||
onload: noOp,
|
||||
onerror: noOp,
|
||||
release: 0.1,
|
||||
|
|
|
@ -106,7 +106,7 @@ export class PWMOscillator extends Source<PWMOscillatorOptions> implements ToneO
|
|||
frequency: 440,
|
||||
modulationFrequency: 0.4,
|
||||
phase: 0,
|
||||
type: "pwm" as "pwm",
|
||||
type: "pwm" as const,
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -128,7 +128,7 @@ export class PulseOscillator extends Source<PulseOscillatorOptions> implements T
|
|||
detune: 0,
|
||||
frequency: 440,
|
||||
phase: 0,
|
||||
type: "pulse" as "pulse",
|
||||
type: "pulse" as const,
|
||||
width: 0.2,
|
||||
});
|
||||
}
|
||||
|
|
1364
package-lock.json
generated
1364
package-lock.json
generated
File diff suppressed because it is too large
Load diff
12
package.json
12
package.json
|
@ -65,18 +65,18 @@
|
|||
"@types/chai": "^4.2.22",
|
||||
"@types/mocha": "^5.2.6",
|
||||
"@types/ua-parser-js": "^0.7.32",
|
||||
"@typescript-eslint/eslint-plugin": "^2.28.0",
|
||||
"@typescript-eslint/parser": "^2.28.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
||||
"@typescript-eslint/parser": "^5.0.0",
|
||||
"async": "^3.1.0",
|
||||
"chai": "^4.3.4",
|
||||
"codecov": "^3.1.0",
|
||||
"cross-var": "^1.1.0",
|
||||
"eslint": "^8.0.0",
|
||||
"eslint-plugin-html": "^6.0.2",
|
||||
"eslint-plugin-jsdoc": "^15.12.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-html": "^6.2.0",
|
||||
"eslint-plugin-jsdoc": "^36.1.1",
|
||||
"fs-extra": "^8.1.0",
|
||||
"glob": "^7.1.5",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"html-webpack-plugin": "^5.3.2",
|
||||
"http-server": "^13.0.2",
|
||||
"istanbul-instrumenter-loader": "^3.0.1",
|
||||
"jsdom": "^16.3.0",
|
||||
|
|
Loading…
Reference in a new issue