Files
pyrodactyl/eslint.config.js
2026-01-09 05:02:00 -08:00

73 lines
2.1 KiB
JavaScript

import { includeIgnoreFile } from '@eslint/compat';
import js from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import prettier from 'eslint-plugin-prettier';
import pluginReact from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import turbo from 'eslint-plugin-turbo';
import { defineConfig } from 'eslint/config';
import globals from 'globals';
import { fileURLToPath } from 'node:url';
import tsEslint from 'typescript-eslint';
const gitignorePath = fileURLToPath(new URL('.gitignore', import.meta.url));
export default defineConfig([
includeIgnoreFile(gitignorePath),
{
ignores: ['public/**'],
},
{
files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
plugins: { js },
extends: ['js/recommended'],
languageOptions: { globals: { ...globals.browser } },
},
...tsEslint.configs.recommended,
pluginReact.configs.flat.recommended,
eslintConfigPrettier,
{
plugins: {
'react-hooks': reactHooks,
turbo,
prettier,
},
settings: { react: { version: 'detect' } },
rules: {
// React
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
// React Hooks
...reactHooks.configs.recommended.rules,
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
// TypeScript
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
// Prettier
'prettier/prettier': 'error',
// Turbo
'turbo/no-undeclared-env-vars': 'error',
},
},
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: '/app',
},
},
},
]);