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 type Formatter for formatter functions #4823

Merged
merged 2 commits into from Jun 9, 2020

Conversation

m-allanson
Copy link
Member

@m-allanson m-allanson commented Jun 6, 2020

Add a named type for formatter functions.

Which issue, if any, is this issue related to?

Related to issue #3935

Is there anything in the PR that needs further explanation?

This change is a small part of the changes in PR #4796. On its own this change is quite small. The new type will be used as part of a follow up PR. See this diff for details.

@@ -83,6 +83,13 @@ declare module 'stylelint' {
warn(message: string, options?: StylelintWarningOptions): void;
};

export type Formatter = (
results: Array<StylelintResult>,
returnValue?: StylelintStandaloneReturnValue,
Copy link
Member Author

@m-allanson m-allanson Jun 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This second value returnValue isn't used in any of stylelint's built-in formatters (as far as I can tell).

However, it is mentioned in the docs, and there's some tests that ensure the value is passed through to the formatter.

So I've included it in the type definition here. But maybe it's an old argument that can be removed?

@m-allanson m-allanson mentioned this pull request Jun 6, 2020
14 tasks
lib/standalone.js Outdated Show resolved Hide resolved
Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@m-allanson m-allanson merged commit 5b6b996 into master Jun 9, 2020
@m-allanson m-allanson deleted the issue-3935/formatter-types branch June 9, 2020 11:13
m-allanson added a commit that referenced this pull request Jun 10, 2020
# By Mike Allanson (6) and others
# Via GitHub
* master:
  Bump got from 11.2.0 to 11.3.0 (#4825)
  Export an object from the CSS-in-JS syntax (#4824)
  Add type `Formatter` for formatter functions (#4823)
  Update CHANGELOG.md
  Fix false positives for namespaced variables in property-no-unknown (#4803)
  Update CHANGELOG.md
  Fix TypeError for inline comments and autofix for sugarss in max-empty-lines (#4821)
  Create new 'lintPostcssResult' module (#4819)
  13.6.0
  Update deps
  Prepare 13.6.0
  Update CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants