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

@tuia/eslint-config-common

v2.0.0

Published

tuia eslint common config

Downloads

2

Readme

eslint-config-common

@tuia/eslint-config-common 是推啊前端团队为统一代码风格与编码规范,提炼出的 ESLint 推荐配置。

快速上手

请根据你的项目选用的技术栈选择以下配置:

接入指南

前置工作

ESLint 与 ESLint 配置相关内容统一交由 @tuia/eslint-config-common 管理,项目中无需单独安装配置。

在安装前请将 eslint、ESLint 解析器(babel-eslint / @babel/eslint-parser 等)、插件(eslint-plugin-*)、ESLint 配置(eslint-config-*)等 ESLint 相关依赖移除,避免版本冲突。

注意事项

  • 项目中的 bable 版本<7 1、将babel相关的包升级至版本 7 以上-@babel/xxx 原因:babel-eslint已经废弃,我们使用@babel/eslint-parser解析器来解析成 AST,而@babel/eslint-parser又依赖于@babel/core 2、修改babel配置
    • @babel/env 替换 babel's Stage presets
    • 对应babel插件的引入方式更新,babel-xx => @babel/xx
  • 如果项目使用tuia-milky构建,则需要升级版本至1.1.0,并升级 loader
  yarn add [email protected] eslint-webpack-plugin
    /* ... */
+   const ESLintPlugin = require('eslint-webpack-plugin')
    const config = {
      port: 3000,
      theme: {
        /* tuia-milky内用到的eslint-loader与ESLint公共配置中的ESLit版本冲突,因此需要theme={disableEslint: true,...} */
+       disableEslint: true,
        /* ... */
        }
      },
      /* ... */
      if (isDev) {
        config.webpackConfig.plugins = [
          new StyleLintPlugin({
            context: 'client',
            configFile: path.resolve(__dirname, './.stylelintrc.js'), 
            files: '**/*.less',
            failOnError: false,
            quiet: true,
            syntax: 'less'
          }),
          /* 如果需要在打包过程中执行ESLint校验,则添加如下插件,否则不需要添加 */
+        new ESLintPlugin({
+          context: '.eslintrc.js',
+          extensions: ['js', 'ts', 'jsx', 'tsx'],
+          formatter: require('eslint-friendly-formatter'),
+          lintDirtyModulesOnly: true,
+        })
      ]
    }

安装

npm i -D @tuia/eslint-config-common

基础规则

在项目中的 ESLint 配置文件(.eslintrc.js),添加以下内容:

module.exports = {
  extends: ['@tuia/eslint-config-common'],
  rules: {
    // 自定义你的规则
  },
}

React

在项目中的 ESLint 配置文件(.eslintrc.js),添加以下内容:

module.exports = {
  extends: ['@tuia/eslint-config-common', '@tuia/eslint-config-common/react'],
  rules: {
    // 自定义你的规则
  },
}

Vue

在项目中的 ESLint 配置文件(.eslintrc.js),添加以下内容:

module.exports = {
  extends: ['@tuia/eslint-config-common', '@tuia/eslint-config-common/vue'],
  rules: {
    // 自定义你的规则
  },
}

TypeScript

在项目中的 ESLint 配置文件(.eslintrc.js),添加以下内容:

module.exports = {
  extends: [
    '@tuia/eslint-config-common',
    '@tuia/eslint-config-common/typescript',
  ],
  rules: {
    // 自定义你的规则
  },
}

TypeScript React

在项目中的 ESLint 配置文件(.eslintrc.js),添加以下内容:

module.exports = {
  extends: [
    '@tuia/eslint-config-common',
    '@tuia/eslint-config-common/react',
    '@tuia/eslint-config-common/typescript',
  ],
  rules: {
    // 自定义你的规则
  },
}