generated from StabilityNexus/Template-Repo
-
-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy patheslint.config.js
More file actions
57 lines (51 loc) · 1.58 KB
/
eslint.config.js
File metadata and controls
57 lines (51 loc) · 1.58 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
import js from "@eslint/js";
import globals from "globals";
/**
* ESLint Configuration
*
* Defines project-wide code quality and style standards.
* Supports Vanilla JS, React (JSX), and Preact environments.
*/
export default [
// Start with ESLint's recommended base rules
js.configs.recommended,
// Configuration for source files (JS and JSX)
{
files: ["src/**/*.{js,jsx}"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
parserOptions: {
ecmaFeatures: {
jsx: true, // Enable JSX support for React/Preact components
},
},
globals: {
...globals.browser, // Standard browser globals (window, document, etc.)
...globals.es2021, // Modern ES2021 features
module: "readonly", // Allow CommonJS usage
exports: "readonly",
},
},
rules: {
// Prevent accidental console logs in production code
"no-console": "error",
// Warn about unused variables, but ignore those prefixed with _ (common in catch blocks)
"no-unused-vars": ["warn", { caughtErrorsIgnorePattern: "^_" }],
// Enforce double quotes to maintain consistency across the codebase
quotes: ["error", "double", { avoidEscape: true }],
// Enforce semicolons for clear statement termination
semi: ["error", "always"],
},
},
// Configuration for project config files (running in Node.js)
{
files: ["eslint.config.js", "**/*.config.js"],
languageOptions: {
sourceType: "module",
globals: {
...globals.node,
},
},
},
];