-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
98 lines (87 loc) · 2.75 KB
/
Copy patheslint.config.js
File metadata and controls
98 lines (87 loc) · 2.75 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
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import vue from 'eslint-plugin-vue';
import vueParser from 'vue-eslint-parser';
import prettierConfig from 'eslint-config-prettier';
import globals from 'globals';
export default tseslint.config(
{
ignores: [
'**/dist/**',
'**/node_modules/**',
'**/.turbo/**',
'development/**',
'packages/common/src/config/config.json',
'scripts/**',
'packages/*/scripts/**',
],
},
js.configs.recommended,
...tseslint.configs.recommended,
...vue.configs['flat/recommended'],
// Type-aware linting (lets rules like no-floating-promises and no-misused-promises work).
// projectService auto-discovers the relevant tsconfig per file.
{
files: ['**/*.ts', '**/*.vue'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
{
files: ['**/*.vue'],
languageOptions: {
parser: vueParser,
parserOptions: {
parser: tseslint.parser,
sourceType: 'module',
ecmaVersion: 'latest',
extraFileExtensions: ['.vue'],
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
// Module + common code runs in the admin browser context.
{
files: ['packages/module/**/*.{ts,vue}', 'packages/common/**/*.ts'],
languageOptions: {
globals: { ...globals.browser },
},
},
// Hook code runs in the Directus Node process.
{
files: ['packages/sync-hook/**/*.ts'],
languageOptions: {
globals: { ...globals.node },
},
},
{
rules: {
'no-warning-comments': ['warn', { terms: ['WIP'] }],
'no-debugger': 'warn',
'no-useless-assignment': 'warn',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' }],
'vue/multi-word-component-names': 'off',
'vue/max-len': ['error', { code: 140 }],
'vue/no-template-target-blank': 'off',
},
},
// Type-aware Promise-safety rule. Catches the bug class that produced the
// missing-await in sync-hook/src/hook/index.ts. The baseline of intentional
// fire-and-forget patterns (Vue setup() top-level hydrations, analytics
// calls, etc.) has been triaged — each site is either awaited or prefixed
// with `void`. Set to 'error' so a new floating Promise blocks CI.
// no-misused-promises is intentionally off: it produces false positives
// against Directus' action() callback signature, which accepts async fns.
{
files: ['**/*.ts', '**/*.vue'],
rules: {
'@typescript-eslint/no-floating-promises': 'error',
},
},
prettierConfig,
);