首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在github/super中运行Stylelint (SCSS)会忽略配置。

在github/super中运行Stylelint (SCSS)会忽略配置。
EN

Stack Overflow用户
提问于 2022-01-14 15:29:13
回答 1查看 934关注 0票数 1

希望有人能帮我解决一个奇怪的bug/问题,我一直有与手写+github/超级链接。我还在回购中添加了一个问题,因为我认为我已经尝试了很多事情,它似乎是一个错误,但也许这是一个配置问题,在我的一端。

我已经尝试将我们的多个项目迁移到V14上已经有一段时间了,但是我似乎无法让它适应我们的Github操作工作流。它以前在V13上很有效。

在本地,当运行像:npm run stylelint这样的命令时,它会很好地工作,它会返回预期的错误,但是当运行Github的超级链接操作时,结果似乎忽略了我们的自定义规则,并抱怨它需要一个customSyntax。我增加了那些作为测试,但到目前为止没有运气。

我已经建立了一个带有PR的演示存储库,它可以触发样式表来模拟这个问题:focus=true

需要什么Stylelint配置才能重现该bug?

代码语言:javascript
复制
{
  "extends": ["stylelint-config-standard-scss"],
  "customSyntax": "postcss-scss",
  "rules": {
    "selector-class-pattern": null
  }
}

也尝试了没有"customSyntax“,但它似乎没有改变任何事情。

我的超级链接配置:

代码语言:javascript
复制
name: PR Linter

#############################
# Start the job on all push #
#############################
on:
  push:
    branches-ignore: [main]
    # Remove the line above to run when pushing to master

###############
# Set the Job #
###############
jobs:
  build:
    # Name the Job
    name: Lint Code Base
    # Set the agent to run on
    runs-on: ubuntu-latest

    ##################
    # Load all steps #
    ##################
    steps:
      ##########################
      # Checkout the code base #
      ##########################
      - name: Checkout Code
        uses: actions/checkout@v2
        with:
          # Full git history is needed to get a proper list of changed files within `super-linter`
          fetch-depth: 0

      ################################
      # Run Linter against code base #
      ################################
      - name: Lint Code Base
        uses: docker://github/super-linter:v4
        env:
          VALIDATE_ALL_CODEBASE: false
          VALIDATE_CSS: true
          DEFAULT_BRANCH: main
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

你是怎么管理斯泰林的?

运行槽github /超级链接作为github动作

你用的是哪种版本的施泰林特?

“^14.2.0”

你以为会发生什么?

我希望我的自定义规则能够应用,而Expected class selector to be kebab-case selector-class-pattern不会出现类似于我在本地运行的样式表输出的方式。

到底发生了什么?

如果我运行npm run stylelint,就会得到:

代码语言:javascript
复制
> lintertest@0.1.0 stylelint
> stylelint "**/*.scss"

scss/test.scss
 4:3  ✖  Expected shorthand property "flex-flow"  declaration-block-no-redundant-longhand-properties

但是,当它在GitHub超级链接中运行时,相同的命令提供给我:

代码语言:javascript
复制
2022-01-14 14:36:24 [ERROR]   Found errors in [stylelint] linter!
2022-01-14 14:36:24 [ERROR]   Error code: 2. Command output:
------
/github/workspace/scss/test.scss: When linting something other than CSS, you should install an appropriate syntax, e.g. "postcss-scss", and use the "customSyntax" option

scss/test.scss
1:1  ✖  Expected class selector to be kebab-case  selector-class-pattern                            
5:1  ✖  Expected class selector to be kebab-case  selector-class-pattern                            
8:3  ✖  Expected shorthand property "flex-flow"   declaration-block-no-redundant-longhand-properties
------

希望任何人在使用SCSS皮棉槽针和github/ stylelint时都有类似的行为。

EN

回答 1

Stack Overflow用户

发布于 2022-12-02 05:24:03

这也困扰着我。

在我的例子中,这是因为我有Stylelint (.stylelintrc.json)在回购根。GitHub Actions 期待.github/linters/.stylelintrc.json中。

如果要指定配置所在的位置,可以通过环境变量LINTER_RULES_PATH设置它。

请参阅更多细节这里

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70712920

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档