ice icon indicating copy to clipboard operation
ice copied to clipboard

icejs 与 f2elint 深度结合

Open guoyunhe opened this issue 3 years ago • 1 comments

What is the current behavior? 发生了什么?

当前 ice 项目初始化之后,ESLint 和 Stylelint 相关的 scripts 为:

{
  "scripts": {
    "lint": "npm run eslint && npm run stylelint",
    "eslint": "eslint --cache --ext .js,.jsx,.ts,.tsx ./",
    "eslint:fix": "npm run eslint -- --fix",
    "stylelint": "stylelint \"**/*.{css,scss,less}\""
  }
}

而 f2elint 的 scripts 为:

{
  "scripts": {
    "f2elint-scan": "f2elint scan",
    "f2elint-fix": "f2elint fix"
  }
}

相比 f2elint 方案,ice 的 lint/format 命令有以下不足:

  1. 命令过于复杂,参数多
  2. 需要运行两个命令才能完整检查 eslint 和 stylelint
  3. 不支持 stylelint 自动修复
  4. 不支持 Prettier 格式化全部文件
  5. 缺少 .vscode/settings.json 和 .vscode/extensions.json

What is the expected behavior? 期望的结果是什么?

对标 f2elint 提供两个新的命令

  1. icejs lint - 检查 eslint 和 stylelint 问题
  2. icejs format - 使用 prettier,eslint fix 和 stylelint fix 自动修复代码中的问题

复用 f2elint 提供的 vscode 配置

  1. .vscode/extensions.json
  2. .vscode/settings.json

Any additional comments? 相关环境信息?

  • ice.js Version
  • build.json Configuration
  • Node Version:
  • Platform:

guoyunhe avatar Feb 23 '22 03:02 guoyunhe

请问icejs stylelint如何验证styled-components?icejs初始化后不支持

"scripts": {
    "start": "icejs start",
    "build": "icejs build",
    "build:dev": "icejs build",
    "i18n": "yarn i18n:extract && yarn i18n:compile",
    "i18n:extract": "lingui extract --clean",
    "i18n:compile": "lingui compile --strict",
    "lint": "yarn eslint && yarn stylelint",
    "eslint": "eslint --cache --ext .js,.jsx,.ts,.tsx ./",
    "eslint:fix": "yarn eslint -- --fix",
    "stylelint": "stylelint \"**/*.{css,scss,less}\"",
    "prettier": "prettier --write '@(src)/**/*.@(ts|tsx)'"
  },

usercao avatar Mar 03 '22 08:03 usercao

首先,icejs 框架默认不耦合 lint 的方案 / 命令,这不是框架核心提供的能力,开发者可以自行选择。

模板上我们现在默认使用了 eslint/stylelint + @iceworks/spec,当然如果 f2elint 更好,模板上可以增加上。

luhc228 avatar Sep 19 '22 03:09 luhc228