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

Rule proposal: vue/no-inline-styles #826

Closed
1 of 4 tasks
cde06 opened this issue Feb 21, 2019 · 1 comment · Fixed by #843
Closed
1 of 4 tasks

Rule proposal: vue/no-inline-styles #826

cde06 opened this issue Feb 21, 2019 · 1 comment · Fixed by #843

Comments

@cde06
Copy link

cde06 commented Feb 21, 2019

Please describe what the rule should do:

This rule detect inline styles in components.
It's (subjectively) a good practice to separate styles from the view layout, when possible. This rule detects static inline style objects when they contain literal values. v-bind:style and :style are acceptable because it's sometimes necessary to set styles based on data, computed property or methods result.

What category should the rule belong to?

  • Enforces code style
  • Warns about a potential error
  • Suggests an alternate way of doing something
  • Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

The following pattern is considered a warning:

<span style="background-color: #FFF">Hello {{ name }}</span>;

The following patterns are not considered a warning::

<span :style="background-color: color }">Hello {{ name }}</span>;
<span v-bind:style="background-color: color }">Hello {{ name }}</span>;

Additional context
The rule enforce team members to use SFC <style scope> instead of inline style attributes.

@cpphen
Copy link

cpphen commented Sep 19, 2019

Is this feature almost ready?

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

Successfully merging a pull request may close this issue.

3 participants