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.

@rollup/plugin-eslint and vue compat issue

See original GitHub issue

Is your feature request related to a problem? Please describe.

@rollup/plugin-eslint correctly lints .vue files but also generates linting errors for virtual css files generated from SFCs.

Here is a repro starting from @vitejs/app vue https://github.com/matias-capeletto/vite-rollup-plugin-eslint

Errors during build

C:\vite-rollup-plugin-eslint\index.html
  13:8  error  clear  vue/comment-directive

C:\vite-rollup-plugin-eslint\vite\dynamic-import-polyfill
  37:3  error  '__VITE_IS_MODERN__' is not defined  no-undef

C:\vite-rollup-plugin-eslint\src\App.vue?vue&type=style&index=0&lang.css
  2:1  error  Parsing error: Unexpected character '#'

C:\vite-rollup-plugin-eslint\src\components\HelloWorld.vue?vue&type=style&index=0&scoped=true&lang.css
  2:3  error  Parsing error: Unexpected token {

During dev, only the last two are reported.

I tried using { ...eslint(), enforce: 'pre' } but it didn’t help. From the reported error, eslint may be interpreting that HelloWorld.vue?vue&type=style&index=0&scoped=true&lang.css is a .vue file instead of a .css

Additional context

vite version: 2.0.0-beta.29 Operating System: Windows 10 Home, 10.0.18363 N/A Build 18363 Node version: v15.5.0 Package manager and version: yarn v1.22.10

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
jcayzaccommented, Feb 12, 2021

I just tried using @rollup/plugin-eslint with the react-ts template, and it was linting the compiled files instead of the source files. Adding enforce: 'pre' fixed it.

1reaction
yyx990803commented, Jan 15, 2021

Btw we should link to your site in the rollup plugin compat section!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vite Rollup Plugins
A list of rollup plugins compatibility for Vite. ... Verify entry point and all imported files with ESLint. compatible.
Read more >
rollup-plugin-vue2 | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
getboarded-functionality - npm package - Snyk
What is getboarded-functionality? BootstrapVue, with over 40 plugins and more than 75 custom components, provides one of the most comprehensive ...
Read more >
Plugins - Vite
Before searching for a Vite or Compatible Rollup plugin, check out the Features Guide. ... Provides Vue 3 JSX support (via dedicated Babel...
Read more >
@rollup/plugin-eslint - npm
Verify entry point and all imported files with ESLint. Latest version: 9.0.1, last published: 2 months ago.
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