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

CssSyntaxError on Vue files after stylelint v14 upgrade #30

Open
jhonatan-lopes opened this issue Oct 11, 2023 · 0 comments
Open

CssSyntaxError on Vue files after stylelint v14 upgrade #30

jhonatan-lopes opened this issue Oct 11, 2023 · 0 comments

Comments

@jhonatan-lopes
Copy link

jhonatan-lopes commented Oct 11, 2023

After upgrading Wagtail-Kit's stylelint to version 14.X and stylelint-config-torchbox to version 2.0.3, Vue files started to spit out a CssSyntaxError. Running npm run lint:css (stylelint --report-needless-disables './wagtailkit_repo_name/static_src/sass' './wagtailkit_repo_name/static_src/javascript/vue_components'), we get:

wagtailkit_repo_name/static_src/javascript/vue_components/Hello.vue
 3:28  ✖  Unknown word  CssSyntaxError

1 problem (1 error, 0 warnings)

The problematic line contains the following:

    <p class="greeting">{{ greeting }} world</p>

It seems like other people have run into this before (stylelint/stylelint#5634 and stylelint/stylelint#3633) and their issues seemed to be related to stylelint's Vue configuration.

In fact, if we add a custom syntax rule for Vue files at .stylelintrc:

module.exports = {
    // See https://github.com/torchbox/stylelint-config-torchbox for rules.
    extends: 'stylelint-config-torchbox',
    overrides: [
        {
             // Ensure Vue files aren't treated solely as html or scss
            files: ["*.vue"],
            customSyntax: "postcss-html"
        },
    ],
};

and install/add postcss-html to our dev-dependencies, the error goes away.

Although the error started appearing after the v14 update, it is still present at stylelint v15 and the latest stylelint-config-torchbox versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant