From 50ee3c84f61d1da5622cdd305af4a8b67383bfd3 Mon Sep 17 00:00:00 2001 From: Toby Smith Date: Tue, 24 May 2022 21:13:47 +0100 Subject: [PATCH] feat: Add a dictionary for Docker keywords (#1117) * feat: Add a dictionary for Docker keywords Co-authored-by: Jason Dent --- CONTRIBUTORS.md | 1 + README.md | 2 ++ SECURITY.md | 1 + dictionaries.md | 1 + dictionaries/docker/CHANGELOG.md | 0 dictionaries/docker/LICENSE | 21 +++++++++++++ dictionaries/docker/README.md | 46 ++++++++++++++++++++++++++++ dictionaries/docker/cspell-ext.json | 43 ++++++++++++++++++++++++++ dictionaries/docker/cspell.json | 14 +++++++++ dictionaries/docker/docker-words.txt | 18 +++++++++++ dictionaries/docker/package.json | 39 +++++++++++++++++++++++ 11 files changed, 186 insertions(+) create mode 100644 dictionaries/docker/CHANGELOG.md create mode 100644 dictionaries/docker/LICENSE create mode 100644 dictionaries/docker/README.md create mode 100644 dictionaries/docker/cspell-ext.json create mode 100644 dictionaries/docker/cspell.json create mode 100644 dictionaries/docker/docker-words.txt create mode 100644 dictionaries/docker/package.json diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 1966dea4741..b8a290a8578 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -11,6 +11,7 @@ | Czech | [Zereges](https://github.com/Zereges) | | Danish | [Viktor Hundahl Strate](https://github.com/viktorstrate) | | Django | [canarduck](https://github.com/canarduck) | +| Docker | [Toby Smith](https://github.com/tobysmith568) | | Elixir | [Todoroki / U-dory](https://github.com/ndac-todoroki) | | Esperanto | [Carmen Bianca Bakker](https://github.com/carmenbianca) | | French | [canarduck](https://github.com/canarduck) | diff --git a/README.md b/README.md index 44592978761..86ac49c37a0 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Various [cspell](https://github.com/streetsidesoftware/cspell) dictionaries. Eac - [bash](dictionaries/bash) - Bash/Shell scripts - [cpp](dictionaries/cpp) - C and C++ - [Django](dictionaries/django) - Django framework function names +- [Docker](dictionaries/docker) - Dockerfile instructions - [Elixir](dictionaries/elixir) - [Go](dictionaries/golang) - [Java](dictionaries/java) @@ -76,6 +77,7 @@ Various [cspell](https://github.com/streetsidesoftware/cspell) dictionaries. Eac | [@cspell/dict-dart](./dictionaries/dart#readme) | dart | dart | Dart dictionary for cspell. | | [@cspell/dict-de-de](./dictionaries/de_DE#readme) | de-de | German Dictionary | German (de-DE) Dictionary. | | [@cspell/dict-django](./dictionaries/django#readme) | django | Django Keywords | List of Python Django Framework keywords. | +| [@cspell/dict-docker](./dictionaries/docker#readme) | docker | Docker Dictionary | Docker dictionary for cspell. | | [@cspell/dict-dotnet](./dictionaries/dotnet#readme) | dotnet | .Net Dictionary | .Net keywords. | | [@cspell/dict-el](./dictionaries/el#readme) | el | Greek | Greek dictionary for cspell. | | [@cspell/dict-elixir](./dictionaries/elixir#readme) | elixir | elixir | Elixir dictionary for cspell. | diff --git a/SECURITY.md b/SECURITY.md index 3136f837c24..ebd16bef216 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -21,6 +21,7 @@ Every attempt is made to make sure security issues are addressed as soon as poss | cspell-dict-da_DK | 1.\* | :white_check_mark: | | | cspell-dict-de_DE | 1.\* | :white_check_mark: | | | cspell-dict-django | 1.\* | :white_check_mark: | | +| cspell-dict-docker | 1.\* | :white_check_mark: | | | cspell-dict-dotnet | 1.\* | :white_check_mark: | | | cspell-dict-el | 1.\* | :white_check_mark: | | | cspell-dict-elixir | 1.\* | :white_check_mark: | | diff --git a/dictionaries.md b/dictionaries.md index f8245d488f6..4a13d129994 100644 --- a/dictionaries.md +++ b/dictionaries.md @@ -21,6 +21,7 @@ | [@cspell/dict-dart](./dictionaries/dart#readme) | dart | dart | Dart dictionary for cspell. | | [@cspell/dict-de-de](./dictionaries/de_DE#readme) | de-de | German Dictionary | German (de-DE) Dictionary. | | [@cspell/dict-django](./dictionaries/django#readme) | django | Django Keywords | List of Python Django Framework keywords. | +| [@cspell/dict-docker](./dictionaries/docker#readme) | docker | Docker Dictionary | Docker dictionary for cspell. | | [@cspell/dict-dotnet](./dictionaries/dotnet#readme) | dotnet | .Net Dictionary | .Net keywords. | | [@cspell/dict-el](./dictionaries/el#readme) | el | Greek | Greek dictionary for cspell. | | [@cspell/dict-elixir](./dictionaries/elixir#readme) | elixir | elixir | Elixir dictionary for cspell. | diff --git a/dictionaries/docker/CHANGELOG.md b/dictionaries/docker/CHANGELOG.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/dictionaries/docker/LICENSE b/dictionaries/docker/LICENSE new file mode 100644 index 00000000000..2a9a259bf80 --- /dev/null +++ b/dictionaries/docker/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Jason Dent + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/dictionaries/docker/README.md b/dictionaries/docker/README.md new file mode 100644 index 00000000000..fb31be9320f --- /dev/null +++ b/dictionaries/docker/README.md @@ -0,0 +1,46 @@ +# Cspell Docker Dictionary + +Docker dictionary for cspell. + +This is a pre-built dictionary for use with cspell. + +## Installation + +Global Install and add to cspell global settings. + +```sh +npm install -g @cspell/dict-docker +cspell link add @cspell/dict-docker +``` + +## Uninstall from cspell + +```sh +cspell link remove @cspell/dict-docker +``` + +## Manual Installation + +The `cspell-ext.json` file in this package should be added to the import section in your cspell.json file. + +```javascript +{ + // … + "import": ["@cspell/dict-docker/cspell-ext.json"], + // … +} +``` + +## Building + +Building is only necessary if you want to modify the contents of the dictionary. Note: Building will take a few minutes for large files. + +```sh +npm run build +``` + +## License + +MIT + +> Some packages may have other licenses included. diff --git a/dictionaries/docker/cspell-ext.json b/dictionaries/docker/cspell-ext.json new file mode 100644 index 00000000000..b729d46d730 --- /dev/null +++ b/dictionaries/docker/cspell-ext.json @@ -0,0 +1,43 @@ +// cSpell Settings +{ + "id": "docker", + "name": "Docker Dictionary", + "description": "Docker dictionary for cspell.", + "readonly": true, + // List of dictionary files to add to the global list of dictionaries + "dictionaryDefinitions": [ + { + "name": "docker", + "path": "./docker-words.txt.gz", + "description": "Docker dictionary for cspell." + } + ], + // Dictionaries to always be used. + // Generally left empty + "dictionaries": [], + // Language Rules to apply to matching files. + // Files are matched on `languageId` and `local` + "languageSettings": [ + { + // VSCode languageId. i.e. typescript, java, go, cpp, javascript, markdown, latex + // * will match against any file type. + "languageId": "dockerfile", + // Language local. i.e. en-US, de-AT, or ru. * will match all locals. + // Multiple locals can be specified like: "en, en-US" to match both English and English US. + "locale": "*", + // By default the whole text of a file is included for spell checking + // Adding patterns to the "includeRegExpList" to only include matching patterns + "includeRegExpList": [], + // To exclude patterns, add them to "ignoreRegExpList" + "ignoreRegExpList": [], + // regex patterns than can be used with ignoreRegExpList or includeRegExpList + // Example: "pattern": [{ "name": "mdash", "pattern": "—" }] + // This could be included in "ignoreRegExpList": ["mdash"] + "patterns": [], + // List of dictionaries to enable by name in `dictionaryDefinitions` + "dictionaries": ["docker"], + // Dictionary definitions can also be supplied here. They are only used iff "languageId" and "locale" match. + "dictionaryDefinitions": [] + } + ] +} diff --git a/dictionaries/docker/cspell.json b/dictionaries/docker/cspell.json new file mode 100644 index 00000000000..73306ee69e2 --- /dev/null +++ b/dictionaries/docker/cspell.json @@ -0,0 +1,14 @@ +{ + "version": "0.2", + "files": [ + "**/*.{md,txt}" + ], + "dictionaries": [ + "docker" + ], + "import": [ + "./cspell-ext.json" + ], + "words": [ + ] +} diff --git a/dictionaries/docker/docker-words.txt b/dictionaries/docker/docker-words.txt new file mode 100644 index 00000000000..124ced2ae9e --- /dev/null +++ b/dictionaries/docker/docker-words.txt @@ -0,0 +1,18 @@ +ADD +ARG +CMD +COPY +ENTRYPOINT +ENV +EXPOSE +FROM +HEALTHCHECK +LABEL +MAINTAINER +ONBUILD +RUN +SHELL +STOPSIGNAL +USER +VOLUME +WORKDIR diff --git a/dictionaries/docker/package.json b/dictionaries/docker/package.json new file mode 100644 index 00000000000..a91f495b523 --- /dev/null +++ b/dictionaries/docker/package.json @@ -0,0 +1,39 @@ +{ + "name": "@cspell/dict-docker", + "version": "1.0.0", + "description": "Docker dictionary for cspell.", + "publishConfig": { + "access": "public" + }, + "exports": { + ".": "./cspell-ext.json", + "./cspell": "./cspell-ext.json", + "./cspell-ext.json": "./cspell-ext.json" + }, + "scripts": { + "build": "cspell-tools-cli compile \"docker-words.txt\" -o .", + "test": "head -n 100 \"docker-words.txt\" | cspell -v -c ./cspell-ext.json \"--local=*\" \"--languageId=dockerfile\" stdin", + "prepublishOnly": "echo pre-publish", + "prepare": "yarn run build" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/streetsidesoftware/cspell-dicts.git" + }, + "keywords": [ + "cspell", + "docker", + "dictionary", + "spelling" + ], + "author": "Jason Dent", + "license": "MIT", + "bugs": { + "url": "https://github.com/streetsidesoftware/cspell-dicts/issues" + }, + "homepage": "https://github.com/streetsidesoftware/cspell-dicts/blob/main/dictionaries/docker#readme", + "files": [ + "docker-words.txt.gz", + "cspell-ext.json" + ] +}