Add ESLint rule for unused Vue inject declarations
What does this MR do?
Adds an ESLint rule that flags unused Vue inject declarations, extending the dead-code linting we already enforce via vue/no-unused-properties (which covers props/data/computed/methods/setup).
Why a new rule?
vue/no-unused-properties already detects unused inject entries internally (iterateProperties collects both array and object forms, and the reporting loop is generic). The only blocker is its meta.schema, whose groups enum is hard-coded and rejects inject — ESLint validates options against that schema at config-load time, so we cannot pass groups: ['inject'].
So this MR adds a thin local-rules/vue-no-unused-injects rule that delegates to vue/no-unused-properties, forcing groups: ['inject'] from inside create(). This reuses all of upstream's battle-tested detection: template-only usage (:svg-path="x"), <script setup>, this.foo, destructuring, watchers, etc.
Changes
tooling/eslint-config/eslint-local-rules/vue_no_unused_injects.mjs— the new rule (delegating wrapper).tooling/eslint-config/eslint-local-rules/index.mjs— register the rule.eslint.config.mjs— enable it aserroron*.vuefiles.spec/tooling/frontend/eslint-config/eslint-local-rules/vue_no_unused_injects_spec.mjs— unit tests (array/object forms, template-only usage, non-Vue.jsno-false-positive)..eslint_todo/local-rules-vue-no-unused-injects.mjs(+ index) — grandfathers the 110 existing offenders so they surface non-blocking via theeslint-todoCI job and can be cleaned up incrementally.
How to verify
- Run the unit tests:
yarn vitest:eslint run vue_no_unused_injects(6 passing). - Reveal a grandfathered offender:
REVEAL_ESLINT_TODO=true yarn eslint app/assets/javascripts/ci/merge_requests/components/pipelines_table_wrapper.vue→ errors on the unusedgraphqlPathinject. - Without
REVEAL_ESLINT_TODO, the same file lints clean (suppressed by the todo list). Any newly added unused inject in a non-listed.vuefile errors.