Socket
Socket
Sign inDemoInstall

eslint-config-automatic

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-config-automatic

An ESLint Configuration Set.


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

eslint-config-automatic

npm version Build Status

这是个人的ESLint规则配置,包括多个常用集合,对于每一条规则,提供简要注释和规则说明网址,没有使用其他的extends

配置信息

rules目录下,有一些规则库,可以作为单独的配置信息,放入ESLint配置文件中的extends里面。

例如,如果想引用React Native的规则,则在extends中添加如下代码:

"extends": [
    "@smartshallot/rules/react-native",
]

其余依次类推,目前支持的配置如下所示:

  • base:包含现有的每一条规则,按照分类组织文件结构。具体规则列表请参照ESLint官方网站:规则文档
  • react
  • react-native:使用了插件eslint-plugin-react-native
  • typescript

如果只引用规则,那ESLint配置文件剩余的部分都需要自行完成,也可以使用install目录下相应的安装脚本来进行设置。

依旧以react-native为例,在.eslintrc.js中,设置如下:

const config = {
    // ...
    "extends": [
        // ...
        "@smartshallot/rules/react-native",
    ],
    // ...
}

require('@smartshallot/install/react-native')(config);

module.exports = config;

注意:install中的脚本,只设置一个配置插件的设置项,如果要引用多个配置信息,则需要依次对config进行设置,可参照module目录中的文件写法。

整体集成

除了上述的只引用规则信息之外,还可以使用已经集成好的脚本,来生成相应的ESLint配置文件。

以TypeScript语言的react-native项目为例,对应于module目录下的typescript-react-native.js文件,需要在.eslintrc.js中,设置如下:

const config = require('@smartshallot/module/typescript-react-native');
// 这里添加想修改的设置,也可以不添加
module.exports = config;

目前支持的集成设置类型如下:

  • javascript:只使用JavaScript开发的项目,没有React相关代码。
  • javascript-react:使用JavaScript开发的React项目。
  • javascript-react-native:使用JavaScript开发的React Native项目。
  • typescript:只使用TypeScript开发的项目,没有React相关代码。
  • typescript-react:使用TypeScript开发的React项目。
  • typescript-react-native:使用TypeScript开发的React Native项目。

Keywords

FAQs

Package last updated on 22 Feb 2019

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