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

Add formatter property in configuration #7621

Open
Tracked by #5142
ybiquitous opened this issue Apr 17, 2024 · 0 comments
Open
Tracked by #5142

Add formatter property in configuration #7621

ybiquitous opened this issue Apr 17, 2024 · 0 comments
Labels
status: needs discussion triage needs further discussion

Comments

@ybiquitous
Copy link
Member

What is the problem you're trying to solve?

If a formatter in a configuration (e.g. stylelint.config.js) is supported, we can simplify stylelint CLI arguments or specify a formatter via an environment variable. For example:

Before:

stylelint a.css -f json
stylelint b.css -f json
# ...

After:

stylelint a.css
stylelint b.css
# ...
// .stylelintrc.json
{
  "formatter": "json"
}
// .stylelintrc.js
export default {
  formatter: process.env['STYLELINT_FORMATTER']
};

What solution would you like to see?

  • Add a formatter property in a configuration
// stylelint.config.js
import myCustomFormatter from 'my-custom-formatter';

export default {
  // A built-in formatter name
  formatter: 'string', // | 'compact' | 'json' | ...

  // Or a path to a custom formatter module
  formatter: './path/to/my-custom-formatter.js',

  // Or a custom formatter module
  formatter: myCustomFormatter,

  rules: { /* ... */ },
};
  • It's possible to override the property by CLI arguments: --formatter or --custom-formatter

Background: #7617 (comment)

@ybiquitous ybiquitous added the status: needs discussion triage needs further discussion label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs discussion triage needs further discussion
Development

No branches or pull requests

1 participant