mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-20 13:51:45 +00:00
8ec62c7518
client and server had lint scripts but no eslint config (only shared was linted in CI). Add flat configs mirroring shared's stack (js + typescript-eslint recommended + eslint-config-prettier) plus the client's react-hooks/react-refresh plugins. Pre-existing patterns in this never-linted code (explicit any, require() in the CommonJS server, empty catches, exhaustive-deps) are set to 'warn' rather than 'error' so the gate passes at 0 errors without a repo-wide reformat — these can be ratcheted to errors over time. Wire blocking typecheck + lint + lint:pages steps into the client and server CI jobs (now that both typechecks are clean) and promote the server typecheck from informational to blocking.
79 lines
2.4 KiB
JavaScript
79 lines
2.4 KiB
JavaScript
import js from '@eslint/js';
|
|
|
|
import gitignore from 'eslint-config-flat-gitignore';
|
|
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
import tseslint from 'typescript-eslint';
|
|
|
|
// Minimal stub so the existing `// eslint-disable-next-line react/no-danger`
|
|
// directive in src/i18n/TransHtml.tsx resolves without pulling in the full
|
|
// eslint-plugin-react (not a dependency here). The rule is a no-op.
|
|
const reactStub = {
|
|
rules: {
|
|
'no-danger': {
|
|
meta: { schema: [] },
|
|
create() {
|
|
return {};
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
export default tseslint.config(
|
|
gitignore({ strict: false }),
|
|
{
|
|
ignores: [
|
|
'node_modules',
|
|
'dist',
|
|
'coverage',
|
|
'public',
|
|
'test-results',
|
|
'playwright-report',
|
|
'e2e/**',
|
|
'scripts/**',
|
|
'**/*.config.js',
|
|
'**/*.config.ts',
|
|
'**/*.config.mjs',
|
|
],
|
|
},
|
|
js.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
eslintConfigPrettier,
|
|
{
|
|
files: ['src/**/*.{ts,tsx}', 'tests/**/*.{ts,tsx}'],
|
|
plugins: {
|
|
'react-hooks': reactHooks,
|
|
'react-refresh': reactRefresh,
|
|
react: reactStub,
|
|
},
|
|
rules: {
|
|
'react/no-danger': 'off',
|
|
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
|
|
|
// --- Severities tuned to keep CI green on a codebase that was never linted ---
|
|
// (each rule below has pre-existing violations; surfaced as warnings, not blockers)
|
|
|
|
// rules-of-hooks has one conditional-hook violation in PlaceInspector.tsx -> warn (not error).
|
|
'react-hooks/rules-of-hooks': 'warn',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'warn',
|
|
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
|
|
],
|
|
'@typescript-eslint/no-unused-expressions': 'warn',
|
|
'@typescript-eslint/no-unsafe-function-type': 'warn',
|
|
'@typescript-eslint/no-this-alias': 'warn',
|
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 'warn',
|
|
|
|
// js.recommended rules with pre-existing hits.
|
|
'no-empty': 'warn',
|
|
'no-useless-escape': 'warn',
|
|
'no-useless-assignment': 'warn',
|
|
'preserve-caught-error': 'warn',
|
|
},
|
|
},
|
|
);
|