瀏覽代碼

build: an ESLint config, so npm run lint actually runs

The lint script has been in package.json all along and CLAUDE.md documents
it, but no config file existed anywhere in webui/, so eslint exited
immediately telling you to run npm init @eslint/config. Every check the
project claimed to have was silently absent.

Config is .cjs because package.json sets type: module. Rules are set where
the existing code already stands: no-explicit-any off, unused-vars as a
warning with an underscore escape hatch, and tsc left to do the work it
does better. Clean run today is 0 errors and 7 pre-existing hook-dependency
warnings.
fszontagh 1 月之前
父節點
當前提交
af66f2dd5d
共有 1 個文件被更改,包括 39 次插入 和 0 次删除
  1. 39 0
      webui/.eslintrc.cjs

+ 39 - 0
webui/.eslintrc.cjs

@@ -0,0 +1,39 @@
+/* ESLint 8 flat-file predecessor config. This file is .cjs rather than .js
+   because package.json sets "type": "module", which would otherwise make
+   ESLint try to read this as an ES module. */
+module.exports = {
+    root: true,
+    env: {
+        browser: true,
+        es2020: true,
+        node: true,
+    },
+    extends: [
+        'eslint:recommended',
+        'plugin:@typescript-eslint/recommended',
+        'plugin:react-hooks/recommended',
+    ],
+    parser: '@typescript-eslint/parser',
+    parserOptions: {
+        ecmaVersion: 'latest',
+        sourceType: 'module',
+        ecmaFeatures: { jsx: true },
+    },
+    plugins: ['@typescript-eslint', 'react-hooks'],
+    ignorePatterns: ['dist', 'node_modules', '*.cjs'],
+    rules: {
+        // TypeScript already reports unused values through noUnusedLocals, and
+        // the base rule double-reports on type-only declarations.
+        'no-unused-vars': 'off',
+        '@typescript-eslint/no-unused-vars': [
+            'warn',
+            { argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
+        ],
+        // The codebase passes API payloads and ReactFlow node data around as
+        // any in a lot of places. Worth tightening later, not worth failing
+        // the build over today.
+        '@typescript-eslint/no-explicit-any': 'off',
+        // tsc enforces this far more accurately than the lint rule does.
+        '@typescript-eslint/no-empty-function': 'off',
+    },
+};