@canva/app-eslint-plugin

中文文档
1.1.0发布于 2026/11/02SEE LICENSE IN LICENSE.mdTypeScriptES Module近 30 天下载 3.9万

ESLint rules and shareable config for building with Canva's Apps SDK

原始使用文档
文档目录9 节
  1. Table of contents
  2. Introduction
  3. Setup
  4. 1. Install
  5. 2. Configure
  6. Shareable Configuration
  7. Changelog
  8. Contributing
  9. License

@canva/app-eslint-plugin

ESLint plugin for working with Canva.

ESLint TypeScript

Table of contents

Introduction

The @canva/app-eslint-plugin package is an ESLint plugin that supplies configuration defaults and rules for working with Canva.

Setup

If you're using the Canva Apps SDK starter kit, or you've used the Canva CLI to create a Canva SDK app, the @canva/app-eslint-plugin package should already be installed and configured for you.

1. Install

You can migrate an existing Canva SDK app, or use the @canva/app-eslint-plugin package in an app not based on the starter kit or generated from the Canva CLI. First install the package as a development dependency:

npm install @canva/app-eslint-plugin --save-dev

2. Configure

You can use the ESLint plugin by importing the @canva/app-eslint-plugin package into your ESlint config, and applying the provided shareable config. To import the package to your ESlint flat config:

// eslint.config.js
import canva from "@canva/app-eslint-plugin";

export default [
  ...canva.configs.apps,
  // your existing eslint config
];

To opt in to stricter linting, use the strict configuration:

// eslint.config.mjs
import canva from "@canva/app-eslint-plugin";

export default [...canva.configs.apps_strict];

Strict linting adds import validation, React Hooks and accessibility rules, Testing Library rules, snake-case TypeScript filenames, and absolute imports between directories. It does not prescribe a test runner.

Shareable Configuration

This package provides the following configuration sets:

  • apps - For creating and maintaining high-quality Canva Apps SDK apps.
  • apps_strict - The apps configuration with additional strict lint rules.
  • apps_no_i18n - This is the same as the apps configuration but without the requirement to translate the app. Most apps should support internationalization, however due to constraints on the number of messages some apps may not be able to be translated at this time.
  • apps_i18n - This is just the parts of the apps config that aren't included in the apps_no_i18n configuration. Generally it's better to use the apps config directly.

These sets include the following configuration sets provided by other packages:

Additionally, the following rules are configured:

  • 💼 Configuration sets the rule is enabled in:
    • 📦 apps and apps_no_i18n
    • 🌐 apps and apps_i18n
PluginRule💼
@typescript-eslint/eslint-pluginno-non-null-assertion📦
@typescript-eslint/eslint-pluginno-empty-function📦
@typescript-eslint/eslint-pluginconsistent-type-imports📦
@typescript-eslint/eslint-pluginno-explicit-any📦
@typescript-eslint/eslint-pluginno-empty-interface📦
@typescript-eslint/eslint-pluginconsistent-type-definitions📦
@typescript-eslint/eslint-pluginexplicit-member-accessibility📦
@typescript-eslint/eslint-pluginnaming-convention📦
eslintno-invalid-this📦
@typescript-eslint/eslint-pluginno-invalid-this📦
@typescript-eslint/eslint-pluginno-unused-expressions📦
eslintno-unused-vars📦
@typescript-eslint/eslint-pluginno-unused-vars📦
@typescript-eslint/eslint-pluginno-require-imports📦
eslint-plugin-jestno-restricted-matchers📦
reactjsx-curly-brace-presence📦
reactjsx-tag-spacing📦
reactself-closing-comp📦
reactno-unescaped-entities📦
reactjsx-uses-react📦
reactreact-in-jsx-scope📦
eslintdefault-case📦
eslinteqeqeq📦
eslintno-caller📦
eslintno-console📦
eslintno-eval📦
eslintno-inner-declarations📦
eslintno-new-wrappers📦
eslintno-restricted-globals📦
eslintno-restricted-properties📦
eslintno-restricted-syntax📦
eslintno-restricted-imports📦
eslintno-return-await📦
eslintno-throw-literal📦
eslintno-undef-init📦
eslintno-var📦
eslintobject-shorthand📦
eslintprefer-const📦
eslintprefer-object-spread📦
eslintprefer-rest-params📦
eslintprefer-spread📦
eslintradix📦
eslint-plugin-unicornprefer-node-protocol📦
reactno-deprecated📦
reactforbid-elements📦
eslint-plugin-unicornfilename-case📦
@typescript-eslint/eslint-pluginno-require-imports📦
eslintno-console📦
eslint-plugin-formatjsno-invalid-icu🌐
eslint-plugin-formatjsno-literal-string-in-jsx🌐
eslint-plugin-formatjsenforce-description🌐
eslint-plugin-formatjsenforce-default-message🌐
eslint-plugin-formatjsenforce-placeholders🌐
eslint-plugin-formatjsno-id🌐
eslint-plugin-formatjsno-emoji🌐
eslint-plugin-formatjsno-useless-message🌐
eslint-plugin-formatjsno-multiple-plurals🌐
eslint-plugin-formatjsno-offset🌐
eslint-plugin-formatjsblocklist-elements🌐
eslint-plugin-formatjsno-complex-selectors🌐
eslint-plugin-formatjsno-literal-string-in-object🌐

Changelog

See the CHANGELOG.md file.

Contributing

We're actively developing this package but are not currently accepting third-party contributions. If you'd like to request any changes or additions to the package, submit a feature request via the Canva Developers Community.

License

See the LICENSE.md file.

版本与发布记录

@canva/app-eslint-plugin 共发布 14 个版本,首次发布于 2025/03/11;过去 12 个月发布了 7 个版本。

版本发布日期距今
1.1.0latest2026/11/027 天前
1.0.12026/09/231 个月前
1.0.02026/07/293 个月前
1.0.0-beta.11beta2026/07/223 个月前
1.0.0-beta.102026/07/203 个月前
1.0.0-beta.92026/07/143 个月前

关于 @canva/app-eslint-plugin 的常见问题

@canva/app-eslint-plugin 是什么?

ESLint rules and shareable config for building with Canva's Apps SDK

如何安装 @canva/app-eslint-plugin?

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

@canva/app-eslint-plugin 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@canva/app-eslint-plugin 支持 ESM 还是 CommonJS?

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

@canva/app-eslint-plugin 可以商用吗?

@canva/app-eslint-plugin 使用 SEE LICENSE IN LICENSE.md 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@canva/app-eslint-plugin 的下载量有多少?

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

@canva/app-eslint-plugin 还在维护吗?

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