67 lines
1.9 KiB
JavaScript
67 lines
1.9 KiB
JavaScript
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
|
|
//
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
import eslint from "@eslint/js";
|
|
import globals from "globals";
|
|
import tseslint from "typescript-eslint";
|
|
|
|
export default tseslint.config(
|
|
{
|
|
ignores: [
|
|
"../assets/web/generated/**",
|
|
],
|
|
},
|
|
{
|
|
files: ["**/*.mjs"],
|
|
...eslint.configs.recommended,
|
|
languageOptions: {
|
|
globals: globals.node,
|
|
},
|
|
},
|
|
...tseslint.configs.recommendedTypeChecked.map((config) => ({
|
|
...config,
|
|
files: ["src/**/*.ts", "tests/**/*.ts"],
|
|
})),
|
|
{
|
|
files: ["src/**/*.ts", "tests/**/*.ts"],
|
|
ignores: ["src/decode-history-worker.ts"],
|
|
languageOptions: {
|
|
globals: globals.browser,
|
|
parserOptions: {
|
|
projectService: true,
|
|
tsconfigRootDir: import.meta.dirname,
|
|
},
|
|
},
|
|
rules: {
|
|
"no-undef": "off",
|
|
"@typescript-eslint/no-explicit-any": "error",
|
|
"@typescript-eslint/no-unused-vars": ["error", {
|
|
argsIgnorePattern: "^_",
|
|
caughtErrors: "none",
|
|
varsIgnorePattern: "^_",
|
|
}],
|
|
// DOM event targets intentionally ignore listener return values. Async
|
|
// listeners handle their own failures; keep the rule for all other
|
|
// promise misuse sites.
|
|
"@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: false }],
|
|
"@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
|
|
},
|
|
},
|
|
{
|
|
files: ["src/decode-history-worker.ts"],
|
|
languageOptions: {
|
|
globals: globals.worker,
|
|
parserOptions: {
|
|
project: "./tsconfig.worker.json",
|
|
tsconfigRootDir: import.meta.dirname,
|
|
},
|
|
},
|
|
rules: {
|
|
"no-undef": "off",
|
|
"@typescript-eslint/no-explicit-any": "error",
|
|
"@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
|
|
},
|
|
},
|
|
);
|