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

@vill-v/eslint-config

v2.0.4

Published

vilv-v的eslint的预设

Downloads

79

Readme

Villv Eslint Config

NPM Version NPM Downloads NPM License

  • prettier 为基础的 eslint 配置
  • 可以在 vue typescript markdown 工作
  • 会自动 对 import 进行排序
  • 自动切换对 vue@2 vue@3 的支持

从 1.0 版本开始 将使用 ESLint Flat config 进行重构

安装

pnpm add eslint prettier -D

pnpm add @vill-v/eslint-config -D

使用

eslint.config.js

ESM

import villv from '@vill-v/eslint-config'

export default villv()

CJS

const villv = require('@vill-v/eslint-config')

module.exports = villv()

Pipeline

1.1.0 版本起,使用 eslint-flat-config-utils#composer 替换了 villv() 工厂函数返回的结果,是您可以像 @antfu/eslint-config 使用 pipeline 语法更灵活的组合 eslint 配置

// eslint.config.js
import villv from '@vill-v/eslint-config'

export default villv()
  .prepend(
    // 在预制的配置前插入某些配置
  )
  // 通过插件名覆盖部分插件配置
  .override(
    'antfu/imports',
    {
      rules: {
        'import/order': ['error', { 'newlines-between': 'always' }],
      }
    }
  )
  // 重命名插件在规则定义时的前缀
  .renamePlugins({
    'old-prefix': 'new-prefix',
    // ...
  })
  /// ...

工作环境

  • node >=16.0.0
  • eslint >=8.56.0
  • prettier >=3.0.0
  • typescript >=5.0
  • vue >=2.0||>=3.0

配置项

使用 ESLint Flat config 之后,可以更加灵活的配置eslint 选项

你可以像这样覆盖各个插件的规则与配置

import villv from '@vill-v/eslint-config'

export default villv({
  vue: {
    overides: {
      'vue/no-v-html': 'error',
    },
  },
  // 可以定制根据特定 ignore 文件快捷让 eslint 忽略一些文件
  gitignore: {
    files: ['.gitignore', '.eslintignore', '.dockerignore'],
  },
})

详细的配置项请查看Options

您也可以在 villv 的基础上加上更多额外的自定义ESLint Flat config规则与插件

import villv from '@vill-v/eslint-config'
import react from 'eslint-plugin-react'

export default villv(
  {
    //。。。villv 内置插件的配置
  },
  {
    rules: {
      'no-undef': 'off',
    },
  },
  {
    plugin: {
      react,
    },
  }
)

其他代码规范

eslint config - eslint flat 风格的配置集合

prettier config - prettier 的默认配置

tsconfig - typescript tsconfig.json 基础配置

License

MIT License