-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy patheslint.config.mjs
More file actions
76 lines (69 loc) · 2.34 KB
/
eslint.config.mjs
File metadata and controls
76 lines (69 loc) · 2.34 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
/*
* Copyright (c) 2025, Salesforce, Inc.
* SPDX-License-Identifier: Apache-2
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
*/
/**
* Shared ESLint configuration for the b2c-cli monorepo.
* Packages import from this file to maintain consistency.
*/
import prettierPlugin from 'eslint-plugin-prettier/recommended';
/**
* The standard copyright header block used across all packages.
*/
export const copyrightHeader = [
'',
' * Copyright (c) 2025, Salesforce, Inc.',
' * SPDX-License-Identifier: Apache-2',
' * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0',
' ',
];
/**
* Shared rules used across all packages.
*/
export const sharedRules = {
// Allow underscore-prefixed unused variables (common convention for intentionally unused params)
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
// Disable new-cap - incompatible with openapi-fetch (uses GET, POST, etc. methods)
'new-cap': 'off',
// Allow snake_case in object properties - common when working with external APIs
camelcase: ['error', {properties: 'never'}],
};
/**
* Rules for packages using eslint-config-oclif.
* Disables perfectionist and stylistic rules that conflict with our style.
*/
export const oclifRules = {
// Disable perfectionist rules - we use prettier for formatting
'perfectionist/sort-imports': 'off',
'perfectionist/sort-objects': 'off',
'perfectionist/sort-object-types': 'off',
'perfectionist/sort-interfaces': 'off',
'perfectionist/sort-named-exports': 'off',
'perfectionist/sort-named-imports': 'off',
'perfectionist/sort-classes': 'warn',
// Disable stylistic rules that conflict with our style
'@stylistic/lines-between-class-members': 'off',
'@stylistic/padding-line-between-statements': 'off',
// Allow TODO comments
'no-warning-comments': 'off',
// Don't require destructuring
'prefer-destructuring': 'off',
};
/**
* Rules for test files using Chai assertions.
*/
export const chaiTestRules = {
// Allow Chai property-based assertions in test files (e.g., expect(x).to.be.true)
'@typescript-eslint/no-unused-expressions': 'off',
};
/**
* Re-export prettier plugin for convenience.
*/
export {prettierPlugin};