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

chore(web stack): add new ESLint Vue rules #5 #7736

Merged
merged 2 commits into from
Jun 17, 2024
Merged

Conversation

ByScripts
Copy link
Contributor

@ByScripts ByScripts commented Jun 10, 2024

Description

  • Better ESLint configuration for Core/6/Lite projects.

  • Group rules by sections

  • Reorder rules alphabetically

  • Updated no-void rules to re-enable it, while allowing void as statement

  • Changed "Vue 3 Recommended" rules from warn to error

  • vue/attribute-hyphenation

    Enforces the use of hyphenated attribute names in templates.

  • vue/component-definition-name-casing

    Ensures PascalCase casing for component definition names.

  • vue/first-attribute-linebreak

    Enforces the location of the first attribute on a new line when multiline.

  • vue/html-closing-bracket-newline

    Enforces a newline before the closing bracket in a multiline element.
    Forbids a newline before the closing bracket in a singleline element.

  • vue/html-closing-bracket-spacing (disabled, conflicts with Prettier)

    Enforces spacing before > in self-closing tag (e.g. ✅ <div />, ❌ <div/>)
    Forbids spacing before > in other tags (e.g. ✅ <div>, ❌ <div >)

  • vue/html-end-tags

    Enforces end tags in templates.

  • vue/html-indent (disabled, conflicts with Prettier)

    Enforces consistent indentation in <template>.

  • vue/html-quotes

    Enforces double-quotes for HTML attributes.

  • vue/html-self-closing

    Enforces self-closing style for empty components and HTML elements (e.g. ✅ <MyComponent />)
    Forbid self-closing style for void elements (e.g. ✅ <img>, ❌ <img />)

  • vue/max-attributes-per-line ({ singleline: 3, multiline: 1 }) (disabled, conflicts with Prettier)

    Limits the number of attributes per line to improve readability.

  • vue/multiline-html-element-content-newline

    Requires a line break before and after the content of multiline elements.

  • vue/mustache-interpolation-spacing

    Enforces 1 space around mustache interpolations (e.g. ✅ {{ foo }}, ❌ {{foo}})

  • vue/no-multi-spaces

    Disallows multiple spaces in templates (e.g. ✅ <div class="x">, ❌ <div class="x">)

  • vue/no-spaces-around-equal-signs-in-attribute

    Disallows spaces around equal signs in attribute assignments (❌ <div class = "x">)

  • vue/no-template-shadow

    Prevents variable declarations from shadowing variables declared in the outer scope in template

    <!-- ✅ -->
    <div v-for="foo of x">
        <div v-for="bar of y" />
    </div>
    
    <!-- ❌ -->
    <div v-for="foo of x">
        <div v-for="foo of y" />
    </div>
  • vue/prop-name-casing

    Enforces camelCase naming for props.

  • vue/require-explicit-emits

    Requires explicitly defining emitted events in a component.

  • vue/require-prop-types

    Requires type definitions in props.

  • vue/v-bind-style

    Enforces short v-bind directive style (✅ :foo="foo", ❌ v-bind:foo="foo").

  • vue/v-on-event-hyphenation

    Enforces hyphenated naming style for custom event names in v-on.

  • vue/v-on-style

    Enforces short v-on directive style (✅ @foo="handle()", ❌ v-on:foo="handle()").

  • vue/v-slot-style

    Enforces consistent v-slot directive style.

  • vue/attributes-order

    Enforces a specific order for attributes.

  • vue/no-lone-template

    Disallows unnecessary <template> tags.

    <template>
      <div>
        Foo
        <!---->
        <template>
          Bar
        </template>
      </div>
    </template>
  • vue/no-multiple-slot-args

    Disallows multiple slot arguments

  • vue/no-v-html

    Disallows the use of v-html to prevent XSS vulnerabilities.

  • vue/this-in-template

    Disallows usage of this in templates.

Checklist

  • Commit
    • Title follows commit conventions
    • Reference the relevant issue (Fixes #007, See xoa-support#42, See https://...)
    • If bug fix, add Introduced by
  • Changelog
    • If visible by XOA users, add changelog entry
    • Update "Packages to release" in CHANGELOG.unreleased.md
  • PR
    • If UI changes, add screenshots
    • If not finished or not tested, open as Draft

@ByScripts ByScripts force-pushed the eslint-vue-rules-5 branch from 7f631e8 to 851e43c Compare June 10, 2024 14:42
@ByScripts ByScripts force-pushed the eslint-vue-rules-4 branch from 5d311f7 to a88b3a0 Compare June 17, 2024 14:45
Base automatically changed from eslint-vue-rules-4 to master June 17, 2024 14:48
@ByScripts ByScripts force-pushed the eslint-vue-rules-5 branch from 851e43c to a58cfec Compare June 17, 2024 14:50
@ByScripts ByScripts marked this pull request as ready for review June 17, 2024 14:55
@ByScripts
Copy link
Contributor Author

@pdonias @MathieuRA Can you merge? Thanks.

@pdonias pdonias merged commit e1dd535 into master Jun 17, 2024
1 check passed
@pdonias pdonias deleted the eslint-vue-rules-5 branch June 17, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants