From 0299a4281e2130e345e8843c71360c86818f6c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ndor=20Levcs=C3=A1k?= Date: Sat, 30 Mar 2024 20:13:32 +0100 Subject: [PATCH] feat!: rename setting `class-attr-name` --- README.md | 4 ++-- lib/utils/class-attr.ts | 2 +- tests/lib/rules/no-dynamic-class-names.ts | 2 +- tests/lib/rules/no-undefined-class-names.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 145d3e3..0731ee9 100644 --- a/README.md +++ b/README.md @@ -42,14 +42,14 @@ Example **.eslintrc.js**: ```js module.exports = { plugins: ['@vkcn'], - settings: { "vkcn/class-attr-name": /custom-reg-exp/ }, // optional + settings: { "@vkcn/class-attr-name": /custom-reg-exp/ }, // optional rules: { '@vkcn/': 'error' } } ``` -By using `settings: { "vkcn/class-attr-name": /custom-reg-exp/ }` it is possible to run rules throughout any attribute/directive which matches regexp. By default only `class` is checked. +By using `settings: { "@vkcn/class-attr-name": /custom-reg-exp/ }` it is possible to run rules throughout any attribute/directive which matches regexp. By default only `class` is checked. _Please note!_ When using a custom regexp - `class` **must be included** into it diff --git a/lib/utils/class-attr.ts b/lib/utils/class-attr.ts index 175d04e..b2c2311 100644 --- a/lib/utils/class-attr.ts +++ b/lib/utils/class-attr.ts @@ -2,7 +2,7 @@ import type { RuleContext } from "../types"; import type { VAttribute, VDirective } from "vue-eslint-parser/ast"; export function getClassAttrNameRegexp(context: RuleContext): RegExp { - const customClassAttrName = context.settings?.["vkcn/class-attr-name"]; + const customClassAttrName = context.settings?.["@vkcn/class-attr-name"]; const customClassAttrNameRegexp = customClassAttrName instanceof RegExp ? customClassAttrName : /^class$/; diff --git a/tests/lib/rules/no-dynamic-class-names.ts b/tests/lib/rules/no-dynamic-class-names.ts index f0b7430..86137b0 100644 --- a/tests/lib/rules/no-dynamic-class-names.ts +++ b/tests/lib/rules/no-dynamic-class-names.ts @@ -10,7 +10,7 @@ const tester = new RuleTester({ ecmaVersion: 2019, sourceType: "module", }, - settings: { "vkcn/class-attr-name": /(.+-)?class$/ }, + settings: { "@vkcn/class-attr-name": /(.+-)?class$/ }, }); type RuleOptions = { diff --git a/tests/lib/rules/no-undefined-class-names.ts b/tests/lib/rules/no-undefined-class-names.ts index 0a2ec5f..7c473d2 100644 --- a/tests/lib/rules/no-undefined-class-names.ts +++ b/tests/lib/rules/no-undefined-class-names.ts @@ -66,7 +66,7 @@ tester.run("no-undefined-class-names", rule as any, { { name: "custom attribute names", filename: "app.vue", - settings: { "vkcn/class-attr-name": /^(bar|baz)$/ }, + settings: { "@vkcn/class-attr-name": /^(bar|baz)$/ }, code: html`