generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.mjs
More file actions
56 lines (53 loc) · 2.14 KB
/
eslint.config.mjs
File metadata and controls
56 lines (53 loc) · 2.14 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
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import obsidianmd from 'eslint-plugin-obsidianmd';
import globals from 'globals';
export default tseslint.config(
{
ignores: ['node_modules/**', 'dist/**', 'build/**', 'main.js', '*.min.js']
},
js.configs.recommended,
...tseslint.configs.recommended,
...obsidianmd.configs.recommended,
{
files: ['src/**/*.ts'],
languageOptions: {
ecmaVersion: 2020,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node
},
parserOptions: {
project: './tsconfig.json'
}
},
plugins: {
obsidianmd: obsidianmd
},
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'warn',
'no-console': 'off',
'no-debugger': 'error',
'prefer-const': 'error',
'no-var': 'error',
// Upgrade obsidianmd rules from warn to error
'obsidianmd/prefer-file-manager-trash-file': 'error',
// Allow Node.js modules in Obsidian plugins (Electron environment)
'import/no-nodejs-modules': 'off',
// Type assertions
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
'@typescript-eslint/prefer-as-const': 'warn',
// Code style
eqeqeq: ['error', 'always'], // Require === and !== instead of == and !=
'prefer-template': 'warn', // Use template literals instead of string concatenation
'@typescript-eslint/array-type': ['warn', { default: 'array' }], // Prefer T[] over Array<T>
'prefer-object-spread': 'warn', // Use {...obj} instead of Object.assign()
curly: ['warn', 'multi-line'], // Require curly braces for multi-line blocks
'no-else-return': 'warn' // Remove unnecessary else after return
}
}
);