Files
ermnvldmr.com/eslint.config.mjs
T
2025-05-12 20:27:28 +03:00

68 lines
1.5 KiB
JavaScript

// @ts-check
import eslint from '@eslint/js';
import eslintPluginAstro from 'eslint-plugin-astro';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import prettier from 'eslint-config-prettier/flat';
export default tseslint.config(
{
ignores: ['**/dist', '**/node_modules', '**/.astro', '**/.github', '**/.changeset'],
},
// JavaScript
eslint.configs.recommended,
// TypeScript
...tseslint.configs.recommended,
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
// Allow triple-slash references in `*.d.ts` files.
{
files: ['**/*.d.ts'],
rules: {
'@typescript-eslint/triple-slash-reference': 'off',
},
},
// Astro
...eslintPluginAstro.configs.recommended,
// Set globals for Node scripts.
{
files: ['scripts/**'],
languageOptions: {
globals: globals.node,
},
},
// React
{
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
...react.configs.flat.recommended,
languageOptions: {
...react.configs.flat.recommended.languageOptions,
globals: {
...globals.serviceworker,
...globals.browser,
},
},
},
{
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
plugins: { 'react-hooks': reactHooks },
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
},
},
// Prettier
prettier
);