ionic - `slot` attributes are deprecated - eslint-plugin-vue

Hello World picture Hello World · Jan 27, 2021 · Viewed 10.7k times · Source

I am getting following error in VS Code:

[vue/no-deprecated-slot-attribute]
`slot` attributes are deprecated. eslint-plugin-vue

enter image description here

I have these two plugin installed in .eslintrc.js

  'extends': [
    'plugin:vue/vue3-essential',
    'eslint:recommended'
  ],

And this in rules:

'vue/no-deprecated-slot-attribute': 'off',

What should be done in order to avoid this issue?

Answer

Lee picture Lee · Apr 2, 2021

This slot actually refers to webcomponent slots;
https://github.com/ionic-team/ionic-framework/issues/22236

The slots Ionic Framework uses are not the same as Vue 2 slots. The slots we use are Web Component slots and are valid usage: https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_templates_and_slots.

Developers should be using the Web Component slots to position elements as per our docs: https://ionicframework.com/docs/api/range#usage

Check to ensure your eslint.js has the following rule:

  rules: {
    'vue/no-deprecated-slot-attribute': 'off',
  }

Next open .vscode/settings.json and add the following:

  "vetur.validation.template": false,