2017-04-06 33 views
0

在gruntfilestylelint選擇器-BEM-圖案BEM棉短絨不工作

stylelint: { 
    all: ['app/styles/**/*.scss'] 
}, 

.stylelintrc

{ 
    "plugins": [ 
     "stylelint-selector-bem-pattern" 
    ], 
    "rules": { 
     "plugin/selector-bem-pattern": { 
     "componentName": "[A-Z]+", 
     "componentSelectors": { 
     "initial": "^\\.{componentName}(?:-[a-z]+)?$", 
     "combined": "^\\.combined-{componentName}-[a-z]+$" 
     }, 
     "utilitySelectors": "^\\.util-[a-z]+$" 
    } 
    } 
} 

/用戶/ jitendravyas/APP-測試/風格/組件/ _campaign - 設置 - 集成.scss

/* @define campaign-settings */ 

.campaign-settings__integrations { 
    @include flex; 
} 

.campaign-settings__integration { 
    border: 1px solid $color-green; 
    border-radius: 3px; 
    color: $color-green; 
    margin-right: $base-spacing-unit; 
    @include flex; 

    .check { 
    background: $color-green; 
    color: white; 
    @include vertical-center; 
    } 

    > div { 
    padding: $half-spacing-unit; 
    } 
} 

當我運行stylelint時沒有收到任何錯誤。 Stylelint正在處理其他規則。

回答

2

我相信你錯誤地定義了你的組件名稱。因此,linter正在跳過文件。

must use要麼一個簡潔詳細語法:

/** @define campaign-settings */ 

/* postcss-bem-linter: define campaign-settings */ 

此刻的你似乎使用簡潔的無效形式語法即你的評論從/*開始,而不是/**

+0

在你的第一個評論中,你的意思是文件名和組件名應該是一樣的嗎? –

+0

現在我在定義/ */** @define campaign-settings */*/plugin/selector-bem-pattern錯誤中得到'無效的組件名稱 –