DriveNets 设计系统 ESLint 插件
这个ESLint插件为使用DriveNets设计系统的项目提供自定义的林入规则和配置.
它有助于实施最佳做法,并从已腐烂的部件和道具中迁移.
安装
首先,通过您首选的软件包管理器安装软件包:
npm install -D @drivenets/eslint-plugin-design-system
# or
pnpm install -D @drivenets/eslint-plugin-design-system
# or
yarn add -D @drivenets/eslint-plugin-design-system
使用量
[注] 这个插件只支持新的ESLint平面配置格式,需要ESLint 9.0.0或更高.
要使用插件,请添加到您的 ESLint 配置文件( 如. eslint.config.ts) (中文(简体) ).
您也可以使用推荐的配置 :
import { defineConfig } from 'eslint/config';
import designSystem from '@drivenets/eslint-plugin-design-system';
export default defineConfig(
// ... your config
designSystem.configs.recommended,
);
或者你可以按需要定制规则:
import { defineConfig } from 'eslint/config';
import designSystem from '@drivenets/eslint-plugin-design-system';
export default defineConfig(
// ... your config
{
plugins: {
'@drivenets/design-system': designSystem,
},
rules: {
'@drivenets/design-system/no-native-button': 'off',
'@drivenets/design-system/no-native-text-input': 'error',
},
},
);