Skip to content

Commit

Permalink
fix(options): wrong fallback behaviors
Browse files Browse the repository at this point in the history
Empty list of tags and comments shouldn't fallback to identifiers.
  • Loading branch information
Sec-ant committed Feb 29, 2024
1 parent e47742c commit fbb5cae
Show file tree
Hide file tree
Showing 29 changed files with 119 additions and 88 deletions.
7 changes: 7 additions & 0 deletions .changeset/many-otters-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"prettier-plugin-embed": patch
---

Fix wrong options fallback behaviors:

- Empty list of tags and comments shouldn't fallback to identifiers in options.
5 changes: 3 additions & 2 deletions src/embedded/css/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ChoiceSupportOption, SupportOptions } from "prettier";
import {
type AutocompleteStringList,
type StringListToInterfaceKey,
fallbackIndicator,
makeCommentsOptionName,
makeIdentifiersOptionName,
makeParserOptionName,
Expand Down Expand Up @@ -42,15 +43,15 @@ export const options = {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Block comments that make their subsequent template literals be identified as embedded CSS language.",
},
[EMBEDDED_LANGUAGE_TAGS]: {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Tags that make their subsequent template literals be identified as embedded CSS language.",
},
Expand Down
5 changes: 3 additions & 2 deletions src/embedded/es/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ChoiceSupportOption, SupportOptions } from "prettier";
import {
type AutocompleteStringList,
type StringListToInterfaceKey,
fallbackIndicator,
makeCommentsOptionName,
makeIdentifiersOptionName,
makeParserOptionName,
Expand Down Expand Up @@ -59,15 +60,15 @@ export const options = {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Block comments that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language.",
},
[EMBEDDED_LANGUAGE_TAGS]: {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Tags that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language.",
},
Expand Down
5 changes: 3 additions & 2 deletions src/embedded/glsl/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { SupportOptions } from "prettier";
import {
type AutocompleteStringList,
type StringListToInterfaceKey,
fallbackIndicator,
makeCommentsOptionName,
makeIdentifiersOptionName,
makeTagsOptionName,
Expand Down Expand Up @@ -37,15 +38,15 @@ export const options = {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Block comments that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin.",
},
[EMBEDDED_LANGUAGE_TAGS]: {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Tags that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin.",
},
Expand Down
5 changes: 3 additions & 2 deletions src/embedded/graphql/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { SupportOptions } from "prettier";
import {
type AutocompleteStringList,
type StringListToInterfaceKey,
fallbackIndicator,
makeCommentsOptionName,
makeIdentifiersOptionName,
makeTagsOptionName,
Expand Down Expand Up @@ -37,15 +38,15 @@ export const options = {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Block comments that make their subsequent template literals be identified as embedded GraphQL language.",
},
[EMBEDDED_LANGUAGE_TAGS]: {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Tags that make their subsequent template literals be identified as embedded GraphQL language.",
},
Expand Down
5 changes: 3 additions & 2 deletions src/embedded/html/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ChoiceSupportOption, SupportOptions } from "prettier";
import {
type AutocompleteStringList,
type StringListToInterfaceKey,
fallbackIndicator,
makeCommentsOptionName,
makeIdentifiersOptionName,
makeParserOptionName,
Expand Down Expand Up @@ -42,15 +43,15 @@ export const options = {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Block comments that make their subsequent template literals be identified as embedded HTML language.",
},
[EMBEDDED_LANGUAGE_TAGS]: {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Tags that make their subsequent template literals be identified as embedded HTML language.",
},
Expand Down
1 change: 1 addition & 0 deletions src/embedded/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ export {
makeIdentifiersOptionName,
makeCommentsOptionName,
makeTagsOptionName,
fallbackIndicator,
type AutocompleteStringList,
} from "./utils.js";
5 changes: 3 additions & 2 deletions src/embedded/ini/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { SupportOptions } from "prettier";
import {
type AutocompleteStringList,
type StringListToInterfaceKey,
fallbackIndicator,
makeCommentsOptionName,
makeIdentifiersOptionName,
makeTagsOptionName,
Expand Down Expand Up @@ -37,15 +38,15 @@ export const options = {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Block comments that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin.",
},
[EMBEDDED_LANGUAGE_TAGS]: {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Tags that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin.",
},
Expand Down
5 changes: 3 additions & 2 deletions src/embedded/java/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { SupportOptions } from "prettier";
import {
type AutocompleteStringList,
type StringListToInterfaceKey,
fallbackIndicator,
makeCommentsOptionName,
makeIdentifiersOptionName,
makeTagsOptionName,
Expand Down Expand Up @@ -37,15 +38,15 @@ export const options = {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Block comments that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin.",
},
[EMBEDDED_LANGUAGE_TAGS]: {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Tags that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin.",
},
Expand Down
5 changes: 3 additions & 2 deletions src/embedded/json/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ChoiceSupportOption, SupportOptions } from "prettier";
import {
type AutocompleteStringList,
type StringListToInterfaceKey,
fallbackIndicator,
makeCommentsOptionName,
makeIdentifiersOptionName,
makeParserOptionName,
Expand Down Expand Up @@ -43,15 +44,15 @@ export const options = {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Block comments that make their subsequent template literals be identified as embedded JSON language.",
},
[EMBEDDED_LANGUAGE_TAGS]: {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Tags that make their subsequent template literals be identified as embedded JSON language.",
},
Expand Down
5 changes: 3 additions & 2 deletions src/embedded/jsonata/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { SupportOptions } from "prettier";
import {
type AutocompleteStringList,
type StringListToInterfaceKey,
fallbackIndicator,
makeCommentsOptionName,
makeIdentifiersOptionName,
makeTagsOptionName,
Expand Down Expand Up @@ -37,15 +38,15 @@ export const options = {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Block comments that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin.",
},
[EMBEDDED_LANGUAGE_TAGS]: {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Tags that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin.",
},
Expand Down
5 changes: 3 additions & 2 deletions src/embedded/latex/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { SupportOptions } from "prettier";
import {
type AutocompleteStringList,
type StringListToInterfaceKey,
fallbackIndicator,
makeCommentsOptionName,
makeIdentifiersOptionName,
makeTagsOptionName,
Expand Down Expand Up @@ -46,15 +47,15 @@ export const options = {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Block comments that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin.",
},
[EMBEDDED_LANGUAGE_TAGS]: {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Tags that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin.",
},
Expand Down
5 changes: 3 additions & 2 deletions src/embedded/markdown/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ChoiceSupportOption, SupportOptions } from "prettier";
import {
type AutocompleteStringList,
type StringListToInterfaceKey,
fallbackIndicator,
makeCommentsOptionName,
makeIdentifiersOptionName,
makeParserOptionName,
Expand Down Expand Up @@ -42,15 +43,15 @@ export const options = {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Block comments that make their subsequent template literals be identified as embedded Markdown language.",
},
[EMBEDDED_LANGUAGE_TAGS]: {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Tags that make their subsequent template literals be identified as embedded Markdown language.",
},
Expand Down
5 changes: 3 additions & 2 deletions src/embedded/nginx/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { SupportOptions } from "prettier";
import {
type AutocompleteStringList,
type StringListToInterfaceKey,
fallbackIndicator,
makeCommentsOptionName,
makeIdentifiersOptionName,
makeTagsOptionName,
Expand Down Expand Up @@ -37,15 +38,15 @@ export const options = {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Block comments that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin.",
},
[EMBEDDED_LANGUAGE_TAGS]: {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Tags that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin.",
},
Expand Down
5 changes: 3 additions & 2 deletions src/embedded/noop/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { SupportOptions } from "prettier";
import type { EmbeddedDefaultComment, EmbeddedDefaultTag } from "../types.js";
import {
type AutocompleteStringList,
fallbackIndicator,
makeCommentsOptionName,
makeIdentifiersOptionName,
makeTagsOptionName,
Expand Down Expand Up @@ -31,15 +32,15 @@ export const options = {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Block comments that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted.",
},
[EMBEDDED_LANGUAGE_TAGS]: {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Tags that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted.",
},
Expand Down
5 changes: 3 additions & 2 deletions src/embedded/pegjs/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { SupportOptions } from "prettier";
import {
type AutocompleteStringList,
type StringListToInterfaceKey,
fallbackIndicator,
makeCommentsOptionName,
makeIdentifiersOptionName,
makeTagsOptionName,
Expand Down Expand Up @@ -37,15 +38,15 @@ export const options = {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Block comments that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin.",
},
[EMBEDDED_LANGUAGE_TAGS]: {
category: "Embed",
type: "string",
array: true,
default: [{ value: [] }],
default: [{ value: [fallbackIndicator] }],
description:
"Tags that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin.",
},
Expand Down
Loading

0 comments on commit fbb5cae

Please sign in to comment.