open-index/open-npm huggingface dataset:
npm package: @stone-lemons/eslint-config
Description: stone-lemons eslint config
Author: Stijn Lammens
Latest version: 0.0.8

# Personal configs

Credit:  Forked from [ntnyq](https://github.com/ntnyq/configs)

# EsLint config

## Usage

### Install

```bash
$ npm i @stone-lemons/eslint-config -D
# OR
$ yarn add @stone-lemons/eslint-config -D
```

### Extend this config

in `.eslintrc.js`

```js
module.exports = {
    root: true,

    extends: ['@stone-lemons'],

    rules: {
        // Override rules
    },
}
```

in `package.json`

```json
{
    "eslintConfig": {
        "root": true,
        "extends": "@stone-lemons"
    }
}
```
npm package: @stone-lemons/eslint-config-prettier
Description: stone-lemons eslint config with prettier
Author: Stijn Lammens
Latest version: 0.0.8

# Personal configs

Credit:  Forked from [ntnyq](https://github.com/ntnyq/configs)

# EsLint config with Prettier

## Usage

### Install

```bash
$ npm i @stone-lemons/eslint-config-prettier -D
# OR
$ yarn add @stone-lemons/eslint-config-prettier -D
```

### Extend this config

in `.eslintrc.js`

```js
module.exports = {
    root: true,

    extends: ['@stone-lemons/prettier'],

    rules: {
        // Override rules
    },
}
```

in `package.json`

```json
{
    "eslintConfig": {
        "root": true,
        "extends": "@stone-lemons/prettier"
    }
}
```
npm package: @stone-lemons/eslint-config-prettier-react
Description: stone-lemons eslint config for React.js with prettier
Author: Stijn Lammens
Latest version: 0.0.8

# Personal configs

Credit:  Forked from [ntnyq](https://github.com/ntnyq/configs)

# EsLint config for React.js with Prettier

## Usage

### Install

```bash
$ npm i @stone-lemons/eslint-config-prettier-react -D
# OR
$ yarn add @stone-lemons/eslint-config-prettier-react -D
```

### Extend this config

in `.eslintrc.js`

```js
module.exports = {
    root: true,

    extends: ['@stone-lemons/prettier-react'],

    rules: {
        // Override rules
    },
}
```

in `package.json`

```json
{
    "eslintConfig": {
        "root": true,
        "extends": "@stone-lemons/prettier-react"
    }
}
```
npm package: @stone-lemons/eslint-config-prettier-typescript
Description: stone-lemons eslint config for TypeScript with prettier
Author: Stijn Lammens
Latest version: 0.0.8

# Personal configs

Credit:  Forked from [ntnyq](https://github.com/ntnyq/configs)

# EsLint config for TypeScript with Prettier

## Usage

### Install

```bash
$ npm i @stone-lemons/eslint-config-prettier-typescript -D
# OR
$ yarn add @stone-lemons/eslint-config-prettier-typescript -D

TODO: yarn add -D eslint typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin
```

### Extend this config

in `.eslintrc.js`

```js
module.exports = {
    root: true,

    extends: ['@stone-lemons/prettier-typescript'],

    rules: {
        // Override rules
    },
}
```

in `package.json`

```json
{
    "eslintConfig": {
        "root": true,
        "extends": "@stone-lemons/prettier-typescript"
    }
}
```
npm package: @stone-lemons/eslint-config-prettier-typescript-react
Description: stone-lemons eslint config for TypeScript and React.js with Prettier
Author: Stijn Lammens
Latest version: 0.0.8

# Personal configs

Credit:  Forked from [ntnyq](https://github.com/ntnyq/configs)

# EsLint config for React.js and TypeScript with Prettier

## Usage

### Install

```bash
$ npm i @stone-lemons/eslint-config-prettier-typescript-react -D
# OR
$ yarn add @stone-lemons/eslint-config-prettier-typescript-react -D
```

### Extend this config

in `.eslintrc.js`

```js
module.exports = {
    root: true,

    extends: ['@stone-lemons/prettier-typescript-react'],

    rules: {
        // Override rules
    },
}
```

in `package.json`

```json
{
    "eslintConfig": {
        "root": true,
        "extends": "@stone-lemons/prettier-typescript-react"
    }
}
```
npm package: @stone-lemons/eslint-config-prettier-vue
Description: stone-lemons eslint config for Vue.js with prettier
Author: Stijn Lammens
Latest version: 0.0.8

# Personal configs

Credit:  Forked from [ntnyq](https://github.com/ntnyq/configs)

# EsLint config for Vue.js with Prettier

## Usage

### Install

```bash
$ npm i @stone-lemons/eslint-config-prettier-vue -D
# OR
$ yarn add @stone-lemons/eslint-config-prettier-vue -D
```

### Extend this config

in `.eslintrc.js`

```js
module.exports = {
    root: true,

    extends: ['@stone-lemons/prettier-vue'],

    rules: {
        // Override rules
    },
}
```

in `package.json`

```json
{
    "eslintConfig": {
        "root": true,
        "extends": "@stone-lemons/prettier-vue"
    }
}
```
npm package: @stone-lemons/eslint-config-react
Description: stone-lemons eslint config for React.js
Author: Stijn Lammens
Latest version: 0.0.8

# Personal configs

Credit:  Forked from [ntnyq](https://github.com/ntnyq/configs)

# EsLint config for React.js

## Usage

### Install

```bash
$ npm i @stone-lemons/eslint-config-react -D
# OR
$ yarn add @stone-lemons/eslint-config-react -D
```

### Extend this config

in `.eslintrc.js`

```js
module.exports = {
    root: true,

    extends: ['@stone-lemons/react'],

    rules: {
        // Override rules
    },
}
```

in `package.json`

```json
{
    "eslintConfig": {
        "root": true,
        "extends": "@stone-lemons/react"
    }
}
```
npm package: @stone-lemons/eslint-config-typescript
Description: stone-lemons eslint config for TypeScript
Author: Stijn Lammens
Latest version: 0.0.8

# Personal configs

Credit:  Forked from [ntnyq](https://github.com/ntnyq/configs)

# EsLint config for TypeScript

## Usage

### Install

```bash
$ npm i @stone-lemons/eslint-config-typescript -D
# OR
$ yarn add @stone-lemons/eslint-config-typescript -D
```

### Extend this config

in `.eslintrc.js`

```js
module.exports = {
    root: true,

    extends: ['@stone-lemons/typescript'],

    rules: {
        // Override rules
    },
}
```

in `package.json`

```json
{
    "eslintConfig": {
        "root": true,
        "extends": "@stone-lemons/typescript"
    }
}
```
npm package: @stone-lemons/eslint-config-typescript-react
Description: stone-lemons eslint config for TypeScript and React.js
Author: Stijn Lammens
Latest version: 0.0.8

# Personal configs

Credit:  Forked from [ntnyq](https://github.com/ntnyq/configs)

# EsLint config for React.js and TypeScript

## Usage

### Install

```bash
$ npm i @stone-lemons/eslint-config-typescript-react -D
# OR
$ yarn add @stone-lemons/eslint-config-typescript-react -D
```

### Extend this config

in `.eslintrc.js`

```js
module.exports = {
    root: true,

    extends: ['@stone-lemons/typescript-react'],

    rules: {
        // Override rules
    },
}
```

in `package.json`

```json
{
    "eslintConfig": {
        "root": true,
        "extends": "@stone-lemons/typescript-react"
    }
}
```
npm package: @stone-lemons/eslint-config-typescript-vue
Description: stone-lemons eslint config for TypeScript and Vue.js
Author: Stijn Lammens
Latest version: 0.0.8

# Personal configs

Credit:  Forked from [ntnyq](https://github.com/ntnyq/configs)

# EsLint config for Vue.js and TypeScript

## Usage

### Install

```bash
$ npm i @stone-lemons/eslint-config-typescript-vue -D
# OR
$ yarn add @stone-lemons/eslint-config-typescript-vue -D
```

### Extend this config

in `.eslintrc.js`

```js
module.exports = {
    root: true,

    extends: ['@stone-lemons/typescript-vue'],

    rules: {
        // Override rules
    },
}
```

in `package.json`

```json
{
    "eslintConfig": {
        "root": true,
        "extends": "@stone-lemons/typescript-vue"
    }
}
```
npm package: @stone-lemons/eslint-config-vue
Description: stone-lemons eslint config for Vue.js
Author: Stijn Lammens
Latest version: 0.0.8

# Personal configs

Credit:  Forked from [ntnyq](https://github.com/ntnyq/configs)

# EsLint config for Vue.js

## Usage

### Install

```bash
$ npm i @stone-lemons/eslint-config-vue -D
# OR
$ yarn add @stone-lemons/eslint-config-vue -D
```

### Extend this config

in `.eslintrc.js`

```js
module.exports = {
    root: true,

    extends: ['@stone-lemons/vue'],

    rules: {
        // Override rules
    },
}
```

in `package.json`

```json
{
    "eslintConfig": {
        "root": true,
        "extends": "@stone-lemons/vue"
    }
}
```
npm package: @stone-lemons/prettier-config
Description: stone-lemons prettier config
Author: Stijn Lammens
Latest version: 0.0.8

# Personal configs

Credit:  Forked from [ntnyq](https://github.com/ntnyq/configs)

# Prettier config

## Usage

### Install

```bash
$ npm i @stone-lemons/prettier-config -D
# OR
$ yarn add @stone-lemons/prettier-config -D
```

### Extend this config

in `package.json`

```json
{
    "prettier": "@stone-lemons/prettier-config"
}
```
npm package: @stone-lemons/stylelint-config
Description: stone-lemons stylelint config
Author: Stijn Lammens
Latest version: 0.0.8

# Personal configs

Credit:  Forked from [ntnyq](https://github.com/ntnyq/configs)

# StyleLint config

## Usage

### Install

```bash
$ npm i @stone-lemons/stylelint-config -D
# OR
$ yarn add @stone-lemons/stylelint-config -D
```

### Extend this config

in `.stylelintrc.yml`

```yaml
extends:
  - @stone-lemons/stylelint-config
```

in `package.json`

```json
{
    "stylelint": {
        "extends": ["@stone-lemons/stylelint-config"]
    }
}
```
npm package: @stone-lemons/stylelint-config-scss
Description: stone-lemons stylelint config
Author: Stijn Lammens
Latest version: 0.0.8

# Personal configs

Credit:  Forked from [ntnyq](https://github.com/ntnyq/configs)

# StyleLint config for SCSS

## Usage

### Install

```bash
$ npm i @stone-lemons/stylelint-config-scss -D
# OR
$ yarn add @stone-lemons/stylelint-config-scss -D
```

### Extend this config

in `.stylelintrc.yml`

```yaml
extends:
  - @stone-lemons/stylelint-config-scss
```

in `package.json`

```json
{
    "stylelint": {
        "extends": ["@stone-lemons/stylelint-config-scss"]
    }
}
```
npm package: @stone-lyl/google-translate-script
Description: ## 介绍
Author: stone-lyl
Latest version: 0.2.0

# google-translate-script

## 介绍

使用 google-translate-api 将整篇 A 语言 Markdown 文件翻译成 B 语言的 Markdown。 A、B 语言为 google-translate-api 支持的翻译语言。
This script will help you translate your entire project using the Google Translate API ！

## 安装

```shell
$ npm install @stone-lyl/google-translate-script -D
$ yarn add @stone-lyl/google-translate-script -D
```

## 使用

> 本脚本前提，需在本地配置好 google-translate-api
> 的使用环境，具体可参考 [google-translate-api](https://cloud.google.com/docs/authentication/application-default-credentials)

```js
import translateDoc from "@stone-lyl/google-translate-script";
import { fileURLToPath } from "url";
import { toHtml } from 'hast-util-to-html'

translateDoc({
  fileName: fileName, // 绝对路径
  dirname: fileURLToPath(import.meta.url),
  sourceSuffix: '.zh.md', // 源文件后缀
  targetSuffix: '.en.md', // 目标文件后缀
  projectInfo: {
    projectId: '<your project id>', // 替换成你的 Google-translate-API 的 projectId，也可将 projectId 存入本地环境变量中，脚本会去读取。
  },
  isKeepHtml: true, // 是否保留 html 标签
  /**
   * 对部分 HTML 标签进行特殊处理
   * <embed src="docs/test.zh.md"/> 翻译后 <embed src="docs/test.en.md"/>
   */
  customHtmlCallBack: (type, h, node) => {
    if (type !== 'embed') {
      return;
    }
    // embed 时，没有后闭合标签，所以需要手动添加
    if (node.properties && node.properties.dataMdast === 'html') {
      node.properties.dataMdast = undefined;
      let value = toHtml(node, { space: type });
      if (type === 'embed') {
        value = value.replace(/zh.md/g, 'en.md') + '</embed>';
      }
      return h(node, 'html', value);
    }
  }
});
```

## API 说明

### fileName
被翻译文件的文件名

### dirname
被翻译文件的文件夹路径

### sourceSuffix
被翻译文件的后缀名

### targetSuffix
翻译后文件的后缀名

### projectInfo
google-translate-api 的配置信息，具体可参考 [google-translate-api](https://cloud.google.com/docs/authentication/application-default-credentials)

### isKeepHtml
是否保留 Markdown 中原有的 html 标签
e.g.:
```md
## 介绍

<img src="https://im000.png" width="100" height="100" />
```
翻译后：
```md
## Introduction
<img src="https://im000.png" width="100" height="100" />
```

### customHtmlCallBack
对部分 HTML 标签进行特殊处理
**options**
- type 标签类型
- h 处理特定元素的方法
- node 需要转换的元素信息，[详情可查看](https://github.com/syntax-tree/hast#element)

e.g.:
```js
customHtmlCallBack: (type, h, node) => {
  if (type !== 'embed') {
    return;
  }
  // embed 时，没有后闭合标签，所以需要手动添加
  if (node.properties && node.properties.dataMdast === 'html') {
    node.properties.dataMdast = undefined;
    let value = toHtml(node, { space: type });
    if (type === 'embed') {
      value = value.replace(/zh.md/g, 'en.md') + '</embed>';
    }
    return h(node, 'html', value);
  }
}
```
翻译前：
```md
## 介绍
<embed src="docs/test.zh.md"/>
```
翻译后：
```md
## Introduction
<embed src="docs/test.en.md"/>
```

## TODO
1. todo: 翻译部分内容忽略，可不做翻译，使用正则进行匹配

```js
const ignoreReg = [ /<code>[\s\S]*?<\/code>/g ]; // 忽略 code 标签内的内容
// true: 删除部分内容， false： 不翻译此内容
ignoreConfig(ignoreReg, true);
```
npm package: @stone-payment/jade
Description: Lots of typescript utility functions
Author: Allan Garcez
Latest version: 0.1.9

# sidekicker

# Methods

## tryCatch

A simple implementation of tryCatch, inspired in Java Exceptions+TryCatch.

```typescript
const sum = tryCatch(
    (x: number) => {
        if (x === 1) throw new CustomError()
        if (x === 2) throw () => {
        };
        if (x === 3) throw "==>"
        return 1 + 1
    },
    // Will call this function if the throw==CustomError
    exception(CustomError, (e) => `THIS IS A ${e.name}`),
    // Will call this function if throw a function
    exception(Function, (e) => `THIS IS A __${e.constructor.name}__ ERROR`),
    // Will call this function if throw a string
    exception(String, (e) => `${e} string error`),
)
```