Skip to content

Commit 3f7cd4b

Browse files
committed
Fix eslint CI error for marked-terminal import
- Use standard ESM named import for marked-terminal - Disable import/namespace rule for that line (parser issue with CJS) - Set reportUnusedDisableDirectives to warn to handle environment differences where import/namespace may or may not fire
1 parent fe8cfb3 commit 3f7cd4b

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

packages/b2c-cli/eslint.config.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ export default [
2525
plugins: {
2626
header: headerPlugin,
2727
},
28+
linterOptions: {
29+
// Downgrade to warn - import/namespace behaves inconsistently across environments
30+
// when parsing CJS modules like marked-terminal
31+
reportUnusedDisableDirectives: 'warn',
32+
},
2833
rules: {
2934
'header/header': ['error', 'block', copyrightHeader],
3035
...sharedRules,

packages/b2c-cli/src/commands/docs/read.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@
44
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
55
*/
66
import {Args, Flags} from '@oclif/core';
7-
import {createRequire} from 'node:module';
87
import {marked} from 'marked';
8+
// eslint-disable-next-line import/namespace
9+
import {markedTerminal} from 'marked-terminal';
910
import {BaseCommand} from '@salesforce/b2c-tooling-sdk/cli';
1011
import {readDocByQuery, type DocEntry} from '@salesforce/b2c-tooling-sdk/operations/docs';
1112
import {t} from '../../i18n/index.js';
1213

13-
// Use createRequire to load CJS module that confuses eslint-plugin-import
14-
const require = createRequire(import.meta.url);
15-
const {markedTerminal} = require('marked-terminal');
16-
1714
interface ReadDocsResult {
1815
entry: DocEntry;
1916
content: string;

0 commit comments

Comments
 (0)