Skip to content

Commit b40a394

Browse files
heathsCopilot
andcommitted
Add common ancestor config selection to check-spelling skill
When adding misspelled words to the dictionary, the skill now selects the nearest common ancestor cspell configuration file when misspellings span files governed by different configs, preventing duplicate dictionary entries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 78bc9bb commit b40a394

3 files changed

Lines changed: 21 additions & 6 deletions

File tree

.github/plugin/marketplace.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
},
66
"metadata": {
77
"description": "Collection of agents, skills, and tools used in personal projects",
8-
"version": "0.4.1"
8+
"version": "0.4.2"
99
},
1010
"plugins": [
1111
{
@@ -28,7 +28,7 @@
2828
"name": "linting",
2929
"source": "plugins/linting",
3030
"description": "Skills and tools for formatting and linting",
31-
"version": "0.2.2"
31+
"version": "0.2.3"
3232
}
3333
]
3434
}

plugins/linting/.github/plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "linting",
33
"description": "Skills and tools for formatting and linting",
4-
"version": "0.2.2",
4+
"version": "0.2.3",
55
"author": {
66
"name": "Heath Stewart"
77
},

plugins/linting/skills/check-spelling/SKILL.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,26 @@ Run `npx cspell lint [options] [globs...]` to check a list of file globs or `.`
4545

4646
## Fix spelling
4747

48-
Show a summary of the misspelling to the user. Prompt the user for which words should be replaced with another word. All other words should be added to the `words` array of the configuration file according to the schema.
48+
Show a summary of the misspelling to the user. Prompt the user for which words should be replaced with another word. All remaining words should be added to the dictionary using the steps below.
4949

50-
If any misspellings are only in files that match any `filename` globs in an optional `overrides` section, add those words to the `words` array in that override according to the schema.
50+
### Choosing the correct configuration file for dictionary words
5151

52-
Seldom used words can be ignored within the file they are used by adding a appropriate comment e.g.:
52+
A project may have multiple cspell configuration files at different directory levels. When adding a word to the `words` array, select the configuration file as follows:
53+
54+
1. For each file that contains the misspelling, find the nearest cspell configuration file by searching from that file's directory upward through ancestor directories to the repository root.
55+
2. If all files resolve to the same configuration file, add the word there.
56+
3. If files resolve to different configuration files, find the nearest common ancestor directory of those files. Search from that ancestor directory upward for an existing cspell configuration file and add the word there.
57+
4. If no ancestor configuration file exists above the common ancestor directory, add the word to the root configuration file.
58+
59+
This prevents the same word from being duplicated across multiple configuration files.
60+
61+
### Overrides
62+
63+
If any misspellings are only in files that match any `filename` globs in an optional `overrides` section of the chosen configuration file, add those words to the `words` array in that override according to the schema.
64+
65+
### Inline ignores
66+
67+
Seldom used words can be ignored within the file they are used by adding an appropriate comment e.g.:
5368

5469
```js
5570
// cspell:ignore <word>

0 commit comments

Comments
 (0)