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.

When linting something other than CSS, you should install an appropriate syntax, e.g. "postcss-less", and use the "customSyntax" option

See original GitHub issue

What steps are needed to reproduce the bug?

package.json:

{
  "name": "123",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "postcss": "^8.4.14",
    "postcss-html": "^1.5.0",
    "postcss-less": "^6.0.0",
    "stylelint": "^14.9.1",
    "stylelint-config-recess-order": "^3.0.0",
    "stylelint-config-recommended-vue": "^1.4.0",
    "stylelint-config-standard": "^26.0.0"
  }
}

color.less:

@primary:   #03b9f3;
@base-text-color:   #E7F9FF;

What Stylelint configuration is needed to reproduce the bug?

module.exports = {
  root: true,
  extends: [
    'stylelint-config-standard',
    'stylelint-config-recess-order',
    'stylelint-config-recommended-vue',
  ],
  overrides: [
    {
      files: '**/*.less',
      customSyntax: 'postcss-less',
    },
    {
      files: '**/*.vue',
      customSyntax: 'postcss-html',
    },
  ],
  rules: {
    indentation: 2,
    'at-rule-no-unknown': [
      true,
      {
        ignoreAtRules: ['mixin', 'extend', 'content', 'include'],
      },
    ],
    'selector-pseudo-class-no-unknown': [
      true,
      {
        ignorePseudoClasses: ['deep'],
      },
    ],
    'function-no-unknown': [true, {
      ignoreFunctions: ['if'],
    }],
  },
};

How did you run Stylelint?

Use vscode plug-in or run scripts to format

Which version of Stylelint are you using?

14.19.1

What did you expect to happen?

There are no warnings and the code is formatted normally

What actually happened?

Whenever I tried to save and format, he warned me

image

Does the bug relate to non-standard syntax?

Less

Proposal to fix the bug

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JounQincommented, Jul 21, 2022

The should be related to vscode-stylelint does not support pnpm well, you can try to use public-hoist-pattern[]=*stylelint* in you project level .npmrc and run pnpm install to install, then reload vscode.

1reaction
Chen-913commented, Jul 21, 2022

@ybiquitous Thank you very much for your suggestions. I prefer the customization of stylelint’s personalized rules, which is much freer than Prettier

Should I close this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

stylelint for less - The "syntax" option is no longer available
You should install an appropriate syntax, e.g. postcss-scss, and use the "customSyntax" option "lint:style": "stylelint --fix \"src/**/*.les ...
Read more >
Migrating to 14.0.0 - Stylelint
If you use Stylelint to lint anything other than CSS files, you will need to ... the appropriate PostCSS syntax yourself and use...
Read more >
Unknown Word on SCSS mixin function using Stylelint
When linting something other than CSS, you should install an appropriate syntax, e.g."postcss-scss", and use the "customSyntax" option.
Read more >
Stylelint - Nova Extensions - Panic Inc.
Even if you don't explicitly install or configure custom syntax modules, you're almost certainly using them whenever linting non-CSS files. Additionally, while ...
Read more >
stylelint | Yarn - Package Manager
A mighty, modern linter that helps you avoid errors and enforce conventions in your ... has over 170 built-in rules for modern CSS...
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