forked from forcedotcom/salesforcedx-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
722 lines (710 loc) · 25.3 KB
/
eslint.config.mjs
File metadata and controls
722 lines (710 loc) · 25.3 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
/**
* * Copyright (c) 2024, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
**/
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import stylistic from '@stylistic/eslint-plugin-ts';
import tsParser from '@typescript-eslint/parser';
import globals from 'globals';
import header from '@tony.ganchev/eslint-plugin-header';
import eslintPluginImport, { __esModule } from 'eslint-plugin-import';
import eslintPluginJsdoc from 'eslint-plugin-jsdoc';
import eslintPluginJestFormatting from 'eslint-plugin-jest-formatting';
import eslintPluginPreferArrow from 'eslint-plugin-prefer-arrow';
import eslintConfigPrettier from 'eslint-config-prettier/flat';
import eslintPluginJest from 'eslint-plugin-jest';
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
import eslintPluginBarrelFiles from 'eslint-plugin-barrel-files';
import functional from 'eslint-plugin-functional';
import eslintPluginWorkspaces from 'eslint-plugin-workspaces';
import effectPlugin from '@effect/eslint-plugin';
import eslintPluginEslintPlugin from 'eslint-plugin-eslint-plugin';
import jsonPlugin from '@eslint/json';
import localRulesPlugin from './packages/eslint-local-rules/out/index.js';
const localRules = localRulesPlugin.rules;
const localPlugin = { rules: localRules };
export default [
{
ignores: [
'**/out/**',
'**/dist/**',
'**/packages/**/coverage',
'**/test-workspaces/**',
'**/*.d.ts',
'**/jest.config.js',
'**/jest.integration.config.js',
'**/.wireit/**',
'packages/salesforcedx-visualforce-markup-language-server/src/**',
'packages/salesforcedx-aura-language-server/src/tern/**',
'packages/salesforcedx-vscode-lightning/tern/**',
'packages/salesforcedx-vscode-lightning/extension/tern/lib/**',
'test-assets/**',
'packages/salesforcedx-vscode-soql/test/ui-test/resources/.mocharc-debug.ts',
'packages/salesforcedx-vscode-soql/src/soql-builder-ui/**',
'packages/salesforcedx-vscode-soql/src/soql-data-view/**',
'packages/salesforcedx-vscode-soql/test/jest/soql-builder-ui/**',
'packages/salesforcedx-vscode-soql/src/soql-common/soql-parser.lib/**',
'packages/soql-common/src/soql-parser.lib/**',
'scripts/vsce-bundled-extension.ts',
'scripts/reportInstalls.ts',
'packages/salesforcedx-lwc-language-server/src/javascript/__tests__/fixtures/**',
'packages/salesforcedx-lightning-lsp-common/src/resources/**',
'packages/salesforcedx-lightning-lsp-common/src/html-language-service/**',
'**/.vscode-test-web/**',
'**/.vscode-test/**',
'**/playwright-report/**'
]
},
{
files: ['**/*.js', '**/*.mjs'],
languageOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
globals: {
...globals.node
}
},
plugins: {
import: eslintPluginImport
},
rules: {
'no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
ignoreRestSiblings: true
}
]
}
},
{
files: ['**/*.ts'],
languageOptions: {
parser: tsParser,
parserOptions: {
projectService: true,
sourceType: 'module',
ecmaVersion: 2020,
globals: {
...globals.browser
}
}
},
plugins: {
'@typescript-eslint': typescriptEslint,
header: header,
import: eslintPluginImport,
jsdoc: eslintPluginJsdoc,
'jest-formatting': eslintPluginJestFormatting,
'prefer-arrow': eslintPluginPreferArrow,
'@stylistic/eslint-plugin-ts': stylistic,
unicorn: eslintPluginUnicorn,
local: localPlugin,
'barrel-files': eslintPluginBarrelFiles,
functional: functional,
workspaces: eslintPluginWorkspaces,
effect: effectPlugin
},
rules: {
'local/command-must-be-in-package-json': [
'error',
{
ignorePatterns: [
// Internal commands not shown in command palette
'\\.internal\\.',
// Telemetry API exposed for other extensions
'\\.get\\.telemetry$',
// Called programmatically by pushOrDeployOnSave, not user-facing
'^sf\\.deploy\\.multiple\\.source\\.paths$',
// Delegate commands invoked by code lens, not command palette
'\\.delegate$',
// Debug adapter protocol commands
'^extension\\.replay-debugger\\.',
// Programmatic launch commands
'^sf\\.launch\\.',
// Internal toggle/config commands
'^sf\\.apex\\.toggle\\.',
'^sf\\.apex\\.debug\\.document$',
'^sf\\.config\\.set$'
]
}
],
'local/no-effect-fn-wrapper': 'error',
'local/require-effect-fn-span-name': 'error',
'local/no-duplicate-i18n-values': 'error',
'local/no-unused-i18n-messages': 'error',
'local/no-vscode-message-literals': 'error',
'local/no-vscode-progress-title-literals': 'error',
'workspaces/no-relative-imports': 'error',
'unicorn/consistent-date-clone': 'error',
'unicorn/consistent-empty-array-spread': 'error',
'unicorn/consistent-function-scoping': 'error',
'unicorn/explicit-length-check': 'error',
'unicorn/no-array-reverse': 'error',
'unicorn/no-array-sort': 'error',
'unicorn/no-immediate-mutation': 'error',
'unicorn/no-instanceof-builtins': 'error',
'unicorn/no-typeof-undefined': 'error',
'unicorn/no-static-only-class': 'error',
'unicorn/no-useless-collection-argument': 'error',
'unicorn/no-useless-error-capture-stack-trace': 'error',
'unicorn/no-useless-fallback-in-spread': 'error',
'unicorn/no-useless-length-check': 'error',
'unicorn/no-useless-promise-resolve-reject': 'error',
'unicorn/no-useless-spread': 'error',
'unicorn/numeric-separators-style': 'error',
'unicorn/prefer-at': 'error',
'unicorn/prefer-array-find': 'error',
'unicorn/prefer-class-fields': 'error',
'unicorn/prefer-date-now': 'error',
'unicorn/prefer-export-from': 'error',
'unicorn/prefer-includes': 'error',
'unicorn/prefer-modern-math-apis': 'error',
'unicorn/prefer-node-protocol': 'error',
'unicorn/prefer-object-from-entries': 'error',
'unicorn/prefer-optional-catch-binding': 'error',
'unicorn/prefer-set-has': 'error',
'unicorn/prefer-set-size': 'error',
'unicorn/prefer-single-call': 'error',
'unicorn/prefer-string-replace-all': 'error',
'unicorn/prefer-string-starts-ends-with': 'error',
'unicorn/prefer-ternary': ['error', 'only-single-line'],
'unicorn/filename-case': [
'error',
{
case: 'camelCase'
}
],
'header/header': [
'error',
'block',
[
'',
{
pattern: ' \\* Copyright \\(c\\) \\d{4}, salesforce\\.com, inc\\.',
template: ' * Copyright (c) 2025, salesforce.com, inc.'
},
' * All rights reserved.',
' * Licensed under the BSD 3-Clause license.',
' * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause',
' '
]
],
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
ignoreRestSiblings: true
}
],
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/class-literal-property-style': 'error',
'@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'never' }],
'@typescript-eslint/array-type': ['error', { default: 'array' }],
'@typescript-eslint/no-restricted-types': [
'warn',
{
types: {
Object: { message: 'Avoid using the `Object` type. Did you mean `object`?' },
Function: {
message: 'Avoid using the `Function` type. Prefer a specific function type, like `() => void`.'
},
Boolean: { message: 'Avoid using the `Boolean` type. Did you mean `boolean`?' },
Number: { message: 'Avoid using the `Number` type. Did you mean `number`?' },
String: { message: 'Avoid using the `String` type. Did you mean `string`?' },
Symbol: { message: 'Avoid using the `Symbol` type. Did you mean `symbol`?' }
}
}
],
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-misused-promises': 'warn',
'@typescript-eslint/no-misused-spread': 'error',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/require-await': 'warn',
'@typescript-eslint/prefer-for-of': 'warn',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/unbound-method': ['warn', { ignoreStatic: true }],
'prefer-arrow/prefer-arrow-functions': ['error', {}],
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': [
'error',
{ accessibility: 'explicit', overrides: { constructors: 'no-public' } }
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@stylistic/eslint-plugin-ts/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'semi',
requireLast: true
},
singleline: {
delimiter: 'semi',
requireLast: false
}
}
],
'@typescript-eslint/member-ordering': 'off',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'typeLike',
format: ['PascalCase']
},
{
selector: 'function',
format: ['camelCase']
},
{
selector: 'method',
format: ['camelCase'],
// Only enforce for class/interface methods, not object literal methods
modifiers: ['public', 'protected', 'private']
},
{
selector: 'variable',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
leadingUnderscore: 'allow'
},
{
selector: 'property',
format: null,
// Properties are very permissive due to external APIs, i18n keys, HTTP headers, etc.
// We'll rely on code review for property naming
leadingUnderscore: 'allow'
}
],
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-shadow': [
'error',
{
hoist: 'all'
}
],
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@stylistic/eslint-plugin-ts/quotes': [
'error',
'single',
{
avoidEscape: true
}
],
'@stylistic/eslint-plugin-ts/semi': ['error', 'always'],
'@typescript-eslint/triple-slash-reference': [
'error',
{
path: 'always',
types: 'prefer-import',
lib: 'always'
}
],
'@typescript-eslint/typedef': 'off',
'@typescript-eslint/no-redundant-type-constituents': 'warn',
'@typescript-eslint/unified-signatures': 'error',
'@typescript-eslint/restrict-template-expressions': [
'warn',
{
allowNumber: true,
allowBoolean: true,
allowAny: false,
allowNullish: true
}
],
'arrow-body-style': ['error', 'as-needed'],
'arrow-parens': ['error', 'as-needed'],
'comma-dangle': 'error',
complexity: 'off',
'constructor-super': 'error',
curly: ['error', 'multi-line'],
'dot-notation': 'off',
eqeqeq: ['error', 'smart'],
'guard-for-in': 'error',
'id-denylist': 'error',
'id-match': 'error',
'import/no-empty-named-blocks': 'error',
'import/newline-after-import': 'error',
'import/no-cycle': 'error',
'import/no-extraneous-dependencies': ['error', { devDependencies: ['**/test/**', '**/scripts/**'] }],
'import/order': [
'error',
{
alphabetize: {
caseInsensitive: true,
order: 'asc'
},
'newlines-between': 'ignore',
groups: [['builtin', 'external', 'internal', 'unknown', 'object', 'type'], 'parent', ['sibling', 'index']],
distinctGroup: false,
pathGroupsExcludedImportTypes: [],
pathGroups: [
{
pattern: './',
patternOptions: {
nocomment: true,
dot: true
},
group: 'sibling',
position: 'before'
},
{
pattern: '.',
patternOptions: {
nocomment: true,
dot: true
},
group: 'sibling',
position: 'before'
},
{
pattern: '..',
patternOptions: {
nocomment: true,
dot: true
},
group: 'parent',
position: 'before'
},
{
pattern: '../',
patternOptions: {
nocomment: true,
dot: true
},
group: 'parent',
position: 'before'
}
]
}
],
'import/no-self-import': 'error',
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['node:fs', 'fs-extra'],
message:
"Use VSCode's fs API instead of Node.js fs for web extension compatibility. See https://code.visualstudio.com/api/references/vscode-api#FileSystem for documentation."
}
]
}
],
'jsdoc/check-alignment': 'error',
'jsdoc/check-indentation': 'error',
'jsdoc/newline-after-description': 'off',
'max-classes-per-file': 'off',
'max-len': 'off',
'new-parens': 'error',
'no-bitwise': 'off',
'no-caller': 'error',
'no-cond-assign': 'error',
'no-console': 'off',
'no-debugger': 'error',
'no-duplicate-imports': 'error',
'no-empty': 'off',
'no-empty-function': 'off',
'no-eval': 'error',
'no-fallthrough': 'off',
'no-invalid-this': 'off',
'no-new-wrappers': 'error',
'no-param-reassign': 'error',
'no-restricted-syntax': [
'error',
{
selector: "MemberExpression[object.name='process'][property.name='hrtime']",
message: 'Do not use process.hrtime(). Use globalThis.performance.now() instead.'
}
],
'no-shadow': 'off',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-throw-literal': 'error',
'no-trailing-spaces': 'error',
'no-undef-init': 'error',
'no-underscore-dangle': 'off',
'no-unsafe-finally': 'error',
'no-unused-expressions': 'off',
'no-unused-labels': 'error',
'no-use-before-define': 'off',
'no-useless-catch': 'error',
'no-useless-computed-key': 'error',
'no-useless-constructor': 'off',
'no-useless-return': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'no-var': 'error',
'object-shorthand': 'error',
'one-var': ['error', 'never'],
'prefer-arrow/prefer-arrow-functions': ['warn', {}],
'prefer-const': 'error',
'prefer-object-spread': 'error',
'prefer-template': 'error',
'quote-props': ['error', 'as-needed'],
quotes: 'off',
radix: 'error',
semi: 'off',
'spaced-comment': [
'off',
'always',
{
markers: ['/']
}
],
'use-isnan': 'error',
'valid-typeof': 'off'
}
},
{
rules: {
'guard-for-in': 'warn',
'no-prototype-builtins': 'warn',
'no-useless-escape': 'warn'
}
},
{
files: [
'packages/salesforcedx**/test/jest/**/*',
'packages/salesforcedx**/test/unit/**/*',
'packages/salesforcedx**/src/**/__tests__/**/*',
'packages/salesforcedx**/src/**/*.spec.ts',
'packages/salesforcedx**/src/**/*.test.ts',
'packages/salesforcedx**/test/web/**/*',
'packages/salesforcedx**/test/playwright/**/*',
'packages/salesforcedx-vscode-automation-tests/**/*',
'packages/playwright-vscode-ext/**/*.ts'
],
ignores: ['**/locators.ts'],
plugins: {
'@typescript-eslint': typescriptEslint,
jest: eslintPluginJest,
local: localPlugin
},
rules: {
'unicorn/filename-case': 'off',
'unicorn/consistent-function-scoping': 'off',
'@typescript-eslint/consistent-type-assertions': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unused-expressions': ['warn', {}],
'@typescript-eslint/no-unused-vars': [
'error',
{
varsIgnorePattern: '.*Mock$|.*Stub$|.*Spy$',
args: 'none',
argsIgnorePattern: '.*',
ignoreRestSiblings: true
}
],
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/restrict-template-expressions': 'warn',
'@typescript-eslint/unbound-method': 'off',
'jest/unbound-method': 'error',
'@typescript-eslint/no-var-requires': 'off',
'no-useless-constructor': 'off',
'no-restricted-imports': 'off',
'no-param-reassign': 'off',
'local/no-duplicate-playwright-locators': 'error'
}
},
{
// these have extensive copy-paste from an old version of msft language server
// this rule requires strict null checks to be enabled and that code does not support it
// Also disable for packages that don't have strictNullChecks enabled
files: [
'packages/salesforcedx-visualforce-markup-language-server/**',
'packages/salesforcedx-visualforce-language-server/**',
'packages/salesforcedx-apex-replay-debugger/**',
'packages/salesforcedx-vscode-soql/**'
],
rules: {
'@typescript-eslint/prefer-nullish-coalescing': 'off'
}
},
{
// Override header rules
files: [
'packages/salesforcedx-visualforce-markup-language-server/**/*.ts',
'packages/salesforcedx-visualforce-language-server/**/*.ts'
],
rules: {
'header/header': 'off'
}
},
{
// Effect-specific rules for new Effect services-based packages
files: [
'packages/salesforcedx-vscode-services/**/*.ts',
'packages/salesforcedx-vscode-org-browser/**/*.ts',
'packages/salesforcedx-vscode-metadata/**/*.ts',
'packages/salesforcedx-vscode-apex-log/**/*.ts',
'packages/effect-ext-utils/**/*.ts'
],
rules: {
'effect/no-import-from-barrel-package': ['error', { packageNames: ['effect'] }],
'barrel-files/avoid-barrel-files': 'error',
'barrel-files/avoid-re-export-all': 'error',
'functional/no-throw-statements': 'error',
'functional/no-try-statements': 'error',
'functional/no-let': 'error',
'functional/no-loop-statements': 'error',
'functional/prefer-property-signatures': 'error',
// let Effect figure it out. This is especially helpful for Error typings
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'local/no-explicit-effect-return-type': 'error',
'local/no-effect-service-accessor-calls': 'error',
// Effect code should always handle promises properly
'@typescript-eslint/no-floating-promises': 'error',
'class-methods-use-this': 'error',
// Effect encourages immutability
'prefer-const': 'error',
'no-param-reassign': 'error',
// Allow Effect imports and prefer non-bundled @salesforce/core
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: ['**/test/**', '**/scripts/**'],
// Allow Effect and core Salesforce dependencies
optionalDependencies: false
}
],
// Effect code tends to use functional patterns
'prefer-arrow/prefer-arrow-functions': [
'error',
{
disallowPrototype: true,
singleReturnOnly: false,
classPropertiesAllowed: false
}
],
'@typescript-eslint/no-explicit-any': 'error',
// Effect uses generators extensively - allow yield*
'@typescript-eslint/require-await': 'off',
// Effect service patterns
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off'
}
},
{
// Allow top-level src/index.ts files as barrel files (public API exports)
files: ['packages/**/src/index.ts'],
rules: {
'barrel-files/avoid-barrel-files': 'off'
}
},
{
// Prevent direct imports from services extension (except in services package itself)
// Only applies to src directories, not test directories
files: ['packages/**/src/**/*.ts'],
ignores: ['packages/salesforcedx-vscode-services/**/*.ts'],
rules: {
'local/no-direct-services-imports': 'error'
}
},
{
// Relaxed rules for test files in services and org-browser packages
files: [
'packages/salesforcedx-vscode-services/test/**/*.ts',
'packages/salesforcedx-vscode-org-browser/test/**/*.ts',
'packages/salesforcedx-vscode-metadata/test/**/*.ts',
'packages/salesforcedx-vscode-apex-testing/test/**/*.ts',
'packages/salesforcedx-vscode-apex-log/test/**/*.ts',
'packages/salesforcedx-vscode-services/playwright*.ts',
'packages/salesforcedx-vscode-org-browser/playwright*.ts',
'packages/salesforcedx-vscode-metadata/playwright*.ts',
'packages/salesforcedx-vscode-apex-log/playwright*.ts',
'packages/salesforcedx-vscode-core/test/playwright/**/*.ts',
'packages/salesforcedx-vscode-core/playwright*.ts',
'packages/salesforcedx-vscode-soql/test/playwright/**/*.ts',
'packages/salesforcedx-vscode-soql/playwright*.ts'
],
rules: {
// Deactivate import-order for tests to allow for mock-before-import
'effect/no-import-from-barrel-package': ['off'],
'import/order': 'off',
'functional/no-throw-statements': 'off',
'functional/no-try-statements': 'off',
'functional/no-let': 'off',
'functional/no-loop-statements': 'off',
'functional/prefer-property-signatures': 'off',
'import/no-extraneous-dependencies': 'off'
}
},
// i18n TS plugin - node:fs; type assertions; triple-slash for tsserverlibrary
{
files: ['packages/salesforcedx-vscode-i18n/src/hover/**/*.ts'],
rules: {
'no-restricted-imports': 'off',
'@typescript-eslint/consistent-type-assertions': 'off',
'@typescript-eslint/triple-slash-reference': 'off',
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/prefer-optional-chain': 'off',
'prefer-arrow/prefer-arrow-functions': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off'
}
},
// ESLint plugin rules for eslint-local-rules package only
{
files: ['packages/eslint-local-rules/src/**/*.ts'],
plugins: {
'eslint-plugin': eslintPluginEslintPlugin
},
rules: {
...eslintPluginEslintPlugin.configs.recommended.rules,
// Allow node:fs in ESLint plugin (needed for reading i18n files at lint time)
'no-restricted-imports': 'off',
// Allow type assertions for parser compatibility
'@typescript-eslint/consistent-type-assertions': 'off'
}
},
// Ignore test files for eslint-local-rules
{
ignores: ['packages/eslint-local-rules/test/**']
},
// Register JSON plugin
{
plugins: {
json: jsonPlugin
}
},
// JSON linting for package.json files
{
files: ['packages/*/package.json'],
language: 'json/json',
plugins: {
json: jsonPlugin,
local: localPlugin
},
rules: {
...jsonPlugin.configs.recommended.rules,
'local/package-json-i18n-descriptions': 'error',
'local/package-json-extension-icon': 'error',
'local/package-json-icon-paths': 'error',
'local/package-json-command-refs': 'error',
'local/package-json-view-refs': 'error'
}
},
eslintConfigPrettier
];