@corekraft/flow-linter

中文文档
1.3.0发布于 2025/09/09AGPL-3.0ES Module近 30 天下载 2021

flow-linter brings the same rigor of linting and static code analysis—familiar to developers working with JavaScript or Apex—to Salesforce Flows.

此软件包已被标记为弃用

Package deprecated due to licensing issues, please support the new product 'flow-lint' https://github.com/corekraft/flow-lint this version is of MIT license and completely restarted

原始使用文档
文档目录13 节
  1. Table of contents
  2. Installation
  3. Usage
  4. Options
  5. Examples
  6. Configuration
  7. Defining the severity per rule
  8. Specifying an exception
  9. Configuring an expression
  10. Loading Custom Rules (Re-architecture in-progress)
  11. Development Setup
  12. Preparing for Changes
  13. Debugging the Plugin

Find and fix problems on your salesforce flow on your sf cli

Quick start

echo y | sf plugins install @corekraft/flow-linter
sf flow lint

Table of contents

Installation

sf plugins install @corekraft/flow-linter

Usage

sf flow lint

Options

  -c, --config <path>                                               provide a path to the configuration file.

  -f, --failon                                                      provide a threshold level for returning status 1

  -p, --files <C:\..\flow1.flow, C:\..\flow2.flow>                  provide a space-separated list of flow paths to scan.

  -u, --targetusername <username>                                   retrieve the latest metadata from the target before the scan.

  -d, --directory <C:\..\force-app\main\default\flows>              provide a directory to scan.

  --json                                                            set output format as json.

  --loglevel=(trace|debug|info|warn|error|fatal)                    [default: warn] logging level.

Examples

You can test the scanner by simply opening an existing project that contains flows and running the scan without any configurations or parameters. This way all the default rules are autmatically included in the scan.

sfdx flow:scan
sfdx flow:scan --json
sfdx flow:scan --config path/to/.flow-scanner.json

Configuration

Create a .flow-scanner.json file in order to configure:

  • The ruleset to be executed.
  • The severity of violating any specific rule.
  • Custom expressions or rule implementations.
  • Any known exceptions that should be ignored during scanning.
{
    "rules": {
        ...
    },
    "exceptions": {
        ...
    }
}

Note: if you prefer YAML format, you can create a .flow-scanner.yml file using the same format.

Defining the severity per rule

When the severity is not provided it will be error by default. Other available values for severity are warning and note. Define the severity per rule as shown in the following example.

{
  "rules": {
    "FlowDescription": {
      "severity": "warning"
    },
    "UnusedVariable": {
      "severity": "error"
    }
  }
}

Specifying an exception

Specifying exceptions can be done by flow, rule and result(s), as shown in the following example.

{
  "exceptions": {
    "AssignTaskOwner": {
      "UnusedVariable": [
        "somecount"
      ]
    },
    "GetAccounts":{
      "UnusedVariable": [
        "incvar"
      ]
    }
  }
}

Configuring an expression

Some rules have additional attributes to configure, such as the expression, that will overwrite default values. These can be configured in the same way as severity as shown in the following example.

{
  "rules": {
    "APIVersion":
    {
        "severity": "error",
        "expression": "===58"
    },
    "FlowName":
    {
        "severity": "error",
        "expression": "[A-Za-z0-9]"
    }
  }
}

Loading Custom Rules (Re-architecture in-progress)

To load custom rules using Flow Linter Core you can utilize the path attribute within the rules section of your configurations. This attribute allows you to specify the path to your custom rule class, enabling seamless integration of organization-specific rule definitions into the scanner's ruleset.

{
    "rules": {
        "<RuleName>": {
            "path": "<yourtypescriptfilepath>"
        }
    }
}

Custom Rules can either leverage our Flow compiler or be completely customized typescript functions. For more details and examples on custom rules, refer to our Custom Rule Creation Guide

Development Setup

Preparing for Changes

  1. Clone Project: Clone the flow linter sfcli plugin project from the repository.
  2. Install Dependencies: Open the directory and run npm install or yarn install in the terminal to install the necessary dependencies.
  3. Optional: Make changes: For example, if you want to upgrade the core module using npm, you can use the command: npm update @corekraft/flow-linter-core
  4. Prepack: Execute npm run prepack to build the plugin locally and prepare for packaging.
  5. Link Plugin: Link the plugin to your Salesforce DX environment using sfdx plugins link ..

Debugging the Plugin

  1. Linking Core Module: You may need to clone and link the @corekraft/flow-linter-core locally to your project. This step is necessary if you're making changes to the core module and want those changes reflected in the plugin. You can link the core module by navigating to its directory and running:
npm link

Then, navigate to the sfdx plugin directory and run:

npm link @corekraft/flow-linter-core
  1. Run Plugin: In the terminal of your example flow project (or any other project intended for scanning), run the following command to start the plugin with debugging enabled:
NODE_OPTIONS=--inspect-brk /path/to/flow-linter-sfcli/bin/run flow:lint
  1. Attach Debugger: Open your local Salesforce DX project in Visual Studio Code, set desired breakpoints, and attach the debugger to the remote session.

For more detailed information, you can refer to the wiki of the Salesforce CLI repository.

版本与发布记录

@corekraft/flow-linter 共发布 8 个版本,首次发布于 2025/08/22;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.3.0latest2025/09/091.2 年前
1.2.1beta2025/09/091.2 年前
1.2.02025/09/071.2 年前
1.1.12025/09/071.2 年前
1.1.02025/09/071.2 年前
1.0.32025/09/071.2 年前

关于 @corekraft/flow-linter 的常见问题

@corekraft/flow-linter 是什么?

flow-linter brings the same rigor of linting and static code analysis—familiar to developers working with JavaScript or Apex—to Salesforce Flows.注意:该包已被作者标记为弃用——Package deprecated due to licensing issues, please support the new product 'flow-lint' https://github.com/corekraft/flow-lint this version is of MIT license and completely restarted

如何安装 @corekraft/flow-linter?

在项目目录运行 npm install @corekraft/flow-linter,或使用 pnpm add / yarn add / bun add。

@corekraft/flow-linter 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/corekraft__flow-linter 是否存在。

@corekraft/flow-linter 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@corekraft/flow-linter 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=14.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@corekraft/flow-linter 可以商用吗?

@corekraft/flow-linter 使用 AGPL-3.0 许可。最严格的 Copyleft:除分发外,通过网络向用户提供基于它的服务也需要开源对应源码。闭源 SaaS 使用前务必评估。以上为概括,不构成法律意见,请以许可原文为准。

@corekraft/flow-linter 的下载量有多少?

根据 npm 官方下载统计,@corekraft/flow-linter 在 2026/10/11 – 2026/11/09 这 30 天内被下载 2,021 次,日均约 67 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@corekraft/flow-linter 还在维护吗?

最新版本 1.3.0 发布于 2025/09/09(1.2 年前);至今共发布 8 个版本,其中过去 12 个月发布了 0 个;首次发布于 2025/08/22。作者已将其标记为弃用,新项目建议寻找替代方案。