-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy patheslint.config.js
More file actions
119 lines (109 loc) · 3.38 KB
/
eslint.config.js
File metadata and controls
119 lines (109 loc) · 3.38 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
import { fileURLToPath } from 'node:url'; // Added for .gitignore path
import { includeIgnoreFile } from '@eslint/compat'; // Added for .gitignore
import feedicFlatConfig from '@feedic/eslint-config';
import { commonTypeScriptRules } from '@feedic/eslint-config/typescript';
import eslintPluginVitest from '@vitest/eslint-plugin';
import { defineConfig } from 'eslint/config';
import eslintConfigBiome from 'eslint-config-biome';
import globals from 'globals';
import tseslint from 'typescript-eslint';
const gitignorePath = fileURLToPath(new URL('.gitignore', import.meta.url));
export default defineConfig(
includeIgnoreFile(gitignorePath), // Handle .gitignore patterns
// Global linter options
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
},
// Base configurations for all relevant files
...feedicFlatConfig,
{
rules: {
'jsdoc/tag-lines': [2, 'any', { startLines: 1 }],
'jsdoc/require-param-type': 0,
'jsdoc/require-returns-type': 0,
'jsdoc/no-types': 2,
'jsdoc/require-returns-check': 0,
'jsdoc/check-tag-names': [
2,
{
definedTags: ['private'],
},
],
},
},
// Global custom rules and language options
{
languageOptions: {
globals: globals.node,
parserOptions: {
projectService: {
allowDefaultProject: ['*.js'],
defaultProject: 'tsconfig.json',
},
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'n/file-extension-in-import': [2, 'always'],
'no-lonely-if': 2,
'no-proto': 2,
'no-else-return': [2, { allowElseIf: false }],
'no-unused-expressions': 2,
'no-useless-call': 2,
'no-constant-binary-expression': 2,
'no-void': 2,
'unicorn/no-array-callback-reference': 0,
'unicorn/no-array-reduce': 0,
'unicorn/no-for-loop': 0,
'unicorn/no-useless-undefined': 0,
'unicorn/prefer-array-find': 0,
'unicorn/prevent-abbreviations': 0,
},
},
// TypeScript specific configurations
{
// Custom overrides and settings for TypeScript files
files: ['**/*.{c,m,}ts', '**/*.tsx'], // Ensure this block specifically targets TS files
extends: [
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
],
languageOptions: {
parser: tseslint.parser,
},
rules: {
...commonTypeScriptRules,
// Enabling this in cheerio currently triggers broad churn across src + website.
'@typescript-eslint/no-unnecessary-condition': 0,
},
},
// Vitest specific configuration (for *.spec.ts files)
{
files: ['**/*.spec.ts'],
plugins: { vitest: eslintPluginVitest },
languageOptions: {
globals: globals.vitest, // Add Vitest globals
},
rules: {
// Assuming "recommended" is the flat config equivalent for "legacy-recommended"
...eslintPluginVitest.configs.recommended.rules,
'n/no-unpublished-import': 0, // Allow importing devDependencies
},
},
// Website specific configuration
{
files: ['website/**/*.{m,}ts{x,}'],
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: ['*.mjs'],
},
tsconfigRootDir: `${import.meta.dirname}/website`,
},
},
},
// Prettier - must be the last configuration to override styling rules
eslintConfigBiome,
);