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
7 changes: 0 additions & 7 deletions .eslintrc.json

This file was deleted.

6 changes: 6 additions & 0 deletions .github/workflows/_run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Lint code
run: npm run lint

- name: Type check
run: npm run type-check

- name: Run build
run: npm run build

Expand Down
198 changes: 198 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
import js from "@eslint/js";
import tseslint from "@typescript-eslint/eslint-plugin";
import tsparser from "@typescript-eslint/parser";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import importPlugin from "eslint-plugin-import";
import jsxA11y from "eslint-plugin-jsx-a11y";
import prettierConfig from "eslint-config-prettier";

export default [
// Global ignores
{
ignores: [
"dist/",
"build/",
"**/*.d.ts",
"node_modules/",
"coverage/",
".env*",
".vite/",
"**/*.log",
],
},

// Base configuration for all files
js.configs.recommended,

// TypeScript and React files
{
files: ["src/**/*.ts", "src/**/*.tsx"],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
project: "./tsconfig.json",
tsconfigRootDir: import.meta.dirname,
},
globals: {
console: "readonly",
process: "readonly",
Buffer: "readonly",
__dirname: "readonly",
__filename: "readonly",
module: "readonly",
require: "readonly",
exports: "readonly",
document: "readonly",
window: "readonly",
navigator: "readonly",
},
},
plugins: {
"@typescript-eslint": tseslint,
react: react,
"react-hooks": reactHooks,
import: importPlugin,
"jsx-a11y": jsxA11y,
},
settings: {
react: {
version: "18.0",
},
"import/resolver": {
typescript: {
alwaysTryTypes: true,
project: "./tsconfig.json",
},
},
},
rules: {
// TypeScript ESLint recommended rules
...tseslint.configs.recommended.rules,
...tseslint.configs["recommended-type-checked"].rules,

// React recommended rules
...react.configs.recommended.rules,
...react.configs["jsx-runtime"].rules,

// React Hooks rules
...reactHooks.configs.recommended.rules,

// Import plugin rules
...importPlugin.configs.recommended.rules,
...importPlugin.configs.typescript.rules,

// JSX A11y recommended rules
...jsxA11y.configs.recommended.rules,

// Custom rules
semi: ["error", "always"],
quotes: ["error", "double", { avoidEscape: true }],
"no-var": "error",
"prefer-const": "error",
"prefer-arrow-callback": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/explicit-function-return-type": [
"warn",
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
},
],
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-empty-function": "off",
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"react/display-name": "off",
"react/no-unescaped-entities": "warn",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"import/no-unresolved": "error",
"import/order": [
"error",
{
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
],
pathGroups: [
{
pattern: "@/**",
group: "internal",
position: "before",
},
{
pattern: "#/**",
group: "internal",
position: "before",
},
],
pathGroupsExcludedImportTypes: ["builtin"],
alphabetize: {
order: "asc",
caseInsensitive: false,
},
"newlines-between": "always",
},
],
"jsx-a11y/no-autofocus": "warn",
"no-console": ["warn", { allow: ["warn", "error"] }],
},
},

// Test files override
{
files: [
"src/**/*.spec.ts",
"src/**/*.spec.tsx",
"src/**/*.test.ts",
"src/**/*.test.tsx",
],
languageOptions: {
globals: {
jest: "readonly",
describe: "readonly",
it: "readonly",
expect: "readonly",
beforeEach: "readonly",
afterEach: "readonly",
beforeAll: "readonly",
afterAll: "readonly",
test: "readonly",
},
},
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off",
},
},

// Config files override
{
files: ["vite.config.ts", "jest.config.cjs", ".prettierrc.cjs"],
rules: {
"@typescript-eslint/no-var-requires": "off",
},
},

// Prettier config (must be last to override formatting rules)
prettierConfig,
];
Loading