Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
73 changes: 73 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* 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',
};

/**
* 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',
// 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};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"license": "Apache-2.0",
"packageManager": "pnpm@10.17.1",
"devDependencies": {
"eslint-plugin-prettier": "^5.5.4",
"prettier": "^3.6.2",
"typedoc": "^0.28.14",
"typedoc-plugin-markdown": "^4.9.0",
"typedoc-vitepress-theme": "^1.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/b2c-cli/bin/dev.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S node --conditions development --import tsx
#!/usr/bin/env -S node --conditions development
/*
* Copyright (c) 2025, Salesforce, Inc.
* SPDX-License-Identifier: Apache-2
Expand Down
44 changes: 7 additions & 37 deletions packages/b2c-cli/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
*/
import {includeIgnoreFile} from '@eslint/compat';
import oclif from 'eslint-config-oclif';
import prettierPlugin from 'eslint-plugin-prettier/recommended';
import headerPlugin from '@tony.ganchev/eslint-plugin-header';
import headerPlugin from 'eslint-plugin-header';
import path from 'node:path';
import {fileURLToPath} from 'node:url';

import {copyrightHeader, sharedRules, oclifRules, prettierPlugin} from '../../eslint.config.mjs';

const gitignorePath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.gitignore');
headerPlugin.rules.header.meta.schema = false;

export default [
includeIgnoreFile(gitignorePath),
Expand All @@ -24,41 +26,9 @@ export default [
header: headerPlugin,
},
rules: {
'header/header': [
'error',
'block',
[
'',
' * 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',
' ',
],
],
// 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',
// 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',
// Disable new-cap - incompatible with openapi-fetch (uses GET, POST, etc. methods)
'new-cap': 'off',
// Allow underscore-prefixed unused variables
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'header/header': ['error', 'block', copyrightHeader],
...sharedRules,
...oclifRules,
},
},
];
2 changes: 1 addition & 1 deletion packages/b2c-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@oclif/prettier-config": "^0.2.1",
"@oclif/test": "^4",
"@salesforce/dev-config": "^4.3.2",
"@tony.ganchev/eslint-plugin-header": "^3.1.11",
"eslint-plugin-header": "^3.1.1",
"@types/chai": "^4",
"@types/mocha": "^10",
"@types/node": "^18",
Expand Down
1 change: 1 addition & 0 deletions packages/b2c-cli/src/commands/_test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default class Test extends BaseCommand<typeof Test> {

async run(): Promise<void> {
// Test this.log() which now uses pino
this.baseCommandTest();
this.log('Using this.log() - goes through pino');
this.warn('Using this.warn() - goes through pino');

Expand Down
19 changes: 19 additions & 0 deletions packages/b2c-dx-mcp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
*-debug.log
*-error.log
**/.DS_Store
/.idea
/dist
/build
/tmp
/node_modules
/coverage
test-results.json
oclif.manifest.json


yarn.lock
package-lock.json

dw.json

export/
16 changes: 1 addition & 15 deletions packages/b2c-dx-mcp/bin/dev.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
#!/usr/bin/env -S node --conditions development --import tsx
#!/usr/bin/env -S node --conditions development
/*
* 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
*/
/* global process */

/**
* Development entry point for MCP server using oclif.
*
* This uses oclif's development mode which:
* - Uses TypeScript source directly (via tsx loader in shebang)
* - Supports the 'development' condition for exports
* - Loads .env file if present for local configuration
* - Provides better error messages and stack traces
*
* Run directly: ./bin/dev.js mcp --toolsets all
* Or with node: node --conditions development --import tsx bin/dev.js mcp --toolsets all
*/

// Load .env file if present (Node.js native support)
try {
Expand Down
55 changes: 22 additions & 33 deletions packages/b2c-dx-mcp/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,42 +1,31 @@
/*
* Copyright 2025, Salesforce, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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
*/
import {includeIgnoreFile} from '@eslint/compat';
import oclif from 'eslint-config-oclif';
import headerPlugin from 'eslint-plugin-header';
import path from 'node:path';
import {fileURLToPath} from 'node:url';

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettierConfig from 'eslint-config-prettier';
import {copyrightHeader, sharedRules, oclifRules, prettierPlugin} from '../../eslint.config.mjs';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
prettierConfig,
{
ignores: ['dist/**', 'node_modules/**'],
},
const gitignorePath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.gitignore');
headerPlugin.rules.header.meta.schema = false;

export default [
includeIgnoreFile(gitignorePath),
...oclif,
prettierPlugin,
{
rules: {
'@typescript-eslint/no-unused-vars': ['error', {argsIgnorePattern: '^_'}],
'@typescript-eslint/no-explicit-any': 'warn',
plugins: {
header: headerPlugin,
},
},
// Allow chai assertion expressions in test files
{
files: ['test/**/*.ts'],
rules: {
'@typescript-eslint/no-unused-expressions': 'off',
'header/header': ['error', 'block', copyrightHeader],
...sharedRules,
...oclifRules,
},
},
);

];
4 changes: 3 additions & 1 deletion packages/b2c-dx-mcp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
}
},
"scripts": {
"build": "tsc",
"build": "shx rm -rf dist && tsc -p tsconfig.build.json",
"clean": "shx rm -rf dist",
"lint": "eslint",
"format": "prettier --write src",
Expand Down Expand Up @@ -90,6 +90,8 @@
"@types/node": "^22.16.5",
"chai": "^4",
"eslint": "^9",
"eslint-config-oclif": "^6",
"eslint-plugin-header": "^3.1.1",
"eslint-config-prettier": "^10",
"eslint-plugin-prettier": "^5.5.4",
"mocha": "^10",
Expand Down
Loading
Loading