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

eslint-plugin-weiyi

v1.7.3

Published

eslint plugin for weiyi admin-management projects

Downloads

17

Readme

eslint-plugin-weiyi

微易 eslint 插件

使用

通过 mrm 更新项目配置

⚠️ 注意,该方式会完全覆盖原项目中的 .eslintrc.js 文件内容。

# 全局安装 mrm
npm i -g mrm
# 应用配置到工程项目
cd <project-root-dir>
mrm lintformat-bxs

手动 npm 安装

  1. npm 5+ 安装插件及其 peerDependencies。
npx install-peerdeps --dev eslint-plugin-weiyi
  1. 如示例配置 .eslintrc.js,请根据使用场景选择 config。
module.exports = {
  root: true,
  extends: ['plugin:weiyi/vue-admin'],
}

config

plugin:weiyi/recommended:

plugin:weiyi/vue-recommended:

  • 继承 'eslint:recommended', 'plugin:vue/recommended', '@vue/airbnb', 'prettier', 'prettier/vue'
  • 开启自定义规则和 override

plugin:weiyi/vue-admin:

  • plugin:weiyi/vue-recommended
  • 面向现代浏览器,babel-parser 使用 ecmaVersion:2019。适用于管理后台等桌面端项目。

rules

no-dead-protocol: 禁止在字符串中使用 'http://'。请使用 'https://' 或 '//'。
vue-no-dead-protocol: 同上,包括检查 vue template 中的使用。
no-third-party-res: 禁止引用第三方 CDN 资源。请使用 'assets.winbaoxian.com' 镜像(howto)。
vue-no-third-party-res: 同上,包括检查 vue template 中的使用。

override

rules: {
  // 生产环境不使用 console 和 debugger 调试语句
  'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
  'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
  // 允许使用 hoist,支持任意安排 function 定义顺序
  'no-use-before-define': 'off',
  // 允许使用自增、自减运算
  'no-plusplus': 'off',
  // parseInt 十进制数字时不指定 radix 参数
  radix: ['error', 'as-needed'],
  // 不使用结尾分号,自动处理特殊情形
  semi: ['error', 'never', { beforeStatementContinuationChars: 'always' }],
  // 不允许未使用的表达式,但允许逻辑运算符和三元运算符的短路逻辑控制
  'no-unused-expressions': [
    'error',
    {
      allowShortCircuit: true,
      allowTernary: true,
      allowTaggedTemplates: true,
    },
  ],
  // 不允许隐式数据类型转换,始终使用 Number(foo), String(bar) 等
  'no-implicit-coercion': 'error',
  // 不允许在类、对象上下文之外使用不知所指的 this
  'no-invalid-this': 'error',
},