eslint-plugin-semi-design

2.56.3 • Public • Published

eslint-plugin-semi-design

eslint plugin for semi design

Rules

✅ Should not reference semi-ui in semi-foundation

semi-ui should not be used as a dependency of semi-foundation.

Why: According to Semi's foundation and adapter design, foundation should not depend on adapter. Click to view the F/A design.

✅ Should not import lodash-es in semi-ui and semi-foundation

Use lodash instead of lodash-es.

Why: In order to be compatible with next, lodash-es only provides the product of es module.

image

See more here

✅ Should not use relative paths to import a package under packages in semi-ui or semi-foundation

For imports between packages under monorepo, use package names instead of relative paths.

Why: These two packages may not be in the same folder in the installation path of the user project, and the corresponding package cannot be found using the relative path.

// ❌ Not recommend
// semi-ui/input/index.tsx
import inputFoundation from '../semi-foundation/input/foundation';

// ✅ Recommend
// semi-ui/input/index.tsx
import inputFoundation from '@douyinfe/semi-foundation/input/foundation';

✅ Should not use the package name and path to import other modules under the same package

When importing the same package, use relative paths instead of referencing the package name.

// ❌ Not recommend
// semi-ui/modal/Modal.tsx
import { Button } from '@douyinfe/semi-ui';

// ✅ Recommend
// semi-ui/modal/Modal.tsx
import Button from '../button';

✅ Should not import React or ReactDOM in semi-foundation

// ❌ 
// packages/semi-foundation/input/foundation.ts
import React from 'react';
import ReactDOM from 'react-dom';

Related docs

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i eslint-plugin-semi-design

    Homepage

    semi.design

    Weekly Downloads

    317

    Version

    2.56.3

    License

    MIT

    Unpacked Size

    14.4 kB

    Total Files

    7

    Last publish

    Collaborators

    • point.halo
    • shijiatongxue
    • daiqiangreal
    • yumeizhang
    • yannlynn