Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintrc.js

This file was deleted.

2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: ant-design
open_collective: ant-design
27 changes: 27 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: 2
updates:
- package-ecosystem: npm
directory: '/'
schedule:
interval: weekly
day: monday
time: '21:00'
timezone: Asia/Shanghai
open-pull-requests-limit: 10
groups:
npm-dependencies:
patterns:
- '*'

- package-ecosystem: github-actions
directory: '/'
schedule:
interval: weekly
day: monday
time: '21:00'
timezone: Asia/Shanghai
open-pull-requests-limit: 10
groups:
github-actions:
patterns:
- '*'
43 changes: 43 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'CodeQL'

on:
push:
branches: ['main']
pull_request:
branches: ['main']
schedule:
- cron: '36 13 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [javascript-typescript]

steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Initialize CodeQL
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
with:
category: '/language:${{ matrix.language }}'
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: ✅ test

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-node@v6
with:
node-version: 22
- run: npm install
- run: npm run lint
Comment thread
afc163 marked this conversation as resolved.
- run: npm run build
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm commitlint --edit $1
npx commitlint --edit $1
53 changes: 40 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,65 @@
# @rc-component/father-plugin
<div align="center">
<h1>@rc-component/father-plugin</h1>
<p><sub><a href="https://ant.design"><img alt="Ant Design" height="14" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" style="vertical-align: -0.125em;" /></a> Part of the Ant Design ecosystem.</sub></p>
<p>🧱 Shared father build plugin for rc-component packages.</p>

[![NPM version](https://img.shields.io/npm/v/@rc-component/father-plugin.svg?style=flat)](https://npmjs.org/package/@rc-component/father-plugin) [![NPM downloads](http://img.shields.io/npm/dm/@rc-component/father-plugin.svg?style=flat)](https://npmjs.org/package/@rc-component/father-plugin)
<p>
<a href="https://npmjs.org/package/@rc-component/father-plugin"><img alt="NPM version" src="https://img.shields.io/npm/v/@rc-component/father-plugin.svg?style=flat-square"></a>
<a href="https://npmjs.org/package/@rc-component/father-plugin"><img alt="npm downloads" src="https://img.shields.io/npm/dm/@rc-component/father-plugin.svg?style=flat-square"></a>
<a href="https://bundlephobia.com/package/@rc-component/father-plugin"><img alt="bundle size" src="https://img.shields.io/bundlephobia/minzip/%40rc-component%2Ffather-plugin?style=flat-square"></a>
<a href="https://github.com/react-component/father-plugin/actions/workflows/test.yml"><img alt="build status" src="https://github.com/react-component/father-plugin/actions/workflows/test.yml/badge.svg"></a>
<a href="https://app.codecov.io/gh/react-component/father-plugin"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/react-component/father-plugin/main.svg?style=flat-square"></a>
</p>
</div>

The father plugin for all react-component projects.
<p align="center">English | <a href="./README.zh-CN.md">简体中文</a></p>

## Usage
## Highlights

| Area | Support |
| ------- | ----------------------------------------------------- |
| Purpose | Shared father build plugin for rc-component packages. |
| Package | `@rc-component/father-plugin` |
| Release | `@rc-component/np` / `rc-np` |

Install this plugin in `devDependencies`:
## Install

```bash
$ npm i @rc-component/father-plugin -D
npm install @rc-component/father-plugin --save-dev
```

Register it in `.fatherrc.ts`:
## Usage

```ts
```ts | pure
import { defineConfig } from 'father';

export default defineConfig({
plugins: ['@rc-component/father-plugin'],
});
```

## API

| Option | Description |
| --------- | -------------------------------------------------------- |
| `plugins` | Register `@rc-component/father-plugin` in father config. |

## Development

```bash
$ pnpm install
npm install
npm run lint
npm run build
Comment thread
afc163 marked this conversation as resolved.
```

## Release

```bash
$ npm run dev
$ npm run build
npm run prepublishOnly
```

## LICENSE
The release flow is handled by `@rc-component/np` through the `rc-np` command when the package uses the shared release flow.

## License

MIT
@rc-component/father-plugin is released under the [MIT](./LICENSE) license.
65 changes: 65 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<div align="center">
<h1>@rc-component/father-plugin</h1>
<p><sub><a href="https://ant.design"><img alt="Ant Design" height="14" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" style="vertical-align: -0.125em;" /></a> Ant Design 生态的一部分。</sub></p>
<p>🧱 rc-component 包共享的 father 构建插件。</p>

<p>
<a href="https://npmjs.org/package/@rc-component/father-plugin"><img alt="NPM version" src="https://img.shields.io/npm/v/@rc-component/father-plugin.svg?style=flat-square"></a>
<a href="https://npmjs.org/package/@rc-component/father-plugin"><img alt="npm downloads" src="https://img.shields.io/npm/dm/@rc-component/father-plugin.svg?style=flat-square"></a>
<a href="https://bundlephobia.com/package/@rc-component/father-plugin"><img alt="bundle size" src="https://img.shields.io/bundlephobia/minzip/%40rc-component%2Ffather-plugin?style=flat-square"></a>
<a href="https://github.com/react-component/father-plugin/actions/workflows/test.yml"><img alt="build status" src="https://github.com/react-component/father-plugin/actions/workflows/test.yml/badge.svg"></a>
<a href="https://app.codecov.io/gh/react-component/father-plugin"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/react-component/father-plugin/main.svg?style=flat-square"></a>
</p>
</div>

<p align="center"><a href="./README.md">English</a> | 简体中文</p>

## 亮点

| 方向 | 支持 |
| ---- | --------------------------------------- |
| 定位 | rc-component 包共享的 father 构建插件。 |
| 包名 | `@rc-component/father-plugin` |
| 发布 | `@rc-component/np` / `rc-np` |

## 安装

```bash
npm install @rc-component/father-plugin --save-dev
```

## 用法

```ts | pure
import { defineConfig } from 'father';

export default defineConfig({
plugins: ['@rc-component/father-plugin'],
});
```

## API

| 名称 | 说明 |
| --------- | ---------------------------------------------------- |
| `plugins` | 在 father 配置中注册 `@rc-component/father-plugin`。 |

## 本地开发

```bash
npm install
npm run lint
npm run build
```

## 发布

```bash
npm run prepublishOnly
```

发布流程通过 `@rc-component/np` 提供的 `rc-np` 命令处理。

## 许可证

@rc-component/father-plugin 基于 [MIT](./LICENSE) 协议发布。
115 changes: 115 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import js from '@eslint/js';
import { defineConfig } from 'eslint/config';
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import prettier from 'eslint-config-prettier';
import jest from 'eslint-plugin-jest';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import globals from 'globals';
import tseslint from 'typescript-eslint';

const tsconfigRootDir = dirname(fileURLToPath(import.meta.url));

export default defineConfig([
{
plugins: {
'@typescript-eslint': tseslint.plugin,
},
},
{
linterOptions: {
reportUnusedDisableDirectives: 'warn',
},
},
{
ignores: [
'node_modules/',
'coverage/',
'es/',
'lib/',
'dist/',
'docs-dist/',
'.docs-dist/',
'.dumi/',
'.doc/',
'.vercel/',
],
},
{
files: ['**/*.{js,jsx,ts,tsx}'],
extends: [
js.configs.recommended,
react.configs.flat.recommended,
react.configs.flat['jsx-runtime'],
prettier,
],
plugins: {
'react-hooks': reactHooks,
},
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'no-async-promise-executor': 'off',
'no-empty-pattern': 'off',
'no-irregular-whitespace': 'off',
'no-prototype-builtins': 'off',
'no-useless-escape': 'off',
'no-extra-boolean-cast': 'off',
'no-undef': 'off',
'no-unused-vars': 'off',
'react/no-find-dom-node': 'off',
'react/display-name': 'off',
'react/no-unknown-property': 'off',
'react/prop-types': 'off',
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/rules-of-hooks': 'error',
},
},
{
files: ['**/*.{ts,tsx}'],
extends: [...tseslint.configs.recommended],
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
'@typescript-eslint/no-unused-vars': 'off',
},
},
{
files: ['src/**/*.{ts,tsx}'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir,
},
},
},
{
files: ['tests/**/*.{js,jsx,ts,tsx}', '**/*.{test,spec}.{js,jsx,ts,tsx}'],
extends: [jest.configs['flat/recommended']],
rules: {
'jest/no-disabled-tests': 'off',
'jest/no-done-callback': 'off',
'jest/no-identical-title': 'off',
'jest/expect-expect': 'off',
'jest/no-alias-methods': 'off',
'jest/no-conditional-expect': 'off',
'jest/no-export': 'off',
'jest/no-standalone-expect': 'off',
'jest/valid-expect': 'off',
'jest/valid-title': 'off',
},
},
]);
Loading