惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
Engineering at Meta
Engineering at Meta
腾讯CDC
宝玉的分享
宝玉的分享
H
Help Net Security
I
InfoQ
博客园 - Franky
The GitHub Blog
The GitHub Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
博客园_首页
美团技术团队
Recent Announcements
Recent Announcements
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网
The Cloudflare Blog
博客园 - 司徒正美
Vercel News
Vercel News
MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
月光博客
月光博客

Deno

Deno 2.8 | Deno Claw Patrol: an open-source security firewall for agents | Deno Fresh 2.3: Zero JS by default, View Transitions, and Temporal support | Deno Deno 2.7: Temporal API, Windows ARM, and npm overrides | Deno Build a dinosaur runner game with Deno, pt. 6 | Deno Build a dinosaur runner game with Deno, pt. 5 | Deno Deno Deploy is Generally Available | Deno Introducing Deno Sandbox | Deno Build a dinosaur runner game with Deno, pt. 4 | Deno Build a dinosaur runner game with Deno, pt. 3 | Deno Build a dinosaur runner game with Deno, pt. 2 | Deno React / Next.js Denial-of-Service Vulnerability: Deno Deploy users protected | Deno Deno 2.6: dx is the new npx | Deno Build a dinosaur runner game with Deno, pt. 1 | Deno React Server Functions / Next.js Vulnerability: Deno Deploy users protected | Deno My highlights from the new Deno Deploy | Deno Deno's Other Open Source Projects | Deno How Deno protects against npm exploits | Deno Help Us Raise $200k to Free JavaScript from Oracle | Deno Deno 2.5: Permissions in the config file | Deno Fresh 2.0 Graduates to Beta, Adds Vite Support | Deno Deno 2.4: deno bundle is back | Deno JavaScript™ Trademark Update | Deno What's coming to JavaScript | Deno A brief history of JavaScript | Deno Reports of Deno's Demise Have Been Greatly Exaggerated | Deno An Update on Fresh | Deno How Plaid migrated 100 services to a new database platform 5x faster with Deno | Deno Deno 2.3: Improved deno compile, local npm packages, and more | Deno Add JSR packages with pnpm and Yarn | Deno
Publish a lint rule, get a prize | Deno
Andy Jiang · 2025-02-26 · via Deno

UPDATE 2025/3/5: The Lint Rules Contest is over!

We received a bunch of great submissions (and some cheeky playful ones that made us smile)! Your lint plugins ranged from solving personal needs, to porting rules from ESLint, and more. Some notable ones to call out:

Plus, many more!

Thank you all again and we’ll be shipping the stickers out shortly!


In Deno 2.2, we’ve added the ability to extend deno lint with a new plugin system. While deno lint currently has 123 built-in rules, the new plugin system means that anyone can create new lint rules. (For comparison, ESLint has 310 rules.)

To encourage more deno lint rules, we’re kicking off a contest to invite you to write and publish new lint rules to JSR until Tuesday, March 4th, 6pm PT. To reward you for your effort, every participant will receive a free, random assortment of Deno stickers!

Read on to learn more about how to participate:

  • Writing a new lint rule
  • Publishing your lint rule to JSR
  • Prizes and how to submit
  • Additional resources

Writing a new lint rule

To show you how to write a new lint rule, we’ll create a plugin that reports an error if you name a variable foo:

deno.json

{
  "lint": {
    "plugins": ["./my-plugin.ts"]
  }
}

my-plugin.ts

const plugin: Deno.lint.Plugin = {
  name: "my-lint-plugin",
  rules: {
    "my-lint-rule": {
      create(context) {
        return {
          VariableDeclarator(node) {
            if (node.id.type === "Identifier" && node.id.name === "foo") {
              context.report({
                node,
                message: "Use more descriptive name than `foo`",
              });
            }
          },
        };
      },
    },
  },
};
export default plugin;

main.js

const foo = "foo";
console.log(foo);
$ deno lint main.js
error[my-lint-plugin/my-lint-rule]: Use more descriptive name than`foo`
--> /dev/main.js:1:7
  |
1 | const foo = "foo";
  | ^^^^^^^^^^^

Found 1 problem Checked 1 file

In addition to a visitor based API, you can also use CSS-like selectors for targeting specific nodes. Let’s rewrite above rule, using the selector syntax.

my-plugin.ts

const plugin: Deno.lint.Plugin = {
  name: "my-lint-plugin",
  rules: {
    "my-lint-rule": {
      create(context) {
        return {
          'VariableDeclarator[id.name="foo"]'(node) {
            context.report({
              node,
              message: "Use more descriptive name than `foo`",
            });
          },
        };
      },
    },
  },
};
export default plugin;

To see this in action, check out this one minute video demo:

For more information, check out the deno lint plugin API in our Deno docs.

Not sure what lint rule to create?

For starters, there are many popular rules from ESlint that have yet to be implemented in Deno:

  • semi: Enforces consistent use of semicolons at the end of statements
  • quotes – Enforces the consistent use of quotes (single, double, or backticks) for strings
  • curly – Requires brace {} usage for all control blocks (if/else/for/etc.), even if optional
  • no-alert – Disallows use of alert, confirm, and prompt in code
  • no-use-before-define – Disallows using variables or functions before they are defined
  • consistent-return – Requires that functions either always return a value or never return a value
  • no-shadow – Disallows variable declarations from shadowing variables declared in outer scopes
  • no-unused-expressions – Flags expression statements that are unused (have no effect)
  • no-empty-function – Disallows empty function bodies
  • no-underscore-dangle – Disallows dangling underscores in identifiers (prefix or suffix)
  • no-implied-eval – Disallows code that invokes the effect of eval() implicitly

To see more examples of lint rules, here is the ESLint GitHub repo.

For ideas and inspiration for lint rules that might not exist yet, check out this GitHub issue (Warning: this issue may be a bit stale, so tread with caution).

And just a reminder, if you do end up borrowing code from ESLint, please remember to give credit and provide the license!

Publishing your lint rule to JSR

Lint plugins can be authored in TypeScript, and Deno provides full type declarations out-of-the-box under the Deno.lint namespace.

To publish your plugin to JSR, update your deno.json so the exports points to your plugin:

deno.json

{
  "lint": {
    "plugins": ["./my-plugin.ts"]
  },
  "name": "@lambtron/andys-lint-rule",
  "version": "0.3.0",
  "license": "MIT",
  "exports": "./my-plugin.ts"
}

Then, run deno publish (or npx jsr publish), and it’ll appear on JSR.

For a full, end-to-end example, check out Andy’s Lint Rule.

Consuming lint plugins from JSR (or npm) is simple. You can use the specifier directly in lint.plugins in your deno.json:

deno.json

{
  "lint": {
    "plugins": [
      "./my-plugin.ts",
      "jsr:@my-scope/lint-plugin",
      "npm:@my-scope/other-plugin"
    ]
  }
}

Prizes and how to submit

Anyone who submits a deno lint rule to JSR will win free assortment of Deno stickers!

Picture of assorted Deno stickers

In order to be eligible to receive your stickers, please fill out this form with key details of your lint rule and shipping information.

We will be accepting submissions until Tuesday, March 4th, 6pm PT.

Additional resources

If you want to participate but don’t have any ideas, come join our Discord, where we’ll discuss lint rule ideas, answer any questions, and get you setup writing your lint rules!

We look forward to seeing what lint rules you create!

Get technical support, share your project, or simply say hi on Twitter, Discord, BlueSky, and Mastodon.