From b46ee9e3d8175756d3b2210b34585253c16407e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=96=87=E6=B6=9B?= Date: Wed, 26 Aug 2020 10:48:24 +0800 Subject: [PATCH 01/21] docs: using new demo (#457) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Publish 0.6.0 (#437) * chore: generate-material * feat: support generate-component * chore: fix * chore: prettier * chore: camelcase5.x because def generator not support 6.x(only node10.x) * chore: set test case default registry * chore: prettier fix * fix: display incorrect Language * fix: configHelper active events * feat: support other material * feat: support other material * chore: prettier * fix: options * chore: rework * fix: adaptor typo error * chore: 去除无用参数 * chore: prettierr * chore: prettierr * fix: glob add dot * chore: publish * feat: update * feat: update * fix: ci * fix: ci * feat: update style dau * fix: prettier:fix * feat: update * feat: update review * feat: support all json files in config-helper * feat: support theme package array Co-authored-by: jason.yf * fix: ci * feat: Component Doc Helper (#405) * feat: material doc panel init * refactor: useReduce and add i nterface * feat: add doc link in Hover * fix: command in hoverItem * feat: openInInternalBrowser * feat: add document Material Finder * feat: add setting and rename symbols * feat: i18n * refactor: solve the problems in the first round of review * chore: update function name Co-authored-by: alvinhui * chore: set prettier in pre-push * chore: upgrade extension version for beta publish * fix: quickPickItemDisplayMutipleTimes * fix: display en in zh-cn model (#422) * feat: component generator (#377) * feat: init lowcode project * feat: add canvas and inner * chore: eslintignore * fix: lint * feat: init component generator * feat: support extra html * feat: generate code * fix: theme * feat: schema param * feat: support write file to local * feat: init schema * fix: package * fix: remove unused packages * chore: remove component generator web * feat: transformTextComp&transformCompMap * fix: lint * chore: remove code * feat: input component error prompt * fix: lint * chore: todo * feat: support tsx * feat: update assets cdn url * chore: remove deps * feat: add try catch in generateComponentCode * fix: comment * fix: i18n * feat: component generator for quick pick (#419) * feat: add component generator quickPick * chore: change log * fix: lint * fix: config helper (#425) * fix: command language && paltette * fix: show source * feat: make sure uri is validate * style: fix by prettier * docs: update config helper and material helper README (#423) * docs: update changlog and README for config helper * docs: update changelog and doc of material helper * fix: update Docs and en build.json schema * chore: update words * chore: update docs * feat: disable form input when submit (#426) * feat: disable-form-input-when-submit * fix: remove unused code * chore: version&changeLog&i18n * docs: update version and CHANGE.log (#427) * fix: prettier ignore ejs * docs: update description * fix: webpack build error * fix: comment * fix: package version * chore: version & changelog (#429) * hotfix: create component error (#430) * fix: create component error * fix: console * docs: change section order * refactor: using generate component in quick pick * feat: add more command for Iceworks status bar * docs: typo * refactor: Docs && Commands (#431) * docs: change section order * refactor: using generate component in quick pick * feat: add more command for Iceworks status bar * docs: typo * chore: component service i18n (#434) * chore: component-service i18n * fix: comment * docs: update iceworks-ui-builder README (#432) * docs: update iceworks-ui-builder README * fix: comment * fix: typo * chore: docs description * chore: change cdnUrl (#435) * hotfix: loss i18n * feat: always register runBuild command * feat: recordExecuteCommand * style: fix by lint Co-authored-by: liuxiong.lx Co-authored-by: sspku-yqLiu Co-authored-by: yangfan <18767120422@163.com> Co-authored-by: jason.yf Co-authored-by: sspku-yqLiu <56879942+sspku-yqLiu@users.noreply.github.com> Co-authored-by: Hengchang Lu <44047106+luhc228@users.noreply.github.com> Co-authored-by: luhc228 * fix: merge master * fix: merge master * docs: update demo * chore: remove unnecessary file * chore: remove unnecessary file * chore: remove unnecessary file * docs: using new demo * docs: supports * docs: new demos * docs: add features * docs: add more detail links * docs: typo * docs: add more badges Co-authored-by: liuxiong.lx Co-authored-by: sspku-yqLiu Co-authored-by: yangfan <18767120422@163.com> Co-authored-by: jason.yf Co-authored-by: sspku-yqLiu <56879942+sspku-yqLiu@users.noreply.github.com> Co-authored-by: Hengchang Lu <44047106+luhc228@users.noreply.github.com> Co-authored-by: luhc228 --- README.md | 7 +++-- README.zh-CN.md | 7 +++-- extensions/iceworks/README.md | 47 ++++++++++++++++++++++++----- extensions/iceworks/README.zh-CN.md | 47 ++++++++++++++++++++++++----- extensions/iceworks/package.json | 2 +- 5 files changed, 87 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index f6cafa7da..51f5f9e03 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ English | [简体中文](./README.zh-CN.md)

- + + Test Coverage PRs Welcome @@ -28,11 +29,11 @@ Use Iceworks to develop Universal Application quickly: - Enter "iceworks" in the input box to search - Click the Install button on the first iceworks option -![install demo](https://img.alicdn.com/tfs/TB1jDJ7R8r0gK0jSZFnXXbRRXXa-1024-768.png) +![install demo](https://img.alicdn.com/tfs/TB1.Wz9SuH2gK0jSZJnXXaT1FXa-1024-768.png_790x10000.jpg) After installation is successful, click the "Iceworks icon" on Activity Bar of VS Code to start: -![Iceworks](https://img.alicdn.com/tfs/TB1lyV9inM11u4jSZPxXXahcXXa-1024-768.png_790x10000.jpg) +![demo](https://img.alicdn.com/tfs/TB1Z8T0gzMZ7e4jSZFOXXX7epXa-1024-768.png_790x10000.jpg) [See the Pack for more details](extensions/iceworks/README.md). diff --git a/README.zh-CN.md b/README.zh-CN.md index c1c2c4944..0db01f141 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -13,7 +13,8 @@

- + + Test Coverage PRs Welcome @@ -26,11 +27,11 @@ - 在输入框中输入「iceworks」进行搜索; - 点击第一个「iceworks」选项上的「安装」按钮。 -![install demo](https://img.alicdn.com/tfs/TB1Bm.kaCR26e4jSZFEXXbwuXXa-1024-766.gif) +![安装 Iceworks](https://img.alicdn.com/tfs/TB1vS2kg9R26e4jSZFEXXbwuXXa-1024-768.png_790x10000.jpg) 安装成功后,点击 VS Code 界面左侧活动栏上的「Iceworks 图标」,开始使用: -![使用示例](https://img.alicdn.com/tfs/TB1nk3YRQL0gK0jSZFtXXXQCXXa-1024-768.png_790x10000.jpg) +![使用示例](https://img.alicdn.com/tfs/TB1Qr7oi8Bh1e4jSZFhXXcC9VXa-1024-768.png_790x10000.jpg) [查看套件了解更多功能](extensions/iceworks/README.md)。 diff --git a/extensions/iceworks/README.md b/extensions/iceworks/README.md index 42346bf13..1c35783ae 100644 --- a/extensions/iceworks/README.md +++ b/extensions/iceworks/README.md @@ -4,25 +4,56 @@ English | [简体中文](https://github.com/ice-lab/iceworks/blob/master/extensi [![Version for VS Code Extension](https://vsmarketplacebadge.apphb.com/version-short/iceworks-team.iceworks.svg?logo=visual-studio-code)](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) [![Installs](https://vsmarketplacebadge.apphb.com/installs-short/iceworks-team.iceworks.svg)](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) -[![Rating](https://vsmarketplacebadge.apphb.com/rating-short/iceworks-team.iceworks.svg)](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks&ssr=false#review-details) +[![Downloads](https://vsmarketplacebadge.apphb.com/downloads-short/iceworks-team.iceworks.svg)](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) +[![Rating](https://vsmarketplacebadge.apphb.com/rating-star/iceworks-team.iceworks.svg)](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks&ssr=false#review-details) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/ice-lab/iceworks/pulls) [![The MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT) -Iceworks is a Visual Intelligent Development Assistant, provide visualization and intelligent technology to build Universal Application faster and better. +Iceworks is a Visual Intelligent Development Assistant, provide visualization and intelligent technology to build Universal Application faster and better, support Web / H5 / MiniProgram Application. + +## Features + +### Visual Development + +Iceworks Visual Development provides functions: Visual Construction and Visual Configuration. + +Visual Construction provides the drag and drop capability of WYSIWYG, which helps to quickly complete the development of front-end pages.This capability is independent of the specific platform and framework, after building, you can update UI by code. It greatly reduces the threshold of front-end development and improves the efficiency of front-end development. At the same time, it also takes into account the maintainability and flexibility of the program. + +![Visual Construction](https://img.alicdn.com/tfs/TB1yTO8i8Bh1e4jSZFhXXcC9VXa-1440-900.png_790x10000.jpg) + +> See [UI Builder Extension](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks-ui-builder) for more details. + +Visual Configuration aims to reduce the threshold of front-end development and improve the development experience. It provides the ability to generate code through process guidance and form operation. The ability supports user-defined templates or materials and provides developers with the ability to generate personalized code. + +![Visual Configuration](https://img.alicdn.com/tfs/TB1vrcOSEz1gK0jSZLeXXb9kVXa-2048-1536.png_790x10000.jpg) + +> See [Config Helper Extension](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks-config-helper) for more details. + +### Intelli Code + +Iceworks Intelli Code currently provides functions: Code Completion and Code Information. + +In the process of code writing, Iceworks Intelli Code can automatically predict the developer's programming intention and continuously recommend "the next code to be written" to the developer. The developer can directly confirm the code to be input by "one click completion", thus greatly improving the efficiency of code writing. For example, when inputting style fields and values, the Code Completion effect provided by Iceworks is as follows. + +![Code Completion](https://user-images.githubusercontent.com/56879942/87412958-3895e700-c5fc-11ea-88e2-3e3e78a07f9e.gif) + +Iceworks Code Completion is based on semantic and code analysis, completely local execution, ensure code security; millisecond response, smooth coding! + +### Abundant Materials + +Iceworks set [Fusion Design](https://fusion.design/) and [Rax UI](https://rax.js.org/docs/components/introduce) components as built-in materials, abundant materials can be used out of the box: applications can be created through materials, components and pages can be generated through materials, and codes can be added with one click. Iceworks also supports the access of custom materials, and provides the whole process support for the material development link. Developers can easily customize the business specific material collection: + +![Abundant Material](https://img.alicdn.com/tfs/TB1UjO9SET1gK0jSZFrXXcNCXXa-1000-750.png_790x10000.jpg) ## Quick start Click "Iceworks Icon" on the **Activity Bar** to open the **Iceworks Side Bar**: -![demo](https://img.alicdn.com/tfs/TB1aRI.RHr1gK0jSZFDXXb9yVXa-1024-768.png_790x10000.jpg) +![demo](https://img.alicdn.com/tfs/TB1Z8T0gzMZ7e4jSZFOXXX7epXa-1024-768.png_790x10000.jpg) After the application is created, NPM script execution/page creation/component creation and other operations are performed in **Iceworks Side Bar**: -![demo](https://img.alicdn.com/tfs/TB1lyV9inM11u4jSZPxXXahcXXa-1024-768.png_790x10000.jpg) - -More features can be obtained by search 'Iceworks' in the Command Panel or click "Iceworks button" on the Status Bar: - -![demo](https://img.alicdn.com/tfs/TB1ickZRQL0gK0jSZFtXXXQCXXa-1024-768.png_790x10000.jpg) +![demo](https://img.alicdn.com/tfs/TB1qZ7jSBr0gK0jSZFnXXbRRXXa-1024-768.png_790x10000.jpg) ## Extensions diff --git a/extensions/iceworks/README.zh-CN.md b/extensions/iceworks/README.zh-CN.md index c346de6c9..977af8ad6 100644 --- a/extensions/iceworks/README.zh-CN.md +++ b/extensions/iceworks/README.zh-CN.md @@ -4,25 +4,56 @@ [![Version for VS Code Extension](https://vsmarketplacebadge.apphb.com/version-short/iceworks-team.iceworks.svg?logo=visual-studio-code)](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) [![Installs](https://vsmarketplacebadge.apphb.com/installs-short/iceworks-team.iceworks.svg)](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) -[![Rating](https://vsmarketplacebadge.apphb.com/rating-short/iceworks-team.iceworks.svg)](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks&ssr=false#review-details) +[![Downloads](https://vsmarketplacebadge.apphb.com/downloads-short/iceworks-team.iceworks.svg)](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks) +[![Rating](https://vsmarketplacebadge.apphb.com/rating-star/iceworks-team.iceworks.svg)](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks&ssr=false#review-details) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/ice-lab/iceworks/pulls) [![The MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT) -可视化智能开发助手,通过可视化编程和智能辅助手段,更快更好地构建多端应用。 +可视化智能开发助手,通过可视化编程和智能辅助手段,更快更好地构建多端应用,支持 Web 、HTML 5 和小程序应用。 + +## 核心特性 + +### 可视化开发 + +Iceworks 可视化开发提供两个基本功能:可视化搭建和可视化配置。 + +可视化搭建提供所见即所得的拖拽能力,助力快速完成前端页面的开发。该能力不与具体平台绑定、和具体框架无关,搭建完成后可以继续二次编码,它在极大降低前端开发的门槛和提升前端开发的效率同时,还兼顾了程序的可维护性和灵活性: + +![可视化搭建](https://img.alicdn.com/tfs/TB1yTO8i8Bh1e4jSZFhXXcC9VXa-1440-900.png_790x10000.jpg) + +> 更多介绍,请参考[《可视化搭建》](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks-ui-builder)。 + +可视化配置旨在降低前端开发门槛、提升开发体验,提供了流程引导生成代码和表单操作生成代码的能力,该能力支持自定义模板或物料,为开发者提供个性化代码的生成能力: + +![可视化配置](https://img.alicdn.com/tfs/TB1VzS_i8Bh1e4jSZFhXXcC9VXa-1024-768.png_790x10000.jpg) + +> 更多介绍,请参考[《可视化配置》](https://marketplace.visualstudio.com/items?itemName=iceworks-team.iceworks-config-helper)。 + +### 智能编程 + +Iceworks 智能编程当前提供了两个基本功能:代码自动补全和代码信息提示。 + +在开发者编写代码的过程中,智能引擎能够自动预测开发者的编程意图,连续向开发者推荐「即将书写的下一段代码」,开发者可以通过「一键补全」的方式,直接确认接下来要输入的代码,从而大大提升代码的编写效率。例如输入样式字段和值时,Iceworks 提供的代码自动补全效果如下: + +![使用示例](https://user-images.githubusercontent.com/56879942/87412958-3895e700-c5fc-11ea-88e2-3e3e78a07f9e.gif) + +Iceworks 的代码自动补全能力基于语言语义和源代码分析,完全本地执行,确保代码安全;毫秒级响应,流畅进行编码! + +### 丰富的物料体系 + +Iceworks 内置 [Fusion Design](https://fusion.design/)、[Rax UI](https://rax.js.org/docs/components/introduce) 组件库,丰富的物料开箱即用:可通过物料创建应用、生成组件和组装页面、一键添加到代码……同时支持接入自定义物料,对物料开发的链路提供了全流程的支持,开发者可轻松定制业务专属的物料集合: + +![物料示例](https://img.alicdn.com/tfs/TB1UjO9SET1gK0jSZFrXXcNCXXa-1000-750.png_790x10000.jpg) ## 快速开始 点击活动栏上的 Iceworks 图标,打开侧边栏和创建应用流程: -![使用示例](https://img.alicdn.com/tfs/TB16Vo4RND1gK0jSZFsXXbldVXa-1024-768.png_790x10000.jpg) +![使用示例](https://img.alicdn.com/tfs/TB1Qr7oi8Bh1e4jSZFhXXcC9VXa-1024-768.png_790x10000.jpg) 应用创建完成,在 Iceworks 侧边栏上进行 npm 脚本执行、创建组件、生成页面等操作: -![使用示例](https://img.alicdn.com/tfs/TB1nk3YRQL0gK0jSZFtXXXQCXXa-1024-768.png_790x10000.jpg) - -更多功能,可以点击状态栏右下角的「Iceworks」进行获取: - -![使用示例](https://img.alicdn.com/tfs/TB17372RKL2gK0jSZPhXXahvXXa-1024-768.png_790x10000.jpg) +![使用示例](https://img.alicdn.com/tfs/TB1knetjk9l0K4jSZFKXXXFjpXa-1024-768.png_790x10000.jpg) ## 插件列表 diff --git a/extensions/iceworks/package.json b/extensions/iceworks/package.json index 374575cf8..3c6a844be 100644 --- a/extensions/iceworks/package.json +++ b/extensions/iceworks/package.json @@ -1,7 +1,7 @@ { "name": "iceworks", "displayName": "Iceworks", - "description": "Visual Intelligent Development Assistant, provide visualization and intelligent technology to build Universal Application faster and better.", + "description": "Visual Intelligent Development Assistant, provide visualization and intelligent technology to build Universal Application faster and better, support Web / H5 / MiniProgram(小程序) Application.", "publisher": "iceworks-team", "version": "0.7.0", "engines": { From ad84bbc0d6e54c16d0aeaedcc5710f38f5c54fb4 Mon Sep 17 00:00:00 2001 From: yangfan <18767120422@163.com> Date: Wed, 26 Aug 2020 11:40:08 +0800 Subject: [PATCH 02/21] feat: add @iceworks/eslint-plugin-best-practices (#456) * feat: init * feat: update * fix: prettier:fix * feat: update * feat: add deps-no-resolutions * feat: add test * fix: prettier:fix * feat: update * fix: prettier:fix * feat: update * feat: add deps-no-ice-scripts * feat: add deps-no-router-library * feat: add deps-recommend-update-rax * feat: add no-lowercase-component-name * feat: add no-multi-nested-page * feat: update --- .../eslint-plugin-best-practices/README.md | 54 ++++++++++++++ .../docs/rules/deps-no-ice-scripts.md | 24 ++++++ .../docs/rules/deps-no-resolutions.md | 17 +++++ .../docs/rules/deps-no-router-library.md | 16 ++++ .../docs/rules/deps-recommend-update-rax.md | 25 +++++++ .../rules/no-broad-semantic-versioning.md | 9 +++ .../docs/rules/no-js-in-ts-project.md | 25 +++++++ .../docs/rules/no-lowercase-component-name.md | 28 +++++++ .../docs/rules/no-multi-nested-page.md | 30 ++++++++ .../rules/recommend-functional-component.md | 23 ++++++ .../eslint-plugin-best-practices/package.json | 35 +++++++++ .../src/configs/recommended.ts | 38 ++++++++++ .../src/docsUrl.ts | 5 ++ .../eslint-plugin-best-practices/src/index.ts | 13 ++++ .../src/rules/deps-no-ice-scripts.ts | 50 +++++++++++++ .../src/rules/deps-no-resolutions.ts | 35 +++++++++ .../src/rules/deps-no-router-library.ts | 56 ++++++++++++++ .../src/rules/deps-recommend-update-rax.ts | 51 +++++++++++++ .../src/rules/no-broad-semantic-versioning.ts | 74 +++++++++++++++++++ .../src/rules/no-js-in-ts-project.ts | 54 ++++++++++++++ .../src/rules/no-lowercase-component-name.ts | 72 ++++++++++++++++++ .../src/rules/no-multi-nested-page.ts | 42 +++++++++++ .../rules/recommend-functional-component.ts | 44 +++++++++++ .../tests/lib/rules/deps-no-ice-scripts.js | 21 ++++++ .../tests/lib/rules/deps-no-resolutions.js | 19 +++++ .../tests/lib/rules/deps-no-router-library.js | 22 ++++++ .../lib/rules/deps-recommend-update-rax.js | 22 ++++++ .../tests/lib/rules/no-js-in-ts-project.js | 27 +++++++ .../lib/rules/no-lowercase-component-name.js | 54 ++++++++++++++ .../tests/lib/rules/no-multi-nested-page.js | 49 ++++++++++++ .../rules/recommend-functional-component.js | 42 +++++++++++ .../tsconfig.json | 9 +++ .../README.md | 2 +- .../docs/rules/no-patent-licenses.md | 2 +- .../src/rules/no-patent-licenses.ts | 2 +- tsconfig.json | 1 + 36 files changed, 1089 insertions(+), 3 deletions(-) create mode 100644 packages/eslint-plugin-best-practices/README.md create mode 100644 packages/eslint-plugin-best-practices/docs/rules/deps-no-ice-scripts.md create mode 100644 packages/eslint-plugin-best-practices/docs/rules/deps-no-resolutions.md create mode 100644 packages/eslint-plugin-best-practices/docs/rules/deps-no-router-library.md create mode 100644 packages/eslint-plugin-best-practices/docs/rules/deps-recommend-update-rax.md create mode 100644 packages/eslint-plugin-best-practices/docs/rules/no-broad-semantic-versioning.md create mode 100644 packages/eslint-plugin-best-practices/docs/rules/no-js-in-ts-project.md create mode 100644 packages/eslint-plugin-best-practices/docs/rules/no-lowercase-component-name.md create mode 100644 packages/eslint-plugin-best-practices/docs/rules/no-multi-nested-page.md create mode 100644 packages/eslint-plugin-best-practices/docs/rules/recommend-functional-component.md create mode 100644 packages/eslint-plugin-best-practices/package.json create mode 100644 packages/eslint-plugin-best-practices/src/configs/recommended.ts create mode 100644 packages/eslint-plugin-best-practices/src/docsUrl.ts create mode 100644 packages/eslint-plugin-best-practices/src/index.ts create mode 100644 packages/eslint-plugin-best-practices/src/rules/deps-no-ice-scripts.ts create mode 100644 packages/eslint-plugin-best-practices/src/rules/deps-no-resolutions.ts create mode 100644 packages/eslint-plugin-best-practices/src/rules/deps-no-router-library.ts create mode 100644 packages/eslint-plugin-best-practices/src/rules/deps-recommend-update-rax.ts create mode 100644 packages/eslint-plugin-best-practices/src/rules/no-broad-semantic-versioning.ts create mode 100644 packages/eslint-plugin-best-practices/src/rules/no-js-in-ts-project.ts create mode 100644 packages/eslint-plugin-best-practices/src/rules/no-lowercase-component-name.ts create mode 100644 packages/eslint-plugin-best-practices/src/rules/no-multi-nested-page.ts create mode 100644 packages/eslint-plugin-best-practices/src/rules/recommend-functional-component.ts create mode 100644 packages/eslint-plugin-best-practices/tests/lib/rules/deps-no-ice-scripts.js create mode 100644 packages/eslint-plugin-best-practices/tests/lib/rules/deps-no-resolutions.js create mode 100644 packages/eslint-plugin-best-practices/tests/lib/rules/deps-no-router-library.js create mode 100644 packages/eslint-plugin-best-practices/tests/lib/rules/deps-recommend-update-rax.js create mode 100644 packages/eslint-plugin-best-practices/tests/lib/rules/no-js-in-ts-project.js create mode 100644 packages/eslint-plugin-best-practices/tests/lib/rules/no-lowercase-component-name.js create mode 100644 packages/eslint-plugin-best-practices/tests/lib/rules/no-multi-nested-page.js create mode 100644 packages/eslint-plugin-best-practices/tests/lib/rules/recommend-functional-component.js create mode 100644 packages/eslint-plugin-best-practices/tsconfig.json diff --git a/packages/eslint-plugin-best-practices/README.md b/packages/eslint-plugin-best-practices/README.md new file mode 100644 index 000000000..9e2a7f41a --- /dev/null +++ b/packages/eslint-plugin-best-practices/README.md @@ -0,0 +1,54 @@ +# @iceworks/eslint-plugin-best-practices + +Iceworks doctor best practices eslint plugin. + +## Installation + +Install [esLint](http://eslint.org), `@ice/spec` and `@iceworks/eslint-plugin-best-practices`: + +```shell +$ npm install --save-dev eslint @ice/spec @iceworks/eslint-plugin-best-practices +``` + +## Usage + +Add `best-practices` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: + +```json +{ + "plugins": [ + "@iceworks/best-practices" + ] +} +``` + + +Then configure the rules you want to use under the rules section. + +```json +{ + "rules": { + "@iceworks/best-practices/rule-name": 2 + } +} +``` + +Or you can only use extends to set default rules config. + +```json +{ + "extends": ["plugin:@iceworks/best-practices/recommended"] +}; +``` + +## Supported Rules + +* [`deps-no-ice-scripts`](./docs/rules/deps-no-ice-scripts.md) It is not recommended to use ice-scripts, the new version is ice.js. +* [`deps-no-resolutions`](./docs/rules/deps-no-resolutions.md) It is not recommended to use resolutions to lock the version. +* [`deps-no-router-library`](./docs/rules/deps-no-router-library.md) It is not recommended to directly rely on routing libraries, such as react-router-dom, react-router. +* [`deps-recommend-update-rax`](./docs/rules/ddeps-recommend-update-rax.md) Rax version < 1.0 , recommend to update Rax. +* [`no-broad-semantic-versioning`](./docs/rules/no-broad-semantic-versioning.md) Recommended the semantic versioning include everything greater than a particular version in the same major range. +* [`no-js-in-ts-project`](./docs/rules/no-js-in-ts-project.md) It is not recommended to use js and ts files at the same time. +* [`no-lowercase-component-name`](./docs/rules/no-lowercase-component-name.md) It is not recommended to name components in lower case. +* [`no-multi-nested-page`](./docs/rules/no-multi-nested-page.md) Multiple nested pages are not recommended. +* [`recommend-functional-component`](./docs/rules/recommend-functional-component.md) It is not recommended to use class component. diff --git a/packages/eslint-plugin-best-practices/docs/rules/deps-no-ice-scripts.md b/packages/eslint-plugin-best-practices/docs/rules/deps-no-ice-scripts.md new file mode 100644 index 000000000..338ce513c --- /dev/null +++ b/packages/eslint-plugin-best-practices/docs/rules/deps-no-ice-scripts.md @@ -0,0 +1,24 @@ +# deps-no-ice-scripts + +It is not recommended to use ice-scripts, the new version is ice.js. See [https://ice.work/](https://ice.work/). +## Rule Details + +Examples of **incorrect** code for this rule: + +```json +{ + "devDependencies": { + "ice.js": "^1.0.0" + } +} +``` + +Examples of **correct** code for this rule: + +```json +{ + "devDependencies": { + "ice-script": "^1.0.0" + } +} +``` diff --git a/packages/eslint-plugin-best-practices/docs/rules/deps-no-resolutions.md b/packages/eslint-plugin-best-practices/docs/rules/deps-no-resolutions.md new file mode 100644 index 000000000..1365d2dac --- /dev/null +++ b/packages/eslint-plugin-best-practices/docs/rules/deps-no-resolutions.md @@ -0,0 +1,17 @@ +# deps-no-resolutions + +It is not recommended to use resolutions to lock the version. + +## Rule Details + +Examples of **incorrect** code for this rule: + +```json +{ + "resolutions": { + "package-a": "1.0.0", + "package-b": "2.0.0", + "package-c": "3.5.2" + } +} +``` diff --git a/packages/eslint-plugin-best-practices/docs/rules/deps-no-router-library.md b/packages/eslint-plugin-best-practices/docs/rules/deps-no-router-library.md new file mode 100644 index 000000000..e116ee184 --- /dev/null +++ b/packages/eslint-plugin-best-practices/docs/rules/deps-no-router-library.md @@ -0,0 +1,16 @@ +# deps-no-router-library + +It is not recommended to directly rely on routing libraries, such as react-router-dom, react-router. + + +## Rule Details + +Examples of **incorrect** code for this rule: + +```json +{ + "dependencies": { + "react-router": "^5.2.0" + } +} +``` diff --git a/packages/eslint-plugin-best-practices/docs/rules/deps-recommend-update-rax.md b/packages/eslint-plugin-best-practices/docs/rules/deps-recommend-update-rax.md new file mode 100644 index 000000000..248df63d3 --- /dev/null +++ b/packages/eslint-plugin-best-practices/docs/rules/deps-recommend-update-rax.md @@ -0,0 +1,25 @@ +# deps-recommend-update-rax + +Rax version < 1.0 , recommend to update Rax. + +## Rule Details + +Examples of **incorrect** code for this rule: + +```json +{ + "dependencies": { + "rax": "^0.6.0" + } +} +``` + +Examples of **correct** code for this rule: + +```json +{ + "dependencies": { + "rax": "^1.1.0" + } +} +``` \ No newline at end of file diff --git a/packages/eslint-plugin-best-practices/docs/rules/no-broad-semantic-versioning.md b/packages/eslint-plugin-best-practices/docs/rules/no-broad-semantic-versioning.md new file mode 100644 index 000000000..667ce7829 --- /dev/null +++ b/packages/eslint-plugin-best-practices/docs/rules/no-broad-semantic-versioning.md @@ -0,0 +1,9 @@ +# no-broad-semantic-versioning + +package.json is not recommended to use *, x and > x in a wide range of semantic versioning. + +## Rule Details + +See [https://docs.npmjs.com/about-semantic-versioning](https://docs.npmjs.com/about-semantic-versioning). + +The package's semantic versioning with `*`, `x` and `> x` will be warned. diff --git a/packages/eslint-plugin-best-practices/docs/rules/no-js-in-ts-project.md b/packages/eslint-plugin-best-practices/docs/rules/no-js-in-ts-project.md new file mode 100644 index 000000000..e4ee4552d --- /dev/null +++ b/packages/eslint-plugin-best-practices/docs/rules/no-js-in-ts-project.md @@ -0,0 +1,25 @@ +# no-js-in-ts-project + +It is not recommended to use js and ts files at the same time + + +## Rule Details + +Examples of **incorrect** directory for this rule:(contains xx.js in ts project) + +```Bash +. +├── index.ts +├── home.js +└── tsconfig.json +``` + +Examples of **correct** code for this rule: + +```Bash +. +├── index.ts +├── home.ts +└── tsconfig.json +``` + diff --git a/packages/eslint-plugin-best-practices/docs/rules/no-lowercase-component-name.md b/packages/eslint-plugin-best-practices/docs/rules/no-lowercase-component-name.md new file mode 100644 index 000000000..f2c1f8cd6 --- /dev/null +++ b/packages/eslint-plugin-best-practices/docs/rules/no-lowercase-component-name.md @@ -0,0 +1,28 @@ +# no-lowercase-component-name + +It is not recommended to name components in lower case. +See: https://github.com/airbnb/javascript/tree/master/react#naming + +## Rule Details + +Examples of **incorrect** code for this rule: + +```jsx +// src/components/app/index.jsx +const app = () => { + return (

hello world

); +}; + +export default app; +``` + +Examples of **correct** code for this rule: + +```jsx +// src/components/App/index.jsx +const App = () => { + return (

hello world

); +}; + +export default App; +``` diff --git a/packages/eslint-plugin-best-practices/docs/rules/no-multi-nested-page.md b/packages/eslint-plugin-best-practices/docs/rules/no-multi-nested-page.md new file mode 100644 index 000000000..63d3367b4 --- /dev/null +++ b/packages/eslint-plugin-best-practices/docs/rules/no-multi-nested-page.md @@ -0,0 +1,30 @@ +# no-multi-nested-page + +Multiple nested pages are not recommended. + +## Rule Details + +Examples of **incorrect** code for this rule: + +```js +const App = () => { + return ( +
+