Coder Social home page Coder Social logo

Comments (6)

hackyoMa avatar hackyoMa commented on May 25, 2024 1

No, what I need is to exclude.
I tried "exclude: ['uno.css']" and it didn't work
Now it works, thank you!

from vite-plugin-stylelint.

ModyQyW avatar ModyQyW commented on May 25, 2024

Can you please provide a minimal reproduction?

from vite-plugin-stylelint.

hackyoMa avatar hackyoMa commented on May 25, 2024

---init---
npm create vite@latest my-vue-app -- --template vue-ts
cd my-vue-app && npm install
npm install --save-dev stylelint stylelint-config-standard vite-plugin-stylelint unocss

---vite.config.ts---
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Unocss from 'unocss/vite'
import StylelintPlugin from 'vite-plugin-stylelint'
export default defineConfig({
plugins: [
vue(),
StylelintPlugin(),
Unocss()
]
})

---.stylelintrc.json---
{
"extends": "stylelint-config-standard",
"ignoreFiles": ["**/*.vue"]
}

---main.ts---
import 'uno.css'

from vite-plugin-stylelint.

ModyQyW avatar ModyQyW commented on May 25, 2024

I don't know how to lint virtual files like uno.css or __uno.css because they actully not exist. One solution is to set exclude.

// vite.config.ts
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import Unocss from "unocss/vite";
import StylelintPlugin from "vite-plugin-stylelint";

export default defineConfig({
  plugins: [
    vue(),
    StylelintPlugin({
      exclude: [/node_modules/, /uno\.css/],
    }),
    Unocss(),
  ],
});

PR welcome if you have better solution.

EDIT: IMO virtual files should be linted.

from vite-plugin-stylelint.

ModyQyW avatar ModyQyW commented on May 25, 2024

I think I need to pin this. I actually know little about virtual modules. 😅

from vite-plugin-stylelint.

ModyQyW avatar ModyQyW commented on May 25, 2024

v2.3.0 released. The plugin ignores virtual modules by default now. Open a new issue if someone is still facing this problem.

from vite-plugin-stylelint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.