-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
112 lines (110 loc) · 2.82 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import { defineConfig, globalIgnores } from "eslint/config";
import eslint from "@eslint/js";
import tseslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import prettierPlugin from "eslint-plugin-prettier";
import prettierConfig from "eslint-config-prettier";
// Global ignores for the entire project
const ignores = globalIgnores([
"**/node_modules/",
"**/dist/",
"**/build/",
".git/",
"**/*.json",
"**/*.md",
".specstory/",
]);
export default defineConfig([
ignores,
// Base configuration for all JavaScript files
{
name: "dex-creator/js-base",
files: ["**/*.{js,cjs,mjs}"],
...eslint.configs.recommended,
rules: {
"no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
"prefer-const": "error",
semi: ["error", "always"],
"no-console": ["warn", { allow: ["error", "info"] }],
},
},
// TypeScript specific configuration
{
name: "dex-creator/ts-base",
files: ["**/*.{ts,tsx}"],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
// No project reference to avoid tsconfig.json issues
},
},
plugins: {
"@typescript-eslint": tseslint,
},
rules: {
// Using basic recommended rules without type checking
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_" },
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "warn",
},
},
// Special rule for JavaScript configuration files (like this one)
{
name: "dex-creator/js-config-files",
files: ["**/*.config.js"],
rules: {
"@typescript-eslint/no-var-requires": "off",
},
},
// React/JSX specific rules
{
name: "dex-creator/react",
files: ["**/*.{jsx,tsx}"],
rules: {
"react/prop-types": "off",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
},
},
// Prettier configuration for all files
{
name: "dex-creator/prettier",
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: {
prettier: prettierPlugin,
},
rules: {
...prettierConfig.rules,
"prettier/prettier": "error", // Use the .prettierrc.js file for configuration
},
},
// Frontend app specific rules
{
name: "dex-creator/frontend",
files: ["app/**/*.{js,jsx,ts,tsx}"],
languageOptions: {
globals: {
document: "readonly",
window: "readonly",
navigator: "readonly",
},
},
},
// Backend API specific rules
{
name: "dex-creator/backend",
files: ["api/**/*.{js,ts}"],
rules: {
// Note: This inherits the console rule from js-base
},
},
]);