-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.cjs
76 lines (75 loc) · 1.94 KB
/
.eslintrc.cjs
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
// .eslintrc.cjs
// ESLint configuration for consistent coding practices across file types
module.exports = {
env: {
browser: true, // Browser environment
es2021: true, // ES2021 features
node: true, // Node.js environment
},
extends: [
"eslint:recommended", // Base rules
"plugin:@typescript-eslint/recommended", // TypeScript rules
"plugin:astro/recommended", // Astro-specific rules
"plugin:prettier/recommended", // Prettier integration
],
overrides: [
{
env: { node: true }, // Node-specific
files: [".eslintrc.{js,cjs}"], // ESLint config files
parserOptions: { sourceType: "script" }, // CommonJS
},
{
files: ["*.astro"], // Astro files
parser: "astro-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
extraFileExtensions: [".astro"],
},
rules: {
"astro/no-unused-css-selector": "warn", // Warn for unused CSS
},
},
{
files: ["*.tsx"], // React TSX files
extends: ["plugin:react/recommended"],
settings: { react: { version: "detect" } }, // Auto-detect React
},
{
files: ["*.json", "*.yaml", "*.yml"], // JSON & YAML
parser: "yaml-eslint-parser",
rules: {
"prettier/prettier": [
"error",
{ tabWidth: 4 }, // Consistent indentation
],
},
},
{
files: ["*.md"], // Markdown files
plugins: ["markdown"],
extends: ["plugin:markdown/recommended"],
rules: {},
},
],
parserOptions: {
ecmaVersion: "latest", // Latest ECMAScript
parser: "@typescript-eslint/parser", // TypeScript support
sourceType: "module", // ES Modules
},
plugins: [
"@typescript-eslint", // TypeScript plugin
"prettier", // Prettier plugin
],
rules: {
"@typescript-eslint/explicit-module-boundary-types": "off", // No forced return types
"@typescript-eslint/no-explicit-any": "warn", // Warn on 'any'
"prettier/prettier": [
"error", // Prettier issues as errors
{
endOfLine: "auto",
tabWidth: 4,
useTabs: true,
},
],
},
};