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-blend-react

v0.0.10

Published

针对react项目的规范

Downloads

13

Readme

eslint-config-blend-react

blend-react 开发及其模板项目使用的 ESLint 配置规则。

如何使用

  1. 安装 eslinteslint-config-blend-react 为开发依赖包
// NPM
> npm i eslint eslint-config-blend-react --save-dev
// Yarn
> yarn add eslint eslint-config-blend-react --dev
  1. 添加或编辑 ESLint 配置文件 (.eslintrc.js),将 blend-react 添加至 extends 选项中
module.exports = {
    // ...
    root: true,
    extends: ['blend-react'],
    // ...
};

推荐使用的开发环境

使用下述方案,可强化开发体验:

  1. 在保存代码文件时,自动对部分语法和编写习惯进行修复
  2. git commit 之前,自动对部分语法和编写习惯进行修复

需要使用 VS Code (Visual Studio Code) ,以下是完整的配置方案:

  1. 下载安装 VS Code : https://code.visualstudio.com/download
  2. VS Code 中安装以下扩展:
  3. 安装 prettier prettier-eslint husky 以及 lint-staged 为开发依赖包
// NPM
> npm i prettier prettier-eslint husky lint-staged --save-dev
// Yarn
> yarn add prettier prettier-eslint husky lint-staged --dev
  1. 在项目根目录中创建名为 .vscode 的目录,并在该文件夹内创建名为 settings.json 的文件,其内容为:
{
    "editor.rulers": [80, 120],
    "editor.formatOnSave": true,
    "editor.tabSize": 4,
    "editor.insertSpaces": true,
    "editor.codeActionsOnSave": {
        "source.fixAll": true
    },
    "eslint.codeActionsOnSave.mode": "problems",
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        "typescript",
        "typescriptreact"
    ],
    "files.trimTrailingWhitespace": true,
    "files.insertFinalNewline": true,
    "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
    "javascript.implicitProjectConfig.experimentalDecorators": true,
    "javascript.validate.enable": false,
    "typescript.validate.enable": true,
    "[json]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[javascriptreact]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[typescript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[typescriptreact]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    }
}
  1. 在项目根目录中创建名为 .prettierrc.js 的文件,其内容为:

下载 prettier 配置

// NPM
> npm i blend-prettier-config --save-dev
// Yarn
> yarn add blend-prettier-config --dev
module.exports = {
    ...require('blend-prettier-config'),
};
  1. 修改 package.json,添加以下内容
    "husky": {
        "hooks": {
            "pre-commit": "lint-staged"
        }
    },
    "lint-staged": {
        "*.{js,jsx,cjs,mjs,ts,tsx}": [
            "eslint --fix",
            "prettier --write"
        ],
        "*.{json,md,css,less,sass,scss}": [
            "prettier --write"
        ]
    }
  1. 重启 VS Code