Skip to content

Commit

Permalink
fix: Correct eslint-plugin options and document. (#4837)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S authored Sep 18, 2023
1 parent 80c75b4 commit 51f1d08
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 58 deletions.
48 changes: 39 additions & 9 deletions packages/cspell-eslint-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,46 @@ interface Options {
*/
checkComments?: boolean;
/**
* CSpell settings
*
* @words - list of words to be always considered correct
*
* @ignoreWords - a list of words to be ignored (even if they are in the flagWords)
*
* @flagWords - a list of words to be always considered incorrect, unless ignored.
*
* Some CSpell Settings
*/
cSpell?: { words?: string[]; ignoreWords?: string[]; flagWords?: string[] };
cSpell?: {
/** List of words to be considered correct. */
words?: string[];
/**
* List of words to be ignored.
* An ignored word will not show up as an error, even if it is also
* in the `flagWords`.
*/
ignoreWords?: string[];
/**
* List of words to always be considered incorrect.
* Words found in `flagWords` override `words`.
* Format of `flagWords`
* - single word entry - `word`
* - with suggestions - `word:suggestion` or `word->suggestion, suggestions`
*/
flagWords?: string[];
/**
* List of regular expression patterns or pattern names to exclude
* from spell checking.
*/
ignoreRegExpList?: string[];
/**
* List of regular expression patterns or defined pattern names to
* match for spell checking.
* If this property is defined, only text matching the included
* patterns will be checked.
*/
includeRegExpList?: string[];
/** Allows words to be glued together. */
allowCompoundWords?: boolean;
/** Import cspell config file. */
import?: string[];
/** List of dictionaries to enable */
dictionaries?: string[];
/** Define dictionaries. */
dictionaryDefinitions?: DictionaryDefinition[];
};
/**
* Specify a path to a custom word list file.
*
Expand Down
99 changes: 51 additions & 48 deletions packages/cspell-eslint-plugin/assets/options.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,60 +50,63 @@
},
"type": "array"
},
"dictionaryDefinition": {
"additionalProperties": false,
"properties": {
"description": {
"description": "Optional description.",
"type": "string"
},
"name": {
"description": "This is the name of a dictionary.\n\nName Format:\n- Must contain at least 1 number or letter.\n- Spaces are allowed.\n- Leading and trailing space will be removed.\n- Names ARE case-sensitive.\n- Must not contain `*`, `!`, `;`, `,`, `{`, `}`, `[`, `]`, `~`.",
"pattern": "^(?=[^!*,;{}[\\]~\\n]+$)(?=(.*\\w)).+$",
"type": "string"
},
"noSuggest": {
"description": "Indicate that suggestions should not come from this dictionary. Words in this dictionary are considered correct, but will not be used when making spell correction suggestions.\n\nNote: if a word is suggested by another dictionary, but found in this dictionary, it will be removed from the set of possible suggestions.",
"type": "boolean"
},
"path": {
"description": "Path to the file.",
"pattern": "^.*\\.(?:txt|trie)(?:\\.gz)?$",
"type": "string"
},
"repMap": {
"description": "Replacement pairs.",
"items": {
"dictionaryDefinitions": {
"items": {
"additionalProperties": false,
"properties": {
"description": {
"description": "Optional description.",
"type": "string"
},
"name": {
"description": "This is the name of a dictionary.\n\nName Format:\n- Must contain at least 1 number or letter.\n- Spaces are allowed.\n- Leading and trailing space will be removed.\n- Names ARE case-sensitive.\n- Must not contain `*`, `!`, `;`, `,`, `{`, `}`, `[`, `]`, `~`.",
"pattern": "^(?=[^!*,;{}[\\]~\\n]+$)(?=(.*\\w)).+$",
"type": "string"
},
"noSuggest": {
"description": "Indicate that suggestions should not come from this dictionary. Words in this dictionary are considered correct, but will not be used when making spell correction suggestions.\n\nNote: if a word is suggested by another dictionary, but found in this dictionary, it will be removed from the set of possible suggestions.",
"type": "boolean"
},
"path": {
"description": "Path to the file.",
"pattern": "^.*\\.(?:txt|trie)(?:\\.gz)?$",
"type": "string"
},
"repMap": {
"description": "Replacement pairs.",
"items": {
"type": "string"
"items": {
"type": "string"
},
"maxItems": 2,
"minItems": 2,
"type": "array"
},
"maxItems": 2,
"minItems": 2,
"type": "array"
},
"type": "array"
},
"type": {
"default": "S",
"description": "Type of file:\n- S - single word per line,\n- W - each line can contain one or more words separated by space,\n- C - each line is treated like code (Camel Case is allowed).\n\nDefault is S.\n\nC is the slowest to load due to the need to split each line based upon code splitting rules.",
"enum": [
"S",
"W",
"C",
"T"
],
"type": "string"
"type": {
"default": "S",
"description": "Type of file:\n- S - single word per line,\n- W - each line can contain one or more words separated by space,\n- C - each line is treated like code (Camel Case is allowed).\n\nDefault is S.\n\nC is the slowest to load due to the need to split each line based upon code splitting rules.",
"enum": [
"S",
"W",
"C",
"T"
],
"type": "string"
},
"useCompounds": {
"description": "Use Compounds.",
"type": "boolean"
}
},
"useCompounds": {
"description": "Use Compounds.",
"type": "boolean"
}
"required": [
"name",
"path"
],
"type": "object"
},
"required": [
"name",
"path"
],
"type": "object"
"type": "array"
},
"enabled": {
"default": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/cspell-eslint-plugin/src/common/options.cts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export type CSpellOptions = Pick<
| 'import'
| 'words'
> & {
dictionaryDefinition?: DictionaryDefinition;
dictionaryDefinitions?: DictionaryDefinition[];
};

export type RequiredOptions = Required<Options>;
Expand Down

0 comments on commit 51f1d08

Please sign in to comment.