Skip to content

Commit

Permalink
feat!: rename prefix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
levchak0910 committed Mar 30, 2024
1 parent 0299a42 commit b86e35d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions docs/rules/no-convention-violation.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Name should follow pattern `<prefix>--<element>`, where
- by default
1. equals to file name
2. if file called as `index` then equals to containing folder name
- can be overwritten with `vkcn-prefix` comment
- can be overwritten with `@vkcn/prefix` comment
- element - any custom name which is appropriate for DOM element

Element selector can not contain other element selector
Expand All @@ -38,7 +38,7 @@ Should be declared on `class` attribute (`class="<prefix>--<element>"`), not bin

Prefix overwrite all element class selectors per file

Should be declared by pattern `vkcn-prefix <any-appropriate-name>`. Recommended to place at the begging of the style tag
Should be declared by pattern `@vkcn/prefix <any-appropriate-name>`. Recommended to place at the begging of the style tag

non kebab case prefix will be _ignored_ and fallback to default naming

Expand All @@ -64,14 +64,14 @@ non kebab case prefix will be _ignored_ and fallback to default naming

```html
<style>
/* vkcn-prefix some-better-name */
/* @vkcn/prefix some-better-name */
.some-better-name--some-element {}
</style>
```

```html
<style lang="scss">
// vkcn-prefix some-better-name
// @vkcn/prefix some-better-name
.some-better-name--some-element {}
</style>
```
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-convention-violation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export = {
const enableFix = context.options[0]?.enableFix ?? false;

const DIVIDER = "--";
const COMMENT = "vkcn-prefix";
const COMMENT = "@vkcn/prefix";

function reportTopLevelClassSelector(
selector: VCSSClassSelector,
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/rules/no-convention-violation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ tester.run("no-convention-violation", rule as any, {
filename: "FooComponent.vue",
code: /* html */ `
<style>
/* vkcn-prefix foo-baz */
/* @vkcn/prefix foo-baz */
.foo-baz--bar {}
</style>
<style>
/* vkcn-prefix foo--baz */
/* @vkcn/prefix foo--baz */
.foo-component--bar {}
</style>
<style lang="scss">
// vkcn-prefix foo-baz
// @vkcn/prefix foo-baz
.foo-baz--bam {}
</style>
<style lang="scss">
// vkcn-prefix foo--baz
// @vkcn/prefix foo--baz
.foo-component--bam {}
</style>
`,
Expand Down

0 comments on commit b86e35d

Please sign in to comment.