Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hjkcai/eslint-config-halo

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hjkcai/eslint-config-halo

The eslint config for halo team

  • 10.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

eslint-config-halo

本规则是我在 halo 团队发起的,多年前端编码的规则沉淀

设计原则

  1. 基于 tencent 规则扩展
  2. ESLint 是帮助编码的工具,不要成为负担
  3. 内置大量 TypeScript 最佳实践规则,按这个写准没错

开始使用

首先安装 ESLint 和规则:

npm install -D eslint @hjkcai/eslint-config-halo

在你的项目的根目录下创建一个 .eslintrc.js 文件,根据你的项目类型,复制下面的代码到该文件中。同时下面也提供了参考的 package.json scripts 配置,可以自行加入到已有的项目中去。

JavaScript

普通 JavaScript 项目
module.exports = {
  extends: '@hjkcai/eslint-config-halo/js'
};
{
  "scripts": {
    "lint": "eslint ."
  }
}
React + JavaScript 项目
module.exports = {
  extends: '@hjkcai/eslint-config-halo/js/react'
};
{
  "scripts": {
    "lint": "eslint . --ext .js,.jsx"
  }
}

TypeScript

普通 TypeScript 项目
module.exports = {
  extends: '@hjkcai/eslint-config-halo/ts'
};
{
  "scripts": {
    "lint": "eslint . --ext .js,.ts"
  }
}
React + TypeScript 项目
module.exports = {
  extends: '@hjkcai/eslint-config-halo/ts/react'
};
{
  "scripts": {
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
  }
}

TypeScript 严格模式

对于某些需要非常认真地对待的项目,不能马虎的那种,推荐使用 TypeScript 严格模式配置。

普通 TypeScript 项目
module.exports = {
  extends: '@hjkcai/eslint-config-halo/ts-strict'
};
{
  "scripts": {
    "lint": "eslint . --ext .js,.ts"
  }
}
React + TypeScript 项目
module.exports = {
  extends: '@hjkcai/eslint-config-halo/ts-strict/react'
};
{
  "scripts": {
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
  }
}

License

MIT

Keywords

FAQs

Package last updated on 19 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc