diff --git a/.changeset/gorgeous-ladybugs-push.md b/.changeset/gorgeous-ladybugs-push.md new file mode 100644 index 00000000..6d1c3428 --- /dev/null +++ b/.changeset/gorgeous-ladybugs-push.md @@ -0,0 +1,5 @@ +--- +"prettier-plugin-sh": minor +--- + +feat: add `.node-version` and `.nvmrc` support diff --git a/packages/sh/test/__snapshots__/fixtures.spec.ts.snap b/packages/sh/test/__snapshots__/fixtures.spec.ts.snap index 1cebbed5..354ba9eb 100644 --- a/packages/sh/test/__snapshots__/fixtures.spec.ts.snap +++ b/packages/sh/test/__snapshots__/fixtures.spec.ts.snap @@ -22,6 +22,16 @@ node_modules " `; +exports[`parser and printer > should format all fixtures > .nvmrc 1`] = ` +"v1.2.3 +" +`; + +exports[`parser and printer > should format all fixtures > .nvmrc 2`] = ` +"v1.2.3 +" +`; + exports[`parser and printer > should format all fixtures > .properties 1`] = ` "# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 diff --git a/packages/sh/test/fixtures/.nvmrc b/packages/sh/test/fixtures/.nvmrc new file mode 100644 index 00000000..a064add5 --- /dev/null +++ b/packages/sh/test/fixtures/.nvmrc @@ -0,0 +1 @@ +v1.2.3 \ No newline at end of file diff --git a/scripts/languages.ts b/scripts/languages.ts index 1911d69d..7155c80e 100644 --- a/scripts/languages.ts +++ b/scripts/languages.ts @@ -27,6 +27,13 @@ const EXTRA_SH_LANGUAGES: SupportLanguage[] = [ filenames: ['.env.*'], vscodeLanguageIds: ['dotenv'], }, + { + name: 'nvmrc', + since: '0.14.0', + parsers: ['sh'], + extensions: ['.node-version', '.nvmrc'], + filenames: ['.node-version', '.nvmrc'], + }, ] const getSupportLanguages = (