npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

eslint-config-waft

v1.0.1

Published

Espree最初是Esprima v1.2.2的一个分支,这是Esprima在ECMAScript 6开始工作之前最后一个稳定发布的版本。Espree现在构建在Acorn之上,Acorn有一个允许扩展核心功能的模块化架构。Espree的目标是用类似的API产生类似Esprima的输出,以便它可以用来代替Esprima。

Downloads

6

Readme

Espree

Espree最初是Esprima v1.2.2的一个分支,这是Esprima在ECMAScript 6开始工作之前最后一个稳定发布的版本。Espree现在构建在Acorn之上,Acorn有一个允许扩展核心功能的模块化架构。Espree的目标是用类似的API产生类似Esprima的输出,以便它可以用来代替Esprima。

Working with Custom Parsers

如果希望使用自己的解析器并为规则提供额外的功能,可以指定自己的自定义解析器。如果解析器上公开了parseForESLint方法,则将使用该方法解析代码。否则,将使用解析方法。这两个方法都应该在源代码中使用第一个参数,并使用一个可选的配置对象作为第二个参数(在配置文件中通过 parserOptions 提供)。parseForESLint 方法应该返回一个包含必需属性AST 和可选属性 services、scopeManager 和 visitorKeys 的对象

  • ast应该包含ast。
  • services 可以包含任何依赖于解析器的服务(例如节点的类型检查器)。services 属性的值作为 context.parserServices 对规则可用。Default是一个空对象。
  • scopeManager可以是一个 scopeManager 对象。定制解析器可以为实验/增强语法使用定制的范围分析。Default 是 ScopeManager 对象,由 eslint-scope 创建。
    • 在ESLint v4.14.0中添加了对 scopeManage 的支持。支持 scopeManager 的 ESLint 版本将在 parserOptions 中提供一个 eslintScopeManager: true 属性,可以用于特性检测。
  • visitorKeys 可以是一个自定义 AST 遍历的对象。该对象的键值是 AST 节点的类型。每个值都是应该遍历的属性名的数组。默认是 eslint-visitor-keys 的 KEYS。
    • 在 ESLint v4.14.0 中添加了对 visitorKeys 的支持。支持 visitorKeys 的 ESLint 版本将在 parserOptions 中提供一个 eslintVisitorKeys: true 属性,可以用于特性检测。

The AST specification

自定义解析器应该创建的 AST 基于 ESTree。AST 需要一些关于源代码详细信息的附加属性。

All nodes:

  • Range (number[])是一个由两个数字组成的数组。这两个数字都是基于 0 的索引,即源代码字符数组中的位置。第一个是节点的起始位置,第二个是节点的结束位置。code.slice(node.range[0], node.range[1]) 必须是该节点的文本。这个范围不包括节点周围的 空格 / 圆括号。

  • loc (SourceLocation) 不能为空。loc 属性被 ESTree 定义为可空,但 ESLint 需要这个属性。另一方面,SourceLocation#source 属性可以是 undefined。ESLint 不使用 SourceLocation#source 属性。

所有节点的父属性必须是可重写的。在任何规则访问 AST 之前,ESLint 在遍历时将每个节点的父节点属性设置为它的父节点。

The Program node:

Program 节点必须具有标记和注释属性。这两个属性都是下面的 Token 接口的数组。

interface Token {
    type: string;
    loc: SourceLocation;
    range: [number, number]; // See "All nodes:" section for details of `range` property.
    value: string;
}
  • tokens (Token[]) 是影响程序行为的 token 数组。在 token 之间可以存在任意的空格,所以规则检查 Token#range 来检测 token 之间的空格。这必须按 Token#range[0]排序。
  • comments (Token[]) 是注释标记的数组。这必须按Token#range[0]排序。

所有标记和注释的范围索引不能与其他标记和注释的范围重叠。

The Literal node

Literal 节点必须具有 raw 属性。

  • Raw(string) 是这个字面值的源代码。这与code.slice(node.range[0], node.range[1])相同.