New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cspell-lib

Package Overview
Dependencies
Maintainers
1
Versions
368
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cspell-lib - npm Package Compare versions

Comparing version 4.1.1 to 4.1.2

148

dist/Settings/CSpellSettingsDef.d.ts

@@ -11,52 +11,129 @@ export declare type ReplaceEntry = [string, string];

export interface CSpellSettings extends FileSettings, LegacySettings {
$schema?: string;
}
export interface CSpellSettingsWithSourceTrace extends CSpellSettings {
source?: Source;
}
export interface FileSettings extends ExtendableSettings {
version?: string;
/**
* Configuration format version of the setting file.
* @default "0.1"
*/
version?: string | '0.1';
/** Words to add to dictionary -- should only be in the user config file. */
userWords?: string[];
/** Other settings files to be included */
import?: string | string[];
}
export interface ExtendableSettings extends Settings {
/** Overrides to apply based upon the file path. */
overrides?: OverrideSettings[];
}
export interface Settings extends BaseSetting {
/**
* Current active spelling language
* Example: "en-GB" for British English
* Example: "en,nl" to enable both English and Dutch
* @default "en"
*/
language?: LocalId;
words?: string[];
/** list of words to be ignored */
ignoreWords?: string[];
/** Glob file patterns to be ignored */
ignorePaths?: Glob[];
flagWords?: string[];
/** languageIds for the files to spell check. */
enabledLanguageIds?: LanguageId[];
/**
* The maximum number of problems to report in a file.
* @default 100
*/
maxNumberOfProblems?: number;
/**
* The maximum number of times the same word can be flagged as an error in a file.
* @default 5
*/
maxDuplicateProblems?: number;
/**
* The minimum length of a word before checking it against a dictionary.
* @default 4
*/
minWordLength?: number;
/**
* Number of suggestions to make
* @default 10
*/
numSuggestions?: number;
/** Additional settings for individual languages. */
languageSettings?: LanguageSetting[];
/** Forces the spell checker to assume a give language id. Used mainly as an Override. */
languageId?: LanguageId;
}
/**
* VS Code Spell Checker Settings
* To be Removed
* @deprecated
*/
export interface LegacySettings {
/***********************
* VS Code Spell Checker Settings below
* To be Removed
/**
* Show status
* @deprecated
*/
showStatus?: boolean;
/**
* Delay in ms after a document has changed before checking it for spelling errors.
* @deprecated
*/
spellCheckDelayMs?: number;
}
export interface OverrideSettings extends Settings, OverrideFilterFields {
/** Sets the programming language id */
languageId?: LanguageId;
/** Sets the local */
language?: LocalId;
}
export interface OverrideFilterFields {
/** Glob pattern or patterns to match against */
filename: Glob | Glob[];
}
export interface BaseSetting {
/** Optional identifier */
id?: string;
/** Optional name of configuration */
name?: string;
/** Optional description of configuration */
description?: string;
/**
* Is the spell checker enabled
* @default true
*/
enabled?: boolean;
/** list of words to be always considered correct */
words?: string[];
/** list of words to always be considered incorrect. */
flagWords?: string[];
/**
* True to enable compound word checking.
* @default false
*/
allowCompoundWords?: boolean;
/**
* Words must match case rules.
* @default false
*/
caseSensitive?: boolean;
/** Define additional available dictionaries */
dictionaryDefinitions?: DictionaryDefinition[];
/** Optional list of dictionaries to use. */
dictionaries?: DictionaryId[];
/**
* List of RegExp patterns or Pattern names to exclude from spell checking
* Example: ["href"] - to exclude html href
*/
ignoreRegExpList?: RegExpList;
/**
* List of RegExp patterns or defined Pattern names to define the text to be included for spell checking.
* If includeRegExpList is defined, ONLY, text matching the included patterns will be checked.
*/
includeRegExpList?: RegExpList;
/** Defines a list of patterns that can be used in ignoreRegExpList and includeRegExpList */
patterns?: RegExpPatternDefinition[];

@@ -66,8 +143,23 @@ }

export interface DictionaryDefinition {
/** The reference name of the dictionary, used with program language settings */
name: DictionaryId;
/** Optional description */
description?: string;
/** Path to the file, if undefined the path to the extension dictionaries is assumed */
path?: string;
/** File name */
file: string;
/**
* Type of file:
* S - single word per line,
* W - each line can contain one or more words separated by space,
* C - each line is treated like code (Camel Case is allowed)
* Default is S
* C is the slowest to load due to the need to split each line based upon code splitting rules.
* @default "S"
*/
type?: DictionaryFileTypes;
/** Replacement pairs */
repMap?: ReplaceMap;
/** Use Compounds */
useCompounds?: boolean;

@@ -78,40 +170,38 @@ }

export interface LanguageSettingFilterFields {
/** The language id. Ex: "typescript", "html", or "php". "*" -- will match all languages */
languageId: LanguageId | LanguageId[];
/** The local filter, matches against the language. This can be a comma separated list. "*" will match all locals. */
local?: LocalId | LocalId[];
}
export declare type RegExpList = PatternRef[];
export declare type PatternRef = Pattern | PatternId;
/** A PatternRef is a Pattern or PatternId. */
export declare type PatternRef = Pattern | PatternId | PreDefinedPatterns;
export declare type Pattern = string | RegExp;
export declare type PreDefinedPatterns = 'Base64' | 'CStyleComment' | 'Email' | 'EscapeCharacters' | 'HexDigits' | 'HexValues' | 'href' | 'PhpHereDoc' | 'PublicKey' | 'RsaCert' | 'SHA' | 'SpellCheckerDisable' | 'string' | 'Urls' | 'Everything';
/** This matches the name in a pattern definition */
export declare type PatternId = string;
/** This matches the name in a dictionary definition */
export declare type DictionaryId = string;
/** This is a written language local like: 'en', 'en-GB', 'fr', 'es', 'de', etc. */
export declare type LocalId = string;
/** These are glob expressions */
export declare type Glob = string;
/** This can be '*', 'typescript', 'cpp', 'json', etc. */
export declare type LanguageId = string;
export interface RegExpPatternDefinition {
/**
* Pattern name, used as an identifier in ignoreRegExpList and includeRegExpList
* It is possible to redefine one of the predefined patterns to override its value.
*/
name: PatternId;
pattern: PatternRef;
/**
* RegExp pattern
*/
pattern: Pattern;
/**
* Description of the pattern.
*/
description?: string;
}
export interface CSpellUserSettingsWithComments extends CSpellUserSettings {
'//^'?: string[];
'// version'?: string[];
'// name'?: string[];
'// description'?: string[];
'// language'?: string[];
'// words'?: string[];
'// ignorePaths'?: string[];
'// flagWords'?: string[];
'// enabled'?: string[];
'// showStatus'?: string[];
'// spellCheckDelayMs'?: string[];
'// enabledLanguageIds'?: string[];
'// maxNumberOfProblems'?: string[];
'// userWords'?: string[];
'// minWordLength'?: string[];
'// numSuggestions'?: string[];
'// ignoreRegExpList'?: string[];
'// allowCompoundWords'?: string[];
'// caseSensitive'?: string[];
'// import'?: string[];
'//$'?: string[];
}

@@ -118,0 +208,0 @@ export interface Source {

4

dist/Settings/CSpellSettingsServer.d.ts

@@ -1,2 +0,2 @@

import { CSpellUserSettingsWithComments, CSpellSettings, Glob } from './CSpellSettingsDef';
import { CSpellUserSettingsWithComments, CSpellSettings, Glob, CSpellSettingsWithSourceTrace } from './CSpellSettingsDef';
export declare const sectionCSpell = "cSpell";

@@ -18,2 +18,2 @@ export declare const defaultFileName = "cSpell.json";

*/
export declare function getSources(settings: CSpellSettings): CSpellSettings[];
export declare function getSources(settings: CSpellSettings | CSpellSettingsWithSourceTrace): CSpellSettings[];

@@ -119,3 +119,4 @@ "use strict";

const optionals = includeRegExpList.length ? { includeRegExpList } : {};
return Object.assign(Object.assign(Object.assign(Object.assign({}, left), right), optionals), { id: [leftId, rightId].join('|'), name: [left.name || '', right.name || ''].join('|'), words: mergeList(left.words, right.words), userWords: mergeList(left.userWords, right.userWords), flagWords: mergeList(left.flagWords, right.flagWords), ignoreWords: mergeList(left.ignoreWords, right.ignoreWords), enabledLanguageIds: replaceIfNotEmpty(left.enabledLanguageIds, right.enabledLanguageIds), ignoreRegExpList: mergeList(left.ignoreRegExpList, right.ignoreRegExpList), patterns: mergeList(left.patterns, right.patterns), dictionaryDefinitions: mergeList(left.dictionaryDefinitions, right.dictionaryDefinitions), dictionaries: mergeList(left.dictionaries, right.dictionaries), languageSettings: mergeList(tagLanguageSettings(leftId, left.languageSettings), tagLanguageSettings(rightId, right.languageSettings)), enabled: right.enabled !== undefined ? right.enabled : left.enabled, source: mergeSources(left, right) });
const settings = Object.assign(Object.assign(Object.assign(Object.assign({}, left), right), optionals), { id: [leftId, rightId].join('|'), name: [left.name || '', right.name || ''].join('|'), words: mergeList(left.words, right.words), userWords: mergeList(left.userWords, right.userWords), flagWords: mergeList(left.flagWords, right.flagWords), ignoreWords: mergeList(left.ignoreWords, right.ignoreWords), enabledLanguageIds: replaceIfNotEmpty(left.enabledLanguageIds, right.enabledLanguageIds), ignoreRegExpList: mergeList(left.ignoreRegExpList, right.ignoreRegExpList), patterns: mergeList(left.patterns, right.patterns), dictionaryDefinitions: mergeList(left.dictionaryDefinitions, right.dictionaryDefinitions), dictionaries: mergeList(left.dictionaries, right.dictionaries), languageSettings: mergeList(tagLanguageSettings(leftId, left.languageSettings), tagLanguageSettings(rightId, right.languageSettings)), enabled: right.enabled !== undefined ? right.enabled : left.enabled, source: mergeSources(left, right) });
return settings;
}

@@ -128,8 +129,14 @@ function hasLeftAncestor(s, left) {

}
function isCSpellSettingsWithSourceTrace(s) {
return !!s.source;
}
function hasAncestor(s, ancestor, side) {
return s.source
&& s.source.sources
&& s.source.sources[side]
&& (s.source.sources[side] === ancestor || hasAncestor(s.source.sources[side], ancestor, side))
|| false;
if (isCSpellSettingsWithSourceTrace(s)) {
return s.source
&& s.source.sources
&& s.source.sources[side]
&& (s.source.sources[side] === ancestor || hasAncestor(s.source.sources[side], ancestor, side))
|| false;
}
return false;
}

@@ -220,3 +227,3 @@ function mergeInDocSettings(left, right) {

function getSources(settings) {
if (!settings.source || !settings.source.sources || !settings.source.sources.length) {
if (!isCSpellSettingsWithSourceTrace(settings) || !settings.source || !settings.source.sources || !settings.source.sources.length) {
return [settings];

@@ -223,0 +230,0 @@ }

@@ -1,3 +0,3 @@

import { CSpellSettings } from './CSpellSettingsDef';
export declare const _defaultSettings: CSpellSettings;
import { CSpellSettings, CSpellSettingsWithSourceTrace } from './CSpellSettingsDef';
export declare const _defaultSettings: CSpellSettingsWithSourceTrace;
export declare function getDefaultSettings(): CSpellSettings;

@@ -59,3 +59,2 @@ "use strict";

numSuggestions: 10,
spellCheckDelayMs: 50,
words: [],

@@ -62,0 +61,0 @@ userWords: [],

{
"name": "cspell-lib",
"version": "4.1.1",
"version": "4.1.2",
"description": "A library of useful functions used across various cspell tools.",

@@ -18,3 +18,4 @@ "main": "dist/index.js",

"lint-travis": "tslint \"src/**/*.ts\"",
"build": "npm run compile",
"build": "npm run compile && npm run build-schema",
"build-schema": "ts-json-schema-generator -r --path src/Settings/CSpellSettingsDef.ts --type CSpellSettings > ../../cspell.schema.json",
"clean-build": "npm run clean && npm run build && npm run build-dictionaries",

@@ -62,4 +63,4 @@ "build-dictionaries": "npm run build_dictionaries-word-lists",

"cspell-dict-elixir": "^1.0.11",
"cspell-dict-en-gb": "^1.1.11",
"cspell-dict-en_us": "^1.2.18",
"cspell-dict-en-gb": "^1.1.13",
"cspell-dict-en_us": "^1.2.20",
"cspell-dict-fonts": "^1.0.3",

@@ -85,3 +86,3 @@ "cspell-dict-fullstack": "^1.0.18",

"gensequence": "^2.1.2",
"vscode-uri": "^2.0.3"
"vscode-uri": "^2.1.1"
},

@@ -112,3 +113,3 @@ "engines": {

},
"gitHead": "c528fdc4f86777aefbc23a18c3ac7a51c0c9d2bd"
"gitHead": "1fa87431f9dfaa9bbc75c2d8a1c8e708355786a0"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc