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

Better error message #6

Open
sboudrias-aa opened this issue Mar 3, 2017 · 2 comments
Open

Better error message #6

sboudrias-aa opened this issue Mar 3, 2017 · 2 comments

Comments

@sboudrias-aa
Copy link

Hey Stewart!

It'd be nice to have clearer error messages. Right now "header error" is a bit generic and might be confusing.

We're ready to provide a PR, but I wanted to discuss solutions. Would it make sense to make an expectedHeader option to provide an exact expected message value?

Expected file to start with:
// Copyright 2017 Cie Name Ltd.

This would allow to pass filled copyright message that is easy to copy/paste.

I feel an auto-fixer (eg eslint --fix) would also require such an option.

@Stuk
Copy link
Owner

Stuk commented Mar 3, 2017

Hey Simon!

Yeah, I agree they're a bit generic, mainly because I didn't put in the effort to make them better!

One thing that seems ideal would be to use the existing configuration header in the error message, however I'm guessing you're using the regex configuration, which isn't copy and paste-able?

The concern I have is that the copyright headers I've seen span many lines, and having a duplicate matcher and ideal copyright header seems redundant, and also including a multi-line header in the ESLint output could be a bit verbose.

The examples I've seen so far mainly need a regex to match the year, so I'm now wondering if it would be worth having a "templated" header that allows you to embed {year} (or something) in the expected header. This could act as \d{4} in the matcher, then be replaced with the current year in the error message/--fix functionality. This would reduce the duplication within the configuration.

What do you think?

@srl295
Copy link

srl295 commented Feb 8, 2018

year would be good. Actually, you could have {year} (match any year, default to current year), {initialYear} (file create year from git/etc), {currentYear} (file update year from git/etc, falling back to the current year)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants