question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

no-unused-components with class-components does not work

See original GitHub issue

.eslintrc.js:

module.exports = {
  root: true,
  env: {
    node: true
  },
  'extends': [
    'plugin:vue/essential',
    '@vue/standard',
    '@vue/typescript'
  ],
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
  },
  parserOptions: {
    parser: '@typescript-eslint/parser'
  }
}

**eslint-plugin-vue version: ** ^5.0.0

Node version: v8.12.0

My Actions:

1. Created new vue-cli project

2. Created component

<template>
  <div>
  </div>
</template>

<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'
import TestComponent from '@/components/TestComponent.vue'
@Component({
  components: { TestComponent }
})
export default class HelloWorld extends Vue {

}
</script>
  1. Ran linter with command: ‘vue-cli-service lint’

What actually happened?:

linter log: DONE No lint errors found!

Expecting Error:

Component TestComponent was registered, but never used

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:8
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
NikhilVermacommented, Oct 5, 2021

@negibouze Has a great solution but it didn’t work for me because I was using the following ESLint config

{
        parser: require.resolve("vue-eslint-parser"),
	parserOptions: {
		parser: "@typescript-eslint/parser"
        }
}

So I updated his rule and the updated code is here - https://gist.github.com/NikhilVerma/7613191dfffb38011ebb3c95468a423a

Follow his repo example to see how to use it : https://github.com/negibouze/customize-no-unused-components-rule

1reaction
ota-meshicommented, May 27, 2021

No progress has been made on this so far.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript errors in React Class Component property does ...
I'm currently getting a TypeScript error when trying to dynamically setState that says Property 'input' does not exist on type 'Readonly<{}>' .
Read more >
The Eight Parts of Speech - TIP Sheets - Butte College
Proper nouns always start with a capital letter; common nouns do not. Nouns can be singular or plural, concrete or abstract. Nouns show...
Read more >
Understanding Functional Components vs. Class ... - Twilio
Understand the differences between functional and class components with sample code so that you can dive into the world of modern React!
Read more >
How to Use Props to Pass Data to Child Components in React.js
The last step is to access the props in the child component. In function components, we access the props through the first function...
Read more >
Grammar: Main Parts of Speech - Academic Guides
Nouns are typically used as subjects, objects, objects of prepositions, and modifiers of ... However, the cause of the problem has not been...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found