The command to fix Eslint is not able to resolve all of the errors related to vue/html-indent

In my .eslintrc.js file, I have set up some linting rules as shown below:

module.exports = {
  root: true,
  env: {
    browser: true,
    es6: true,
    node: true,
  },
  extends: ['plugin:vue/recommended', 'eslint:recommended'],
  parserOptions: {
    parser: 'babel-eslint',
  },
  rules: {
    // various linting rules here
  },
}

These rules are also reflected in my workspace settings:

{
  // workspace settings here
}

When I save and format the file, everything works fine. However, when I run the command

eslint --fix --ext js,vue src

The lint warnings and errors are shown, but the vue/html-indent rule is not being followed.

  1. Initial component structure:
<transition
        // component structure
</transition>

  1. Formatted component structure:
<transition
        // formatted component
</transition>

  1. Linted component structure:
<transition
        // linted component structure
</transition>

I need help in fixing the vue/html-indent errors during linting. How can I achieve this using the vetur/eslint format from the command line?

Answer №1

Here is my custom configuration for ESLint in the .eslintrc.js file:

module.exports = {
  root: true,
  env: {
    node: true,
    browser: true,
  },
  extends: ['plugin:vue/essential', 'plugin:prettier/recommended', '@vue/prettier'],
  rules: {
    'eqeqeq': 'off',
    'no-plusplus': 'off',
    "no-return-assign": "off",
    'max-len': ['error', { code: 120, ignoreUrls: true, ignoreComments: true }],
    'linebreak-style': 0,
    'vue/max-attributes-per-line': 'off',
    'vue/component-name-in-template-casing': ['error', 'PascalCase'],
    'no-console': 'off',
    'no-restricted-syntax': [
      'error',
      {
        selector:
          "CallExpression[callee.object.name='console'][callee.property.name!=/^(log|warn|error|info|trace)$/]",
        message: 'Unexpected property on console object was called',
      },
    ],
  },
  parserOptions: {
    parser: 'babel-eslint',
  },
};

Additionally, I have my preferences set in the .prettierrc file:

{
  "semi": true,
  "tabWidth": 2,
  "useTabs": false,
  "printWidth": 100,
  "singleQuote": true,
  "editor.insertSpaces": true,
  "trailingComma": "all",
  "bracketSpacing": true,
  "jsxBracketSameLine": true,
  "arrowParens": "always"
}

Moreover, my Vue project is configured in the vue.config.js file:

module.exports = {
  devServer: {
    host: '0.0.0.0',
    port: 3201,
    https: false,
    disableHostCheck: true,
  },
  runtimeCompiler: true,
  chainWebpack: (config) => {
    config.module
      .rule('eslint')
      .use('eslint-loader')
      .options({
        fix: true,
      });
  },
  pluginOptions: {
    apollo: {
      enableMocks: true,
      enableEngine: false,
      // Cross-Origin options
      cors: '*',
    },
  },
};

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Interactions of selecting dates in datepicker widget

Currently, I am working on developing my personal work website. One issue I have encountered is with the calendar feature. The "From" date can be selected before today's date, which is not ideal. Additionally, if a date 5 days from now is chosen as th ...

Encountering ERR_EMPTY_RESPONSE when binding ports to a Docker container

Vuejs3 has been successfully installed and npm run dev is running inside a Docker container using the node:latest image. It's a very basic setup. While inside the container, it's definitely starting on http://localhost:5173, as confirmed by curl ...

Having trouble getting your jQuery/JavaScript function to detect the property "-webkit-clip-path"?

Exploring the clip-path feature of CSS has been a fun experiment for me. I have successfully implemented it in my project and am now trying to incorporate JavaScript to dynamically change the start/stop positions of the clip-path. Below is a snippet of my ...

Access and expand a bootstrap accordion with a hyperlink

Here is a concept I want to make happen: For my project, I am utilizing Bootstrap v3.4.1 and have set up two columns next to each other. My goal is to link the elements in the hotspot banner (left column) to trigger and open the corresponding Accordions ( ...

Looking to utilize the <pre> tag without any external CSS styles defined in a separate stylesheet?

In my current project, I am using bootstreap v3.2. I am facing an issue where I need to display fetched content from the database on a page using the <pre></pre> tags. However, the problem is that the content is being displayed with the default ...

Restrict the number of simultaneous image downloads in HTML

I am currently seeking the most effective solution for throttling image downloads in a Single Page Application. Issue: When on a slow network and navigating to a details page, there is an overload of image downloads occurring which pushes browser connect ...

Having trouble retrieving image files from CSS within a Spring MVC Application

I am facing an issue with my Spring MVC application where I cannot get an image to display in a CSS file accessed from a JSP file. The CSS is working fine, but the image just won't show up. It seems like there might be an issue with how I am addressin ...

The PHP code embedded within the HTML document and triggered by an AJAX request failed to

Here is an example of my ajax call: function insertModal(link) { $.ajax({ url: link, cache: false, dataType: "text", success: function(data) { $("#modalInput").html(data); }, error: function (request, status, error) { ...

RegEx for Filtering Out HTML Entities Without Escaping

Is there a way to prevent the use of unescaped ampersands in a specific input field? I've been struggling to create a RegEx that blocks "&" unless it's followed by "amp;" or just avoid the usage of "& " (with a space). I attempted to mod ...

Recreating a <select> element and verifying it once more using JS/HTML5

Before I delve into my issue, I would like to offer an apology for any errors in my English. So, the HTML code I am working with looks like this: <body> <div id="container"> <div id="taskList"> <div id="firstTask"> & ...

Is it possible to integrate an html page within a wordpress website?

I'm a WordPress newbie but I have experience with HTML, CSS, JS, and PHP. Can anyone guide me on how to incorporate existing HTML pages into my WordPress site? I recently set up WordPress successfully on my domain hosted by GoDaddy (www.mydomain.com) ...

Issue: Invalid element type detected: expected a string (for built-in components) or a class/function

Currently, I am in the process of learning how to make API calls using React Redux. I decided to practice by implementing an example in StackBlitz. However, I encountered an error after selecting a channel and clicking on the 'Top News' button. C ...

Combining hover and mousedown event listeners in jQuery: Tips and tricks

htmlCODE: <div class="original_circle" style="border-radius: 50%; background-color: blue; width: 40px; height:40px; z-index: 0"> <div class="another_circle" style="position:absolute; border-radius: 50%; background-color: coral; width: 40px; h ...

Design your own unique HTML webpage

My goal is to create a screen using divs that includes a big div which aligns with the month of October. This big div should be movable across the months, and when it stacks on a specific month, a form should be submitted. I am seeking assistance with po ...

The clash between Angular's ng-if directive and Bootstrap's popover feature causing unexpected

<div class="form-group" ng-if="firstname"> <label>First Name</label> <input readonly type="text" class="form-control" id="first_name" ng-model="firstname" placeholder="First Name"> <a href="" data-toggle="popover" dat ...

Tips for shifting an image upwards and extending it beyond one section while keeping the other section unaffected

Struggling all day while designing a CSS site, trying to hide one part of an image when it overflows and keep another part visible, in addition to moving the image up and down. Here's the HTML code snippet: <section class="next-gen"&g ...

What methods can I use to make sure the right side of my React form is properly aligned for a polished appearance?

Trying to create a React component with multiple input field tables, the challenge is aligning the right side of the table correctly. The issue lies in inconsistent alignment of content within the cells leading to disruption in overall layout. Experimente ...

Showcasing a pair of images adjacent to each other with adequate spacing using CSS

I'm having trouble displaying two images side by side on my website with a gap in between. I've used CSS to position the images next to each other. This is the HTML code I'm using: <div id="divCenter"> <img src="Company L ...

Tips for aligning two objects side by side in HTML

Apologies for the basic question, forgive my ignorance but I am struggling with keeping two objects in the same line within the same division. Please take a look at the code below: <html> <head> <style> .search-input { width: ...

Error: The import declaration is clashing with the local declaration of 'defineProps' in Vue version 3.3

Today, I encountered several errors after updating my node_modules and Vue to v3.3. The project utilizes Vue 3.3, WebPack (not Vite), and VS Code Volar. It is a large project. In every file with *.vue containing <script setup lang="ts">, ...