Skip to content
Merged
Show file tree
Hide file tree
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
33 changes: 33 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Check

on:
push:
branches:
- main
pull_request:

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: Install dependencies
run: npm ci

- name: Check formatting
run: npm run format:check

- name: Lint
run: npm run lint

- name: Type check
run: npm run check
229 changes: 229 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
import js from "@eslint/js";
import ts from "typescript-eslint";
import svelte from "eslint-plugin-svelte";
import globals from "globals";

export default ts.config(
// Global ignores
{ ignores: ["build/", ".svelte-kit/", "node_modules/"] },

// Base JS recommended (sets Possible Problems rules to "error" already)
js.configs.recommended,

// TypeScript recommended
...ts.configs.recommended,

// Svelte recommended
...svelte.configs["flat/recommended"],

// Svelte + TypeScript parser config
{
files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"],
languageOptions: {
parserOptions: {
parser: ts.parser,
},
},
},

// Global language options
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},

// Override: all Possible Problems → "error", all Suggestions → "warn"
{
rules: {
// --- Possible Problems (set to "error") ---
"array-callback-return": "error",
"constructor-super": "error",
"for-direction": "error",
"getter-return": "error",
"no-async-promise-executor": "error",
"no-await-in-loop": "error",
"no-class-assign": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-const-assign": "error",
"no-constant-binary-expression": "error",
"no-constant-condition": "error",
"no-constructor-return": "error",
"no-control-regex": "error",
"no-debugger": "error",
"no-dupe-args": "error",
"no-dupe-class-members": "error",
"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": "off",
"no-empty-character-class": "error",
"no-empty-pattern": "error",
"no-ex-assign": "error",
"no-fallthrough": "error",
"no-func-assign": "error",
"no-import-assign": "error",
"no-inner-declarations": "error",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-new-native-nonconstructor": "error",
"no-obj-calls": "error",
"no-promise-executor-return": "error",
"no-prototype-builtins": "error",
"no-self-assign": "error",
"no-self-compare": "error",
"no-setter-return": "error",
"no-sparse-arrays": "error",
"no-template-curly-in-string": "error",
"no-this-before-super": "error",
"no-undef": "off",
"no-unexpected-multiline": "error",
"no-unmodified-loop-condition": "error",
"no-unreachable": "error",
"no-unreachable-loop": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unsafe-optional-chaining": "error",
"no-unused-private-class-members": "error",
"no-unused-vars": "off",
"no-use-before-define": "off",
"no-useless-assignment": "error",
"no-useless-backreference": "error",
"require-atomic-updates": "off",
"use-isnan": "error",
"valid-typeof": "error",

// --- Suggestions (set to "warn") ---
"accessor-pairs": "warn",
"arrow-body-style": "warn",
"block-scoped-var": "warn",
"class-methods-use-this": "warn",
"consistent-this": "warn",
curly: "warn",
"default-case": "warn",
"default-case-last": "warn",
"default-param-last": "warn",
"dot-notation": "warn",
eqeqeq: "warn",
"func-name-matching": "warn",
"grouped-accessor-pairs": "warn",
"guard-for-in": "warn",
"logical-assignment-operators": "warn",
"no-alert": "warn",
"no-array-constructor": "warn",
"no-caller": "warn",
"no-case-declarations": "warn",
"no-delete-var": "warn",
"no-div-regex": "warn",
"no-else-return": "warn",
"no-empty": "warn",
"no-empty-function": "warn",
"no-empty-static-block": "warn",
"no-eq-null": "warn",
"no-eval": "warn",
"no-extend-native": "warn",
"no-extra-bind": "warn",
"no-extra-boolean-cast": "warn",
"no-extra-label": "warn",
"no-global-assign": "warn",
"no-implicit-coercion": "warn",
"no-implicit-globals": "warn",
"no-implied-eval": "warn",
"no-iterator": "warn",
"no-label-var": "warn",
"no-labels": "warn",
"no-lone-blocks": "warn",
"no-lonely-if": "warn",
"no-loop-func": "warn",
"no-multi-assign": "warn",
"no-multi-str": "warn",
"no-new": "warn",
"no-new-func": "warn",
"no-new-wrappers": "warn",
"no-nonoctal-decimal-escape": "warn",
"no-object-constructor": "warn",
"no-octal": "warn",
"no-octal-escape": "warn",
"no-proto": "warn",
"no-redeclare": "warn",
"no-regex-spaces": "warn",
"no-restricted-exports": "warn",
"no-restricted-globals": "warn",
"no-restricted-imports": "warn",
"no-restricted-properties": "warn",
"no-return-assign": "warn",
"no-script-url": "warn",
"no-sequences": "warn",
"no-shadow": "warn",
"no-shadow-restricted-names": "warn",
"no-throw-literal": "warn",
"no-undef-init": "warn",
"no-unneeded-ternary": "warn",
"no-unused-expressions": "warn",
"no-unused-labels": "warn",
"no-useless-call": "warn",
"no-useless-catch": "warn",
"no-useless-computed-key": "warn",
"no-useless-concat": "warn",
"no-useless-constructor": "warn",
"no-useless-escape": "warn",
"no-useless-rename": "warn",
"no-useless-return": "warn",
"no-var": "warn",
"no-void": "warn",
"no-with": "warn",
"object-shorthand": "warn",
"operator-assignment": "warn",
"prefer-arrow-callback": "warn",
"prefer-const": "warn",
"prefer-exponentiation-operator": "warn",
"prefer-named-capture-group": "warn",
"prefer-numeric-literals": "warn",
"prefer-object-has-own": "warn",
"prefer-object-spread": "warn",
"prefer-promise-reject-errors": "warn",
"prefer-regex-literals": "warn",
"prefer-rest-params": "warn",
"prefer-spread": "warn",
"prefer-template": "warn",
radix: "warn",
"require-await": "warn",
"require-yield": "warn",
"sort-imports": ["warn", { ignoreDeclarationSort: true }],
strict: "warn",
"symbol-description": "warn",
"vars-on-top": "warn",
yoda: "warn",
},
},

// TypeScript-specific overrides
{
files: ["**/*.ts", "**/*.svelte"],
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
"@typescript-eslint/no-use-before-define": "error",
},
},

// Svelte-specific overrides
{
files: ["**/*.svelte"],
rules: {
// Svelte $effect() uses bare expressions for dependency tracking
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-expressions": "off",
// Svelte 5 $props() requires `let` for destructured props
"prefer-const": "off",
},
},
);
Loading
Loading