open-index/open-npm huggingface dataset:
npm package: @gx-web/component
Description: 冠宣组件库
Author: wangjiahui
Latest version: 1.1.6

# @gx-web/component

## 安装

```shell
# pnpm
pnpm add @gx-web/component
# npm
npm i @gx-web/component
# yarn
yarn add @gx-web/component
```
npm package: @gx-web/eslint-config
Description: 冠宣eslint配置
Author: wangjiahui
Latest version: 2.0.4

# ESLint Config of Project

## 安装

```shell
# pnpm
pnpm add @gx-web/eslint-config -D
# npm
npm i @gx-web/eslint-config -D
# yarn
yarn add @gx-web/eslint-config -D
```

## 使用

```js
// .eslintrc.js
import BaseEslintConfig from '@gx-web/eslint-config'

export default BaseEslintConfig()
```

## 忽略文件

```ignore
# .eslintignore
dist
node_modules

*.js
!.eslintrc.js
!.stylelintrc.js
```

## 格式化配置

```json
// .vscode/settings.json
{
  // Enable the ESlint flat config support
  "eslint.experimental.useFlatConfig": true,
  // Disable the default formatter, use eslint instead
  "prettier.enable": false,
  "editor.formatOnSave": false,
  // Auto fix
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit",
    "source.organizeImports": "never"
  },
  // Silent the stylistic rules in you IDE, but still auto fix them
  "eslint.rules.customizations": [
    {
      "rule": "style/*",
      "severity": "off"
    },
    {
      "rule": "format/*",
      "severity": "off"
    },
    {
      "rule": "*-indent",
      "severity": "off"
    },
    {
      "rule": "*-spacing",
      "severity": "off"
    },
    {
      "rule": "*-spaces",
      "severity": "off"
    },
    {
      "rule": "*-order",
      "severity": "off"
    },
    {
      "rule": "*-dangle",
      "severity": "off"
    },
    {
      "rule": "*-newline",
      "severity": "off"
    },
    {
      "rule": "*quotes",
      "severity": "off"
    },
    {
      "rule": "*semi",
      "severity": "off"
    }
  ],
  // Enable eslint for all supported languages
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact",
    "vue",
    "html",
    "markdown",
    "json",
    "jsonc"
  ]
}
```

## 格式化命令

```json
// package.json
{
  "scripts": {
    "lint:eslint": "eslint --fix ./src"
  }
}
```

**命令参数说明**

- `--fix`
  - 此项指示 ESLint 尝试修复尽可能多的问题。这些修复是对实际文件本身进行的，只有剩余的未修复的问题才会被输出
- `--ext .js,.ts,tsx,.vue`
  - 此选项用于指定 ESLint 在目录中匹配目标文件所用扩展
- `./src`
  - 格式化目录, 支持目录, 文件名

[其余命令可参考官方](https://zh-hans.eslint.org/docs/latest/use/command-line-interface)
npm package: @gx-web/prettier-config
Description: 冠宣prettier配置
Author: wangjiahui
Latest version: 1.0.1

# prettier Config of Project

## 安装

```shell
# pnpm
pnpm add @gx-web/prettier-config prettier -D

# npm
npm i @gx-web/prettier-config prettier -D

# yarn
yarn add @gx-web/prettier-config prettier -D
```

## 使用

以下两种形式, 选中一种即可

---

package.json

```json
{
  "prettier": "@gx-web/prettier-config"
}
```

---

prettier.config.mjs

```js
import GXPrettierConfig from '@gx-web/prettier-config'

export default {
  ...GXPrettierConfig,
  semi: false
}
```

## 命令行

```shell
# 运行格式化
# -w 是 --write 别名
pnpm pnpm exec prettier . -w

# 格式化目录
pnpm pnpm exec prettier ./src -w

# 格式化目录下的某些后缀的文件
pnpm pnpm exec prettier ./src/**/*.{ts,tsx,js,vue} -w
```

[更多命令行请参考文档](https://prettier.io/docs/en/cli.html)
npm package: @gx-web/stylelint-config
Description: 冠宣stylelint配置
Author: wangjiahui
Latest version: 2.0.2

# Stylelint Config of Project

## 安装

```shell
# pnpm
pnpm add stylelint @gx-web/stylelint-config postcss postcss-html -D
# npm
npm i stylelint @gx-web/stylelint-config postcss postcss-html -D
# yarn
yarn add stylelint @gx-web/stylelint-config postcss postcss-html -D
```

### 注意须知

**需要以下同等依赖, 请手动安装**

- `postcss`
- `postcss-html`

**在`pnpm`进行管理依赖时, 需要配置`.npmrc`**

```config
# 默认配置
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*prettier*

# 添加配置
public-hoist-pattern[]=*stylelint*
```

## 配置使用

```js
// stylelint.config.mjs
export default {
  extends: ['@gx-web/stylelint-config'],
  // 拓展规则
  rules: {},
  // 忽略文件
  ignoreFiles: []
}
```

## 格式化配置

```json
// .vscode/settings.json
{
  "editor.codeActionsOnSave": {
    "source.fixAll.stylelint": "explicit"
  },
  "stylelint.validate": [
    "html",
    "css",
    "scss",
    "vue"
  ],
  "scss.lint.unknownAtRules": "ignore"
}
```

## 格式化命令

```json
// package.json
{
  "scripts": {
    "lint:stylelint": "stylelint --fix './src/**/*.{css,scss,vue}'"
  }
}
```

**命令参数说明**

- `--fix`
  - 此项指示 ESLint 尝试修复尽可能多的问题。这些修复是对实际文件本身进行的，只有剩余的未修复的问题才会被输出
- `'./src/**/*.{css,scss,vue}'`
  - 格式化目录, 支持目录, 文件名

[其余命令可参考官方](https://www.stylelint.com.cn/user-guide/cli)
npm package: @gx-web/tool
Description: 冠宣工具库
Author: wangjiahui
Latest version: 1.1.11

# @gx-web/tool

## 安装

```shell
# pnpm
pnpm add @gx-web/tool
# npm
npm i @gx-web/tool
# yarn
yarn add @gx-web/tool
```
npm package: @gx-web/unocss-config
Description: 冠宣unocss配置
Author: wangjiahui
Latest version: 1.0.0

# Unocss Config of Project

## 安装

```shell
# pnpm
pnpm add @gx-web/unocss-config -D
# npm
npm i @gx-web/unocss-config -D
# yarn
yarn add @gx-web/unocss-config -D
```

## 使用

```ts
// unocss.config.ts
import { defineConfig } from 'unocss'

import { setupPreset } from '@gx-web/unocss-config'

export default defineConfig({
  presets: [
    setupPreset()
  ]
})
```