question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[vue2/3]<style lang="postcss">

See original GitHub issue

when the language is explicitly specified, the linter does not want to work, how can I fix it? i am using Vue Single-File Component (SFC)

linter not work image all done 😥 image

vscode.setting


  // stylelint
  "stylelint.enable": true,
  "stylelint.autoFixOnSave": true,
  "stylelint.useLocal": true,
  "stylelint.validate": ["vue", "postcss", "pcss", "css"],

  "stylelint.packageManager": "yarn",
  // "stylelint.validate": [
  //   "css",
  //   "postcss"
  // ],
  "stylelint.snippet": ["css", "postcss"],
  "stylelint.customSyntax": "postcss-html",
  "stylelint.configFile": "stylelint.config.js"

  // "volar.style.defaultLanguage": "postcss",
  // "tailwindCSS.validate": true

stylelint.config.js

module.exports = {
  extends: [
    'stylelint-config-standard',
    'stylelint-config-prettier',
    'stylelint-config-html/vue',
    'stylelint-config-html',
    'stylelint-config-recommended-vue',
  ],
  overrides: [
    {
      files: ['**/*.vue'],
      customSyntax: 'postcss-html',
    },
  ],

  rules: {
    'color-function-notation': 'modern',
    'at-rule-semicolon-newline-after': null,
    'block-closing-brace-empty-line-before': null,
    'block-closing-brace-newline-after': 'never-single-line',
    'block-no-empty': null,
    'comment-empty-line-before': null,
    'declaration-block-semicolon-newline-after': null,
    'declaration-colon-space-after': 'always-single-line',
    'declaration-colon-space-before': 'never',
    'function-parentheses-space-inside': null,
    indentation: null,
    'media-feature-colon-space-after': null,
    'media-feature-colon-space-before': null,
    'media-feature-range-operator-space-after': 'never',
    'media-feature-range-operator-space-before': 'never',
    'named-grid-areas-no-invalid': null,
    'no-empty-source': null,
    'no-eol-whitespace': null,
    'rule-empty-line-before': null,
    'string-quotes': 'single',
    'at-rule-no-unknown': [
      true,
      {
        ignoreAtRules: [
          'for',
          'if',
          'else',
          'each',
          'mixin',
          'custom-media',
          'define-mixin',
          'include',
          'media',
          'rgba',
        ],
      },
    ],
    'property-no-unknown': [
      true,
      {
        ignoreProperties: ['user-drag'],
      },
    ],
  },
};

.stylelintignore

node_modules
node_modules/
static/
build/
assets/scss/vendors/
assets/scss/templates/
.output/
dist/
bin/
obj/

*.*
!*.vue
!*.html
!*.postcss
!*.pcss 
!*.css 

Clearly describe the bug

e.g. “There are false positives for two leading zeros when …”

Which rule, if any, is the bug related to?

e.g. number-leading-zero

What code is needed to reproduce the bug?

e.g.

a {
  width: 00.1em;
}

What Stylelint configuration is needed to reproduce the bug?

e.g.

{
  "rules": {
    "number-leading-zero": "always"
  }
}

Which version of Stylelint are you using?

e.g. 9.2.0

How are you running stylelint: CLI, PostCSS plugin, Node.js API?

e.g. “CLI with stylelint "**/*.css" --config myconfig.json

Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?

e.g. “Yes, it’s related to SCSS nested properties.”

What did you expect to happen?

e.g. “No warnings to be flagged.”

What actually happened (e.g. what warnings or errors did you get)?

e.g. “The following warnings were flagged:”

test.css
2:4    Expected a leading zero (number-leading-zero)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ybiquitouscommented, Oct 28, 2021

Ah, sorry. I missed it. 😅

0reactions
thisVioletHydracommented, Oct 28, 2021

Please raise your issue in the postcss-html issue tracker.

Please raise your issue in the postcss-html issue tracker.

where is postcss-html? If I show the screenshot above, the errors are not showing in vscode. everything works in the CLI of the console. then the problem is in stylint

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using <style lang="postcss"> in Vue Component leads to error
I have the following Vue component: Test The style is applied and all is good. But I would like to use.
Read more >
PostCSS - vue-loader
Since vue-loader handles PostCSS on its styles internally, you only need to apply postcss-loader to standalone CSS files. There's no need to specify...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found