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

@kcuf/eslint-config

v0.2.6

Published

Shareable eslint config.

Downloads

729

Readme

@kcuf/eslint-config

A shareable stylelint config For Eslint >=9.

可共享的 Eslint config

  • 🔞 非常严格,洁癖必备
  • 💯 内置依赖与插件,安装与配置简单
  • ☂️ 不多更不少写
  • 💊 可自动修正的都是 Error

依赖

除 Eslint 需要使用者自行安装外,已内置以下依赖及插件:

  • globals 默认浏览器环境
  • @eslint/js JS 配置,这里使用 recommended,有一些额外的配置
  • typescript-eslint 支持 TS
  • @stylistic/eslint-plugin Eslint Core 把格式相关的规则差不多都移到了这里,且包含 TS、JSX 相关的配置
  • eslint-plugin-import import/export 规范插件
    • eslint-import-resolver-typescript import 支持 TS
  • eslint-plugin-react 支持 React
    • eslint-plugin-react-hooks React Hooks 插件
    • eslint-plugin-jsx-a11y React JSX A11Y 插件

How to Use

Install

pnpm add -D eslint @kcuf/eslint-config

配置 TypeScript + React 项目

纯 JS 或没有 React 亦可,用如下配置。

配置 eslint.config.js 即可:

import kcufEslintConfig from '@kcuf/eslint-config';

/** @type {import('eslint').Linter.Config[]} */
export default kcufEslintConfig;

建议在 package.json 配置 scripts

{
  "scripts": {
    "lint": "eslint src/ --ext js,ts,tsx",
    "lint:packages": "eslint packages*/**/src/ --ext js,ts,tsx"
  }
}

配置 TypeScript + Vue 项目

TODO

关于 Alias

你可能会碰到报错 import/no-unresolved,因为应用使用了类似 @/~/:/ 等 Alias。

由于 Alias 跟应用有关,因此不在此包范围处理,可以使用相关插件,比如 eslint-import-resolver-custom-alias,如下操作:

pnpm add -D eslint-import-resolver-custom-alias

修改 eslint.config.js(不建议设置超过 1 个 Alias):

import kcufEslintConfig from '@kcuf/eslint-config';

/** @type {import('eslint').Linter.Config[]} */
export default [
  ...kcufEslintConfig,
  {
    settings: {
      'import/resolver': {
        'custom-alias': {
          alias: {
            '@': './src'
          },
          extensions: ['.js', '.jsx', '.ts', '.tsx']
        }
      }
    }
  }
];