streetsidesoftware / cspell

A Spell Checker for Code!

Home Page:https://cspell.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

💡: `cspell-define-config` package: add to docs

movahhedi opened this issue · comments

Problem

No response

Solution

I've created and npm package named cspell-define-config to provide types for cspell.config.js. It's nice to add it to the docs at https://cspell.org/configuration/

Example

import { defineConfig } from "cspell-define-config";

export default defineConfig({
	version: "0.2",
	ignorePaths: ["node_modules/**", "**/vendor/**", "temp/**", "dist/**", "build/**"],
	minWordLength: 4,
	allowCompoundWords: true,
	words: [],
	ignoreWords: [],
	import: [],
});

Alternatives

No response

Additional Context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

@movahhedi,

Than you for the suggestion. I would prefer a PR to add a new endpoint to cspell and then update the documentation.

import { defineConfig } from 'cspell';

export default defineConfig({
	version: "0.2",
	ignorePaths: ["node_modules/**", "**/vendor/**", "temp/**", "dist/**", "build/**"],
	minWordLength: 4,
	allowCompoundWords: true,
	words: [],
	ignoreWords: [],
	import: [],
});

It is already possible to get the types from cspell.

/**
 * @param {import("cspell").CSpellSettings} cfg
 * @returns {import("cspell").CSpellSettings}
 */
function defineConfig(cfg) {
    return cfg;
}

export default defineConfig({
    version: '0.2',
    ignorePaths: ['node_modules/**', '**/vendor/**', 'temp/**', 'dist/**', 'build/**'],
    minWordLength: 4,
    allowCompoundWords: true,
    words: [],
    ignoreWords: [],
    import: [],
});

But I can see how it might be useful to just have a function to use.

I'm thinking about PRing it to @cspell/cspell-types, since cspell exports all @cspell/cspell-types entirely, it would end up in cspell too.

export * from '@cspell/cspell-types';

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.