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.

<style> block is treated as JS

See original GitHub issue

Hi,

After upgrading to eslint-plugin-vue v3 and finally figuring out to turn off eslint-plugin-html , I got some max-lenerrors in style block - mostly background rules.

Is this expected that eslint-plugin-vue will lint CSS?

ESLint version: 4.4.1 eslint-plugin-vue: 3.11.0 vue-eslint-parser: 2.0.0-beta.6

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mysticateacommented, Aug 14, 2017

Thank you for this issue.

However, this is one of known limitations. The rule checks source code texts instead of AST trees, so lines which are on outside of <script> causes max-len errors.

There is no workaround for now. I can refactor the rule as using AST instead of texts.

As a side note, this plugin uses a different mechanism to eslint-plugin-html.

  • eslint-plugin-html is using preprocessors. It transforms source codes before parsers and rules use the source codes. In eslint-plugin-html case, it extracts only inside of <script>, then parsers and rules use it.
  • eslint-plugin-vue does not use the preprocessor. This parser parses whole source code of .vue files and rules use the whole source code. If eslint-plugin-vue uses the preprocessors, it removes outside of <script>, this parser cannot generate AST of <template>, so eslint-plugin-vue cannot use the preprocessors.
0reactions
msokkcommented, Aug 14, 2017

Thanks for clarifying. I only got max-len errors and most of the affected rules can be spread over multiple lines and with airbnb config long urls are ignored. So overall I easily fixed those few max-len ones.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript: Element style.display = 'block' is not working
For some reason, the CSS was overriding the JavaScript. Would like to know why. Solved. var textAreaDiv1 = document.
Read more >
JavaScript-Based Style Sheets - W3C
With a value of 'left' or 'right', the element is treated as block-level (so, e.g. the 'text-align' property can be set). This property...
Read more >
Custom Block Rendering - Draft.js
This article discusses how to customize Draft default block rendering. ... by the block rendering mapping will be treated as unstyled ...
Read more >
Block Manager - GrapesJS
Avoid non serializable properties; Avoid styles ... By default, Block Manager UI is considered a hidden component.
Read more >
display - CSS: Cascading Style Sheets - MDN Web Docs
The display CSS property sets whether an element is treated as a block or inline element and the layout used for its children,...
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