-
-
Notifications
You must be signed in to change notification settings - Fork 140
/
Copy patheslint.config.js
37 lines (36 loc) · 1.1 KB
/
eslint.config.js
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
import typescriptParser from "@typescript-eslint/parser";
import typescriptPlugin from "@typescript-eslint/eslint-plugin";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
export default [
{
// Ignore patterns (replaces .eslintignore)
ignores: ["node_modules/**", "dist/**"],
},
{
// Apply these settings only to .ts and .tsx files
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2022, // ECMAScript 2022
sourceType: "module",
parser: typescriptParser, // Use the imported parser
},
plugins: {
"@typescript-eslint": typescriptPlugin,
react: reactPlugin,
"react-hooks": reactHooksPlugin,
},
rules: {
// TypeScript rules
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
// Indentation and code style rules
indent: ["error", "tab"],
"react/jsx-indent": ["error", "tab"],
"react/jsx-indent-props": ["error", "tab"],
"max-len": ["error", { code: 120 }],
// React hooks rules
"react-hooks/rules-of-hooks": "error",
},
},
];