Skip to content

Rule Proposal: sfc-language #1458

Closed
@gewoonwoutje

Description

@gewoonwoutje

Please describe what the rule should do:

Limit the languages used in all Vue SFC files for template, script and style blocks.

What category should the rule belong to?

[ ] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ X] Other (please specify:)
Enforces code language.

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

{
   "script": "ts",
// "style": "scss",
// "template": "whatever",
}
// SomeComponent.vue

// Error: Missing attribute `lang="ts"`
<script>
// Error: Wrong lang attribute, expected `lang="ts"`
<script lang="js">

// Correct
<script lang="ts">

Additional context

We're using Typescript and Vue SFC files, but it is very easy to create a new component file and forget to add a lang="ts" attribute to the script tag, and missing out on some type checking.

We also use <style lang="scss">.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions