-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
56 lines (48 loc) · 1.77 KB
/
eslint.config.js
File metadata and controls
56 lines (48 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import globals from 'globals';
import pluginJs from '@eslint/js';
import pluginReact from 'eslint-plugin-react';
import pluginTypeScript from '@typescript-eslint/eslint-plugin';
import parserTypeScript from '@typescript-eslint/parser';
import prettier from 'eslint-config-prettier';
import pluginPrettier from 'eslint-plugin-prettier';
/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
// Specify TypeScript files
{ files: ['**/*.{js,mjs,cjs,jsx,ts,tsx}'] },
// Global settings
{ languageOptions: { globals: globals.browser } },
// Base JavaScript configuration
pluginJs.configs.recommended,
// React configuration
pluginReact.configs.flat.recommended,
// TypeScript configuration
{
languageOptions: {
parser: parserTypeScript,
parserOptions: {
project: './tsconfig.json', // Point to your tsconfig.json
tsconfigRootDir: __dirname, // Ensure correct root directory
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: { jsx: true },
},
},
plugins: {
'@typescript-eslint': pluginTypeScript,
prettier: pluginPrettier,
},
rules: {
// TypeScript rules
'@typescript-eslint/explicit-module-boundary-types': 'off', // Customize this rule as needed
'@typescript-eslint/no-unused-vars': 'warn', // Example of a rule
'@typescript-eslint/no-explicit-any': 'off', // Optional, allows `any` type
// React rules
'react/react-in-jsx-scope': 'off', // With React 17+ no need for this anymore
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.tsx'] }],
// Prettier integration
'prettier/prettier': 'error', // Force Prettier formatting
},
},
// Disable conflicting rules from ESLint and Prettier
prettier,
];