Skip to content

Commit

Permalink
dev: Start implementing cspell-config reader/writer (#2859)
Browse files Browse the repository at this point in the history
* dev: Start implementing cspell config reader/writer
* Add support for `.json` files.
* Add support for `.yaml` files
* Use Yaml 1.10.2
   Yaml 2 does not work with Node 12
  • Loading branch information
Jason3S committed May 20, 2022
1 parent 28683b0 commit 6ce22a1
Show file tree
Hide file tree
Showing 39 changed files with 6,943 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cspell.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
{
"path": "packages/cspell-bundled-dicts"
},
{
"path": "packages/cspell-config"
},
{
"path": "packages/cspell-dynamic-loader"
},
Expand Down
39 changes: 39 additions & 0 deletions packages/cspell-config/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "cspell-config: Jest current-file",
"program": "${workspaceFolder}/../../node_modules/.bin/jest",
"args": [
"--runInBand",
"${fileBasename}"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/../../node_modules/jest/bin/jest",
}
},
{
"type": "node",
"request": "launch",
"name": "cspell-config: Jest All",
"program": "${workspaceFolder}/../../node_modules/.bin/jest",
"args": [
"--runInBand"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/../../node_modules/jest/bin/jest",
}
}
]
}
22 changes: 22 additions & 0 deletions packages/cspell-config/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$tsc"
},
{
"label": "Clean Build",
"type": "npm",
"script": "clean-build",
"problemMatcher": []
}
]
}
4 changes: 4 additions & 0 deletions packages/cspell-config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
21 changes: 21 additions & 0 deletions packages/cspell-config/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 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.
9 changes: 9 additions & 0 deletions packages/cspell-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# `cspell-config`

A library to assist reading and writing CSpell configuration files.

## Install

```sh
npm install -S cspell-config
```
11 changes: 11 additions & 0 deletions packages/cspell-config/fixtures/cspell.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
// file version
"version": "0.2",
"words": [
"angle", // with comment
// Before "before"
"before",
"cache",
"zebra" // zebra comment
]
}
9 changes: 9 additions & 0 deletions packages/cspell-config/fixtures/cspell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# file version
version: "0.2"
words:
- angle # with comment
# Before "before"
- before
- cache
- zebra # zebra comment
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "test-package",
"cspell": {
"words": [
"banana"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "test-package"
}
1 change: 1 addition & 0 deletions packages/cspell-config/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../jest.config');

0 comments on commit 6ce22a1

Please sign in to comment.