Skip to content

Upgrade eslint #1337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 0 additions & 68 deletions .eslintrc.cjs

This file was deleted.

16 changes: 8 additions & 8 deletions Tone/component/analysis/Meter.ts
Original file line number Diff line number Diff line change
@@ -63,15 +63,15 @@ export class Meter extends MeterBase<MeterOptions> {
this.input =
this.output =
this._analyser =
new Analyser({
context: this.context,
size: 256,
type: "waveform",
channels: options.channelCount,
});
new Analyser({
context: this.context,
size: 256,
type: "waveform",
channels: options.channelCount,
});

(this.smoothing = options.smoothing),
(this.normalRange = options.normalRange);
(this.smoothing = options.smoothing);
(this.normalRange = options.normalRange);
this._rms = new Array(options.channelCount);
this._rms.fill(0);
}
1 change: 0 additions & 1 deletion Tone/core/Tone.ts
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ import { log } from "./util/Debug.js";
// TONE
//-------------------------------------

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface BaseToneOptions {}

/**
1 change: 0 additions & 1 deletion Tone/core/type/Frequency.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable key-spacing */
import { getContext } from "../Global.js";
import { intervalToFrequencyRatio, mtof } from "./Conversions.js";
import { ftom, getA4, setA4 } from "./Conversions.js";
7 changes: 3 additions & 4 deletions Tone/source/oscillator/AMOscillator.ts
Original file line number Diff line number Diff line change
@@ -39,8 +39,7 @@ export { AMOscillatorOptions } from "./OscillatorInterface.js";
*/
export class AMOscillator
extends Source<AMOscillatorOptions>
implements ToneOscillatorInterface
{
implements ToneOscillatorInterface {
readonly name: string = "AMOscillator";

/**
@@ -112,8 +111,8 @@ export class AMOscillator
phase: options.phase,
type: options.type,
} as OscillatorOptions);
(this.frequency = this._carrier.frequency),
(this.detune = this._carrier.detune);
(this.frequency = this._carrier.frequency);
(this.detune = this._carrier.detune);

this._modulator = new Oscillator({
context: this.context,
1 change: 0 additions & 1 deletion Tone/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
export const version: string = "dev";
172 changes: 172 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
// @ts-check
import tseslint from "typescript-eslint";
import stylisticJs from "@stylistic/eslint-plugin-js";
import stylisticTs from "@stylistic/eslint-plugin-ts";
import jsdoc from "eslint-plugin-jsdoc";
import html from "eslint-plugin-html";

/** @type {import("typescript-eslint").ConfigWithExtends} */
const customConfig = {
files: ["**/*.js", "**/*.ts", "**/*.html", "eslint.config.mjs"],
plugins: {
"@stylistic/js": stylisticJs,
"@stylistic/ts": stylisticTs,
jsdoc,
html
},
rules: {
"@typescript-eslint/array-type": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"jsdoc/check-alignment": 1,
"jsdoc/check-indentation": [
"error",
{
excludeTags: [
"example",
"param"
]
}
],
"jsdoc/check-param-names": [
"error"
],
curly: [
"error",
"all"
],
"@stylistic/js/dot-location": [
"error",
"property"
],
"dot-notation": [
"error"
],
"@stylistic/js/eol-last": [
"error",
"always"
],
eqeqeq: [
"error"
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
// requires eslint flat compat
// "file-extension-in-import-ts/file-extension-in-import-ts": "error",
"@stylistic/js/linebreak-style": [
"error",
"unix"
],
"no-cond-assign": [
"error",
"always"
],
"no-console": [
"error",
{
allow: [
"warn"
]
}
],
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-object-type": [
"error",
{
allowInterfaces: "always"
}
],
"@typescript-eslint/no-explicit-any": "off",
"no-lonely-if": [
"error"
],
"@typescript-eslint/no-object-literal-type-assertion": "off",
"no-shadow": "error",
"no-throw-literal": [
"error"
],
"no-unmodified-loop-condition": [
"error"
],
"no-unneeded-ternary": [
"error"
],
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-use-before-define": "off",
"no-useless-call": [
"error"
],
"no-var": "error",
"prefer-arrow-callback": "error",
"prefer-rest-params": "off",
"@stylistic/ts/quote-props": [
"error",
"as-needed"
],
"@stylistic/ts/quotes": [
"error",
"double",
{
avoidEscape: true
}
],
"sort-imports": [
"error",
{
ignoreCase: true,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: [
"none",
"all",
"multiple",
"single"
]
}
],
"@stylistic/js/spaced-comment": [
"error",
"always",
{
line: {
exceptions: [
"-"
]
},
block: {
balanced: true
}
}
]
}
};

export default tseslint.config(
tseslint.configs.recommended,
customConfig,
{
files: ["**/*.test.ts", "./test/**/*.ts"],
rules: {
"@typescript-eslint/no-unused-expressions": "off",
}
},
{
files: ["**/*.cjs"],
rules: {
"no-console": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-unused-expressions": "off",
}
},
{
name: "globally-ignored-files",
ignores: [
"**/node_modules",
"build/**",
"coverage/**",
"**/dist/**",
"docs/**",
"examples/**/*.js",
]
},
);
Loading
Oops, something went wrong.