Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💡: cspell-define-config package: add to docs #5358

Closed
1 task done
movahhedi opened this issue Mar 9, 2024 · 3 comments · Fixed by #5399
Closed
1 task done

💡: cspell-define-config package: add to docs #5358

movahhedi opened this issue Mar 9, 2024 · 3 comments · Fixed by #5399

Comments

@movahhedi
Copy link
Contributor

movahhedi commented Mar 9, 2024

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
@Jason3S
Copy link
Collaborator

Jason3S commented Mar 11, 2024

@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.

@movahhedi
Copy link
Contributor Author

movahhedi commented Mar 11, 2024

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';

Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants