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
Add support for TypeScript configuration files #4940
Comments
@jesusbotella Thanks for the request and for using the template. Sounds good to me.
For those interested, here's the cosmiconfig loader. Unless anyone has an objection, I'll label as good to go? |
Thank you! Just in case anyone wants to know what it takes to add the TypeScript loader, here is the implementation that I have been testing in my project: jesusbotella@06af34b |
As we have three thumbs-up already, I'll label as ready to implement. Please consider contributing the enhancement if you have time. |
Just for information ESLint declined idea to support |
@hudochenkov Thank you for sharing the valuable thread! After I read the thread, I started wondering if we really need to support the TypeScript configuration file format. 🤔 In addtion, Sorry to the PR author, but shouldn't we rethink this issue? |
Yeah, I've read the reasons why ESLint project didn't want to support it and seem reasonable. Installing Typescript in every project that uses stylelint is not a good solution. My point was that the number of projects that use TypeScript nowadays is growing, and their developers might want to include dynamic configuration for stylelint rules, as I do, to use plugins like The proposal of having configuration plugins is good, but stylelint doesn't have a way to do that yet, and it might not be worth just to add support for TypeScript configuration files. What do you think? |
I have an update regarding TypeScript support in configuration files. While stylelint might not support them (and I think it's the right thing to do), developers can import TypeScript files with Developers can import I think we can close the pull request that I opened, and leave this snippet here so that anyone can import TypeScript files in their stylelint configuration.
require('ts-node/register');
const dynamicStylelintRules = require('./myTypeScriptFile');
module.exports = {
...dynamicStylelintRules
} |
@jesusbotella Thank you for providing the snippet. I agree with closing PR #4947 if we cannot resolve the problem of increasing extra dependencies. |
Thanks for the update (#4940 (comment)). I'll close this issue and the pull request. |
As many projects are adopting TypeScript as their main language, I think it would be great to have TypeScript support for stylelint configuration file.
That way, developers will be able to import TypeScript files across their codebases to customize rules in stylelint.
An option to have a TypeScript file as a valid configuration file along with JavaScript configuration files.
I saw that stylelint uses
cosmiconfig
for importing configuration files and there's a TypeScript file loader for that. So I can open up a PR if you think that TS configuration files are useful for stylelint users.The text was updated successfully, but these errors were encountered: