@blueprintjs/tslint-config

中文文档
4.1.9发布于 2026/01/07Apache-2.0近 30 天下载 2110

TSLint configuration for @blueprintjs packages

原始使用文档
文档目录9 节
  1. Note: This package is deprecated in favour of @blueprintjs/…
  2. Installation
  3. Usage
  4. Rules-only usage
  5. Editor integration
  6. Rules
  7. blueprint-classes-constants
  8. blueprint-icon-components
  9. Full Documentation | Source Code

Note: This package is deprecated in favour of @blueprintjs/eslint-plugin

TSLint is deprecated, and as such Blueprint is transitioning to ESLint. Blueprint is now using ESLint in its own repository, and as such this package will be removed in a future major version.

Blueprint TSLint configuration

Blueprint is a React UI toolkit for the web.

This package contains configuration for TSLint (the TypeScript linter) and a handful of new rules specifically for use when developing against Blueprint libraries.

Key features:

Installation

pnpm add --save-dev @blueprintjs/tslint-config tslint

Usage

Simply extend this package in your tslint.json to use the default rules configuration. This configuration includes Blueprint-specific rules which enforce semantics particular to usage with @blueprintjs packages.

tslint.json

{
    "extends": "@blueprintjs/tslint-config"
}

Rules-only usage

To enable the Blueprint-specific rules only without the full TSLint config, extend the blueprint-rules config inside the package:

tslint.json

{
  "extends": [
+   "@blueprintjs/tslint-config/blueprint-rules"
  ]
}

Editor integration

⭐️ VS Code: Enable the tslint.autoFixOnSave option to fix all fixable failures every time you save.

Rules

blueprint-classes-constants

Enforce usage of Classes constants over namespaced string literals.

Each @blueprintjs package exports a Classes object that contains constants for every CSS class defined by the package. While the values of the constants may change between releases, the names of the constants will remain more stable.

{
    "rules": {
        "blueprint-classes-constants": true
    }
}
-const element = <div className="pt-navbar" />;
+const element = <div className={Classes.NAVBAR} />;

blueprint-icon-components

Enforce usage of JSX Icon components over IconName string literals (or vice-versa) in icon JSX props. Note that this rule only supports hardcoded values in the icon prop; it does not handle expressions or conditionals.

A fixer is available for this rule that will convert between string literals and named Icon components. Note that the implementation is naive and may require intervention, such as to import a component or fix an invalid name.

Named icon components (TickIcon, GraphIcon, etc) can be imported from the @blueprintjs/icons package.

This rule is disabled in the blueprint-rules config as it is most useful to ensure that the @blueprintjs/icons package can be tree-shaken (an opt-in process which requires using components and never IconName literals).

{
  "rules": {
    // default uses "component"
    "blueprint-icon-components": true,
    // expanded syntax
    "blueprint-icon-components": {
      "options": ["component" | "literal"] // choose one
    }
  }
}

"component"

-<Button icon="tick" />
+<Button icon={<TickIcon />} />

"literal"

-<Button icon={<GraphIcon />} />
+<Button icon="graph" />

Full Documentation | Source Code

版本与发布记录

@blueprintjs/tslint-config 共发布 39 个版本,首次发布于 2017/12/15;过去 12 个月发布了 1 个版本。

版本发布日期距今
4.1.9latest2026/01/0710 个月前
4.1.82025/11/071 年前
4.1.62025/01/151.8 年前
4.1.52024/11/271.9 年前
4.1.42024/02/262 年前
4.1.32024/01/312 年前

其他发布通道:next → 4.0.0-alpha.1。

关于 @blueprintjs/tslint-config 的常见问题

@blueprintjs/tslint-config 是什么?

TSLint configuration for @blueprintjs packages

如何安装 @blueprintjs/tslint-config?

在项目目录运行 npm install @blueprintjs/tslint-config,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:tslint(^6.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@blueprintjs/tslint-config 支持 TypeScript 吗?

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

@blueprintjs/tslint-config 可以商用吗?

@blueprintjs/tslint-config 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@blueprintjs/tslint-config 的下载量有多少?

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

@blueprintjs/tslint-config 还在维护吗?

最新版本 4.1.9 发布于 2026/01/07(10 个月前);至今共发布 39 个版本,其中过去 12 个月发布了 1 个;首次发布于 2017/12/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。