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

@eqian/eslint-config-preset

v1.0.3

Published

配置个人喜好的`eslint`预设规则,避免重复劳动 采用[eslint9.x](https://eslint.nodejs.cn/docs/latest/use/getting-started)以上版本,使用扁平化配置规则,即对象数组方式 ## 安装 ```typescript // npm insatll npm install @eqian/eslint-config-preset --save-dev

Downloads

260

Readme

eslint-config

配置个人喜好的eslint预设规则,避免重复劳动 采用eslint9.x以上版本,使用扁平化配置规则,即对象数组方式

安装

// npm insatll
npm install @eqian/eslint-config-preset --save-dev

// pnpm insatll
pnpm install @eqian/eslint-config-preset -D

使用

import { eslintPresets } from '@eqian/eslint-config';
export default eslintPresets([
  {
      // 内置相关忽略文件,同样,也可以使用全局忽略文件,规则请查阅eslint文档
    ignores: ['eslint.config.mjs', '.yalc', 'yalc'],
    name: 'ignores',
  },
]);

预设ESlint规则

  • 预设相关JavaScript规则
  • 导入相关排序规则
  • 默认启用vue规则,如果非vue项目,可以传入第二个参数{vue:false}

自定义规则

支持添加自定义规则,详情查阅插件文档 如,使用单引号规则

import { eslintPresets } from '@eqian/eslint-config';
export default eslintPresets([
    {
        ignores: ['eslint.config.mjs', '.yalc', 'yalc'],
        name: 'test',
    },
    // 自定义规则
    {
        rules: {
            "prettier/prettier": [
                "warn",
                {
                    "singleQuote": true
                }
            ],
            "@stylistic/quotes": ["error", "single"],
        }
    }
]);

配合prettier使用

已经内置prettier预设,在根目录的package.json中添加如下即可

{
  "name": "xxx",
  "type": "module",
  "prettier": "@eqian/eslint-config-preset/prettier"
}

预设prettier规则

  • 单引号
  • 末尾使用分号
  • 函数单个参数省略括号
  • ...

自定义prettier规则

可根据prettier文档进行配置 如根目录下新建prettier.config.mjs

// prettier.config.mjs
import prettier from '@eqian/eslint-config-preset/prettier'
const config = {
    ...prettier,
    semi: false,// 不使用分号结尾
    singleQuote: false, // 使用双引号
};

export default config;

依赖项及版本号

| Package | Version | | --- |----------| | @stylistic/eslint-plugin | ^2.10.1 | | @types/eslint-config-prettier | ^6.11.3 | | @typescript-eslint/parser | ^8.14.0 | | eslint-config-flat-gitignore | ^0.3.0 | | eslint-config-prettier | ^9.1.0 | | eslint-import-resolver-typescript | ^3.6.3 | | eslint-plugin-import-x | ^4.4.2 | | eslint-plugin-perfectionist | ^3.9.1 | | eslint-plugin-prettier | ^5.2.1 | | eslint-plugin-unused-imports | ^4.1.4 | | eslint-plugin-vue | ^9.31.0 | | prettier | ^3.3.3 | | typescript-eslint | ^8.14.0 | | vue-eslint-parser | ^9.4.3 |