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-config-myplugin

v1.2.2

Published

myplugin eslint shareable configs

Downloads

7

Readme

eslint-config-sunlands

介绍

用于约束 js、es6 以及 vue 的代码风格及规范

规则

  1. 2 个空格改为 4 个空格
  2. 结尾不需要加分号
  3. JSX 能够写在 .js 文件中
  4. no-static-element-interactions(warning)
  5. JSX 及 JSX prop 缩进 4 个空格
  6. 依赖类型安装错误,等级从 error 改为 warning
  7. 对于function显示声明但是并没有用到的参数,从error降级到warn,参考issue "no-unused-vars": ["error", {"args": "none"}],
  8. label 不再强制指定for属性,参考issue label-has-for
  9. 可以在数组中使用数组索引作为react component的id,参考issue Do not use Array index in keys
  10. 允许对函数参数修改或重新赋值,从error降低到warn级别,参考issue no-param-reassign
  11. 允许传参时对参数进行换行,从error降低到warn级别,参考issue function-paren-newline
  12. 允许单个文件里声明多个component,参考issue react/no-multi-comp
  13. 允许陈列无用的参数,参考issue no-unused-vars
  14. 忽略了若干组件自动传入的props,这些props不再需要声明propTypes做类型检查。参考issue 初次会议讨论的一些规则改动 props validation 添加更多忽略字段
  15. 去除Link元素对href属性的检查,参考issue jsx-a11y/anchor-is-valid
  16. 不强制给绑定了鼠标事件的元素添加键盘事件,参考issue jsx-a11y/click-events-have-key-events
  17. 鼠标事件不再强制绑定键盘事件了,参考issue jsx-a11y/mouse-events-have-key-events
  18. 不能互动的元素也可以绑定事件,参考issue 不能互动的元素不能绑定事件
  19. 一个文件只有一个输出值的时候不强制用default输出,参考issue import/prefer-default-export
  20. 单行最大长度调整到180字符。
  21. video等标签不强制添加字幕,参考issue jsx-a11y/media-has-caption
  22. case语句中允许声明变量,改为warn,参考issue no-case-declarations
  23. 允许带Script脚本的href属性,参考issue no-script-url
  24. 允许void语句,参考issue no-void
  25. 禁用规则 class-methods-use-this,参考issue禁用规则 class-methods-use-this
  26. 禁用规则 no-continue,参考issueno-continue
  27. 禁用规则 jsx-a11y/media-has-caption,参考issuejsx-a11y/media-has-caption
  28. 规则react/prop-types 增加字段route、match,参考issuereact/prop-types
  29. 禁用规则no-script-url,参考issueno-script-url
  30. 规则react/prop-types 增加字段form,参考issuereact/prop-types
  31. 规则no-multi-spaces,允许import的from前面有多个空格,参考issueno-multi-spaces

Usage

规范被封装为 eslint 的 shareable configuration,直接在 eslint 的配置中通过 extend 配置项引用即可

安装

npm i @sunl-fe/eslint-config-sunlands

or

yarn add @sunl-fe/eslint-config-sunlands

列出所有依赖的 peerDependencies

npm info "@sunl-fe/eslint-config-sunlands" peerDependencies

依次安装这些 peerDependencies

npm info "@sunl-fe/eslint-config-sunlands@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs yarn add "@sunl-fe/eslint-config-sunlands@latest"

引用

.eslintrc.js 为例,只需要进行一行配置

/* .eslintrc.js */
module.exports = {
    'extends': '@sunl-fe/eslint-config-sunlands',
};

附: sublime配置@sunl-fe/eslint-config-sunlands