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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@zhaiun/eslint-plugin-miniprogram

v0.0.1

Published

微信小程序自定义eslint

Downloads

3

Readme

小程序 eslint

开发方式

  • 安装全局依赖(如已安装,可直接跳过)
npm install -g yo generator-eslint
  • 安装开发依赖
npm i
  • 生成 eslint rule
yarn create:rule

会出现创建规则命令行交互

? What is your name?  // 开发者名称
? Where will this rule be published? (Use arrow keys) // 这个规则将在哪里发布?
❯ ESLint Core    // 官方核心规则
  ESLint Plugin  // 选择ESLint插件,我们选择这个
? What is the rule ID?   // 规则的ID,推荐使用kebab-case命名规则,例如attribute-kebab-case
? Type a short description of this rule:  // 输入该规则的描述
? Type a short example of the code that will fail:  // 后续可在tests中进行测试用
   create docs/rules/attribute-kebab-case.md         // 文档
   create lib/rules/attribute-kebab-case.js          // 规则文件
   create tests/lib/rules/attribute-kebab-case.js    // 测试文件

使用方式

  • 安装依赖(需要安装 eslint)
yarn add @zhaiun/eslint-plugin-miniprogram --dev
  • 添加至项目中

    1. 在 vscode 配置中开启 eslint 校验语言列表(eslint.validate)

      "eslint.validate": [
        ......
        "wxml"
      ],
    2. 在 eslintrc 添加 > .eslintrc, .eslintrc.js, .eslintrc.json

       module.exports = {
         root: true,
         parser: 'babel-eslint',
      -  extends: [...],
      +  extends: [..., 'plugin:@zhaiun/miniprogram/all'],
         rules: {
        	...
        },
      +  // 为特定类型的文件指定处理器
      +  overrides: [
      +    {
      +      // 定义需要解析文件的扩展名
      +      files: ["*.wxml"],
      +      // 定义eslint的插件
      +      plugins: ["@zhaiun/miniprogram"],
      +      // 定义解析器
      +      parser: "@wxml/parser"
      +    }
      +  ]
       };
      

参考文档

手摸手教你定制 ESLint rule 以及了解 ESLint 的运行原理

微信wxml解析器

TODO

  • [ ] 事件命名不符合handle开头