Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 启用lint时 stylelint不会按照预期工作 #12072

Closed
shen774411223d opened this issue Jan 17, 2024 · 5 comments
Closed

[Bug] 启用lint时 stylelint不会按照预期工作 #12072

shen774411223d opened this issue Jan 17, 2024 · 5 comments

Comments

@shen774411223d
Copy link

umijs官网初始化好项目之后(single-app) 按照文档中的编码规范章节配置eslint和stylelint。然后执行umi lint命令

// .stylelintrc.js
module.exports = {
  extends: require.resolve('umi/stylelint'),
};
// index.less
.box {width: 20px;}

执行umi lint命令会报错:
Unknown rule at-rule-name-case at-rule-name-case
1:1 ✖ Unknown rule at-rule-name-space-after at-rule-name-space-after
1:1 ✖ Unknown rule at-rule-semicolon-newline-after at-rule-semicolon-newline-after
1:1 ✖ Unknown rule block-closing-brace-empty-line-before block-closing-brace-empty-line-before
1:1 ✖ Unknown rule block-closing-brace-newline-after block-closing-brace-newline-after
1:1 ✖ Unknown rule block-closing-brace-newline-before block-closing-brace-newline-before
1:1 ✖ Unknown rule block-closing-brace-space-before block-closing-brace-space-before
1:1 ✖ Unknown rule block-opening-brace-newline-after block-opening-brace-newline-after
1:1 ✖ Unknown rule block-opening-brace-space-after block-opening-brace-space-after
1:1 ✖ Unknown rule block-opening-brace-space-before block-opening-brace-space-before
1:1 ✖ Unknown rule color-hex-case. Did you mean color-hex-alpha, color-hex-length? color-hex-case
1:1 ✖ Unknown rule declaration-bang-space-after declaration-bang-space-after
1:1 ✖ Unknown rule declaration-bang-space-before declaration-bang-space-before
1:1 ✖ Unknown rule declaration-block-semicolon-newline-after declaration-block-semicolon-newline-after
1:1 ✖ Unknown rule declaration-block-semicolon-space-after declaration-block-semicolon-space-after
1:1 ✖ Unknown rule declaration-block-semicolon-space-before declaration-block-semicolon-space-before
1:1 ✖ Unknown rule declaration-block-trailing-semicolon declaration-block-trailing-semicolon
1:1 ✖ Unknown rule declaration-colon-newline-after declaration-colon-newline-after
1:1 ✖ Unknown rule declaration-colon-space-after declaration-colon-space-after
1:1 ✖ Unknown rule declaration-colon-space-before declaration-colon-space-before
1:1 ✖ Unknown rule function-comma-newline-after function-comma-newline-after
1:1 ✖ Unknown rule function-comma-space-after function-comma-space-after
1:1 ✖ Unknown rule function-comma-space-before function-comma-space-before
1:1 ✖ Unknown rule function-max-empty-lines function-max-empty-lines
1:1 ✖ Unknown rule function-parentheses-newline-inside function-parentheses-newline-inside
1:1 ✖ Unknown rule function-parentheses-space-inside function-parentheses-space-inside
1:1 ✖ Unknown rule function-whitespace-after function-whitespace-after
1:1 ✖ Unknown rule indentation indentation
1:1 ✖ Unknown rule max-empty-lines max-empty-lines
1:1 ✖ Unknown rule max-line-length max-line-length
1:1 ✖ Unknown rule media-feature-colon-space-after media-feature-colon-space-after
1:1 ✖ Unknown rule media-feature-colon-space-before media-feature-colon-space-before
1:1 ✖ Unknown rule media-feature-name-case media-feature-name-case
1:1 ✖ Unknown rule media-feature-parentheses-space-inside media-feature-parentheses-space-inside
1:1 ✖ Unknown rule media-feature-range-operator-space-after media-feature-range-operator-space-after
1:1 ✖ Unknown rule media-feature-range-operator-space-before media-feature-range-operator-space-before
1:1 ✖ Unknown rule media-query-list-comma-newline-after media-query-list-comma-newline-after
1:1 ✖ Unknown rule media-query-list-comma-space-after media-query-list-comma-space-after
1:1 ✖ Unknown rule media-query-list-comma-space-before media-query-list-comma-space-before
1:1 ✖ Unknown rule no-empty-first-line no-empty-first-line
1:1 ✖ Unknown rule no-eol-whitespace no-eol-whitespace
1:1 ✖ Unknown rule no-missing-end-of-source-newline no-missing-end-of-source-newline
1:1 ✖ Unknown rule number-leading-zero number-leading-zero
1:1 ✖ Unknown rule number-no-trailing-zeros number-no-trailing-zeros
1:1 ✖ Unknown rule property-case property-case
1:1 ✖ Unknown rule selector-attribute-brackets-space-inside selector-attribute-brackets-space-inside
1:1 ✖ Unknown rule selector-attribute-operator-space-after selector-attribute-operator-space-after
1:1 ✖ Unknown rule selector-attribute-operator-space-before selector-attribute-operator-space-before
1:1 ✖ Unknown rule selector-combinator-space-after selector-combinator-space-after
1:1 ✖ Unknown rule selector-combinator-space-before selector-combinator-space-before
1:1 ✖ Unknown rule selector-descendant-combinator-no-non-space selector-descendant-combinator-no-non-space
1:1 ✖ Unknown rule selector-list-comma-newline-after selector-list-comma-newline-after
1:1 ✖ Unknown rule selector-list-comma-space-before selector-list-comma-space-before
1:1 ✖ Unknown rule selector-max-empty-lines selector-max-empty-lines
1:1 ✖ Unknown rule selector-pseudo-class-case selector-pseudo-class-case
1:1 ✖ Unknown rule selector-pseudo-class-parentheses-space-inside selector-pseudo-class-parentheses-space-inside
1:1 ✖ Unknown rule selector-pseudo-element-case selector-pseudo-element-case
1:1 ✖ Unknown rule string-quotes string-quotes
1:1 ✖ Unknown rule unit-case unit-case
1:1 ✖ Unknown rule value-list-comma-newline-after value-list-comma-newline-after
1:1 ✖ Unknown rule value-list-comma-space-after value-list-comma-space-after
1:1 ✖ Unknown rule value-list-comma-space-before value-list-comma-space-before
1:1 ✖ Unknown rule value-list-max-empty-lines value-list-max-empty-lines
1:1 ✖ Unknown rule no-extra-semicolons no-extra-semicolons
1:1 ✖ Unknown rule linebreaks linebreaks
1:1 ✖ Unknown rule at-rule-name-newline-after at-rule-name-newline-after
1:1 ✖ Unknown rule at-rule-semicolon-space-before at-rule-semicolon-space-before
1:1 ✖ Unknown rule block-closing-brace-space-after block-closing-brace-space-after
1:1 ✖ Unknown rule block-opening-brace-newline-before block-opening-brace-newline-before
1:1 ✖ Unknown rule declaration-block-semicolon-newline-before declaration-block-semicolon-newline-before
1:1 ✖ Unknown rule function-comma-newline-before function-comma-newline-before
1:1 ✖ Unknown rule media-query-list-comma-newline-before media-query-list-comma-newline-before
1:1 ✖ Unknown rule selector-list-comma-newline-before selector-list-comma-newline-before
1:1 ✖ Unknown rule selector-list-comma-space-after selector-list-comma-space-after
1:1 ✖ Unknown rule unicode-bom unicode-bom
1:1 ✖ Unknown rule value-list-comma-newline-before

Copy link

由于缺乏足够的信息,我们暂时关闭了该 Issue。请修改(不要回复) Issue 提供最小重现以重新开启。谢谢。

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2024
@fz6m
Copy link
Contributor

fz6m commented Jan 18, 2024

因为 stylelint 大版本迭代的比较快,现在 umi lint 支持的是 stylelint v14 版本的,安装 ^14.0.0 版本的 stylelint 就可以了:

  "stylelint": "^14.0.0"

当仅需要检查样式文件时,可以使用:

  pnpm umi lint --stylelint-only

@60late
Copy link
Contributor

60late commented Jan 18, 2024

因为 stylelint 大版本迭代的比较快,现在 umi lint 支持的是 stylelint v14 版本的,安装 ^14.0.0 版本的 stylelint 就可以了:

  "stylelint": "^14.0.0"

当仅需要检查样式文件时,可以使用:

  pnpm umi lint --stylelint-only

官方文档里更新一下把,我和这位老哥一样的问题,都快砸键盘了

@fz6m
Copy link
Contributor

fz6m commented Jan 19, 2024

目测有这个问题的是少数的,因为初始化 max 项目的是自带了 stylelint v14 ,而 ant-pro 的用户都是 max 项目,只有使用 umi 项目的,并且自己手动添加了 stylelint 才会发生这个问题。

欢迎 PR 在文档添加对 stylelint 版本要求的说明。

@fz6m fz6m reopened this Jan 19, 2024
@60late
Copy link
Contributor

60late commented Jan 19, 2024

@fz6m 已提pr #12084

@fz6m fz6m closed this as completed Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants