Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: vue/key-spacing description
  • Loading branch information
ota-meshi committed Nov 29, 2023
commit 26d59a482fa86f90ead21dd884202be3f50e03eb
2 changes: 1 addition & 1 deletion docs/rules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ The following rules extend the rules provided by ESLint itself and apply them to
| [vue/dot-notation](./dot-notation.md) | Enforce dot notation whenever possible in `<template>` | :wrench: | :hammer: |
| [vue/eqeqeq](./eqeqeq.md) | Require the use of `===` and `!==` in `<template>` | :wrench: | :hammer: |
| [vue/func-call-spacing](./func-call-spacing.md) | Require or disallow spacing between function identifiers and their invocations in `<template>` | :wrench: | :lipstick: |
| [vue/key-spacing](./key-spacing.md) | Enforce consistent spacing between property names and type annotations in types and interfaces in `<template>` | :wrench: | :lipstick: |
| [vue/key-spacing](./key-spacing.md) | Enforce consistent spacing between keys and values in object literal properties in `<template>` | :wrench: | :lipstick: |
| [vue/keyword-spacing](./keyword-spacing.md) | Enforce consistent spacing before and after keywords in `<template>` | :wrench: | :lipstick: |
| [vue/max-len](./max-len.md) | enforce a maximum line length in `.vue` files | | :lipstick: |
| [vue/multiline-ternary](./multiline-ternary.md) | Enforce newlines between operands of ternary expressions in `<template>` | :wrench: | :lipstick: |
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/key-spacing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
pageClass: rule-details
sidebarDepth: 0
title: vue/key-spacing
description: Enforce consistent spacing between property names and type annotations in types and interfaces in `<template>`
description: Enforce consistent spacing between keys and values in object literal properties in `<template>`
since: v5.2.0
---
# vue/key-spacing

> Enforce consistent spacing between property names and type annotations in types and interfaces in `<template>`
> Enforce consistent spacing between keys and values in object literal properties in `<template>`

- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-deprecated-slot-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ This rule reports deprecated `slot` attribute in Vue.js v2.6.0+.

### `"ignore": ["my-component"]`

<eslint-code-block :rules="{'vue/no-dupe-keys': ['error', {ignore: ['my-component']}]}">
<eslint-code-block fix :rules="{'vue/no-dupe-keys': ['error', {ignore: ['my-component']}]}">

```vue
<template>
Expand Down
26 changes: 20 additions & 6 deletions lib/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,31 @@ function getCoreRule(name) {
/**
* Get ESLint Stylistic rule implementation from the rule name
* @param {string} name
* @param {'@stylistic/eslint-plugin' | '@stylistic/eslint-plugin-ts' | '@stylistic/eslint-plugin-js'} [preferModule]
* @returns {RuleModule | null}
*/
function getStylisticRule(name) {
const cached = stylisticRuleMap.get(name)
if (cached) {
return cached
function getStylisticRule(name, preferModule) {
if (!preferModule) {
const cached = stylisticRuleMap.get(name)
if (cached) {
return cached
}
}
const stylisticPluginNames = [
'@stylistic/eslint-plugin',
'@stylistic/eslint-plugin-ts',
'@stylistic/eslint-plugin-js'
]
if (preferModule) {
stylisticPluginNames.unshift(preferModule)
}
for (const stylisticPluginName of stylisticPluginNames) {
try {
const plugin = createRequire(`${process.cwd()}/__placeholder__.js`)(
stylisticPluginName
)
const rule = plugin?.rules?.[name]
stylisticRuleMap.set(name, rule)
if (!preferModule) stylisticRuleMap.set(name, rule)
return rule
} catch {
// ignore
Expand Down Expand Up @@ -487,7 +493,15 @@ function wrapStylisticOrCoreRule(ruleNames, options) {
extensionSource: {
url: baseRule.meta.docs.url,
name: stylisticRule ? 'ESLint Stylistic' : 'ESLint core'
}
},
...(stylisticRule
? {
description: `${
getStylisticRule(stylisticRuleName, '@stylistic/eslint-plugin-js')
?.meta.docs.description
} in \`<template>\``
}
: {})
},
deprecated: undefined,
replacedBy: undefined
Expand Down