82 lines
2.6 KiB
JavaScript
82 lines
2.6 KiB
JavaScript
// eslint.config.js
|
|
import js from '@eslint/js';
|
|
import ts 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 jsxA11y from 'eslint-plugin-jsx-a11y';
|
|
import prettier from 'eslint-config-prettier';
|
|
import airbnb from 'eslint-config-airbnb';
|
|
import airbnbTypescript from 'eslint-config-airbnb-typescript';
|
|
import importPlugin from 'eslint-plugin-import'; // ✅ Import it correctly
|
|
import path from "path";
|
|
import { fileURLToPath } from "url";
|
|
import { FlatCompat } from "@eslint/eslintrc";
|
|
import pluginJest from 'eslint-plugin-jest';
|
|
|
|
// mimic CommonJS variables -- not needed if using CommonJS
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
const compat = new FlatCompat({
|
|
baseDirectory: __dirname
|
|
});
|
|
|
|
export default [
|
|
js.configs.recommended,
|
|
...compat.extends('prettier'),
|
|
...compat.extends('airbnb'),
|
|
// ...compat.extends('airbnbTypescript'),
|
|
{
|
|
files: ['app/**/*.ts', 'app/**/*.tsx', 'app/**/*.js', 'app/**/*.jsx'],
|
|
ignores: ['**/*.test.ts', '**/*.test.tsx', '**/*.test.js', '**/__tests__/**'],
|
|
languageOptions: {
|
|
parser: tsParser,
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': ts,
|
|
react,
|
|
'react-hooks': reactHooks,
|
|
'jsx-a11y': jsxA11y,
|
|
import: importPlugin, // ✅ Use the imported object here
|
|
jest: pluginJest,
|
|
tsParser: tsParser,
|
|
},
|
|
settings: {
|
|
'import/resolver': {
|
|
node: {
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx'], // ✅ Allow these extensions
|
|
},
|
|
typescript: {}, // ✅ Ensure TypeScript paths resolve properly
|
|
},
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
'react/react-in-jsx-scope': 'off',
|
|
'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
|
|
'import/extensions': ['error', 'never', { ts: 'never', tsx: 'never' }],
|
|
'jsx-a11y/anchor-is-valid': 'off',
|
|
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
'no-restricted-exports': 'off',
|
|
'import/extensions': [
|
|
'error',
|
|
'ignorePackages',
|
|
{
|
|
js: 'never',
|
|
jsx: 'never',
|
|
ts: 'never',
|
|
tsx: 'never',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ['**/*.test.ts', '**/*.test.tsx', '**/*.test.js', '**/__tests__/**'],
|
|
rules: {
|
|
// Disable all linting for test files
|
|
'no-undef': 'off',
|
|
'no-unused-vars': 'off',
|
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
},
|
|
},
|
|
];
|