-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
135 lines (128 loc) · 3.34 KB
/
eslint.config.js
File metadata and controls
135 lines (128 loc) · 3.34 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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/***********************************************
* Copyright Involvex
* Copyright 2025
***********************************************/
import js from "@eslint/js";
import globals from "globals";
import prettierConfig from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
// import vitest from '@vitest/eslint-plugin';
import licenseHeader from 'eslint-plugin-license-header';
import docusaurus from '@docusaurus/eslint-plugin';
import path from 'node:path';
import url from 'node:url';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import tseslint from 'typescript-eslint';
// --- ESM way to get __dirname ---
const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const projectRoot = __dirname;
export default [
{
ignores: [
'node_modules/*',
'.integration-tests/**',
'eslint.config.js',
'packages/**/dist/**',
'bundle/**',
'package/bundle/**',
'dist/**',
'docs-backup/**',
'copyright.js',
'docs/build/**',
'docs/.docusaurus/**',
],
},
...tseslint.configs.recommended, // Spread recommended TypeScript config
{
files: ["**/*.{js,mjs,cjs}"],
plugins: {
import: importPlugin,
// vitest,
},
languageOptions: { globals: { ...globals.node } },
rules: {
...js.configs.recommended.rules,
// "semi": "error",
"no-undef": "error",
"no-unused-vars": ["warn", { "caughtErrors": "none" }],
// 'license-header/header': ['error', './copyright.js'],
},
},
{
files: ["**/*.{ts,tsx}"],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
// project: true, // Removed as there is no root tsconfig.json
// tsconfigRootDir: import.meta.dirname, // Removed for flexibility
},
globals: {
...globals.browser,
},
},
rules: {
// Any specific TypeScript ESLint rules here
"no-unused-vars": "off",
},
},
{
files: ["docs/**/*.{js,jsx,ts,tsx}"], // Target docs files, including TypeScript
plugins: {
react,
"react-hooks": reactHooks,
"@docusaurus": docusaurus, // Correctly register docusaurus plugin
},
settings: {
react: {
version: 'detect',
},
},
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser,
},
},
rules: {
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
...docusaurus.configs.recommended.rules, // Extend docusaurus recommended rules
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
},
},
{
files: ["template-library/**/*.{js,jsx}"],
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser,
},
},
rules: {
"no-undef": "off",
"no-unused-vars": ["warn", { "varsIgnorePattern": "^(Head|React|App|Link|Layout|HomepageFeatures|HomepageHeader|Heading|Feature|Svg)$" }],
},
},
{
files: [
"**/*.cjs",
"scripts/**/*.js",
"template-library/**/*.js",
],
rules: {
"@typescript-eslint/no-require-imports": "off",
},
},
prettierConfig,
];