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

pass file info to rules #42

Conversation

WickyNilliams
Copy link
Contributor

fixes #30

@WickyNilliams
Copy link
Contributor Author

Sorry it took so long 😄

@ericcornelissen ericcornelissen self-requested a review November 1, 2021 22:57
Copy link
Contributor

@ericcornelissen ericcornelissen left a comment

Choose a reason for hiding this comment

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

Sorry it took so long 😄

No worries, better late then never 😃

The implementation looks good. Just have one comment to potentially improve clarity and/or extensibility. Also, as mentioned in the issue, this is ideally tested as well. I'm a new maintainer and not too familiar with the test suite for the project, but I think a test like the following in custom.spec.js could be a start:

it("should provide file information", function(done){
        testSucceeds([
            (reporter, $, ast, info) => {
                expect(info).toExist();
                expect(info.hasOwnProperty("path")).toBe(true);
                done();
            }
        ]);
    });

src/rules/custom.js Show resolved Hide resolved
@WickyNilliams
Copy link
Contributor Author

WickyNilliams commented Nov 4, 2021

I added a test as you asked.

I struggled to get the test to work properly (it would dump a load of junk to the console) using the format you suggested, so instead i throw an Error if either info, or info.filepath is not present. Hope that's ok!

Copy link
Contributor

@ericcornelissen ericcornelissen left a comment

Choose a reason for hiding this comment

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

I added a test as you asked.

Thanks!

I struggled to get the test to work properly (it would dump a load of junk to the console) using the format you suggested, so instead i throw an Error if either info, or info.filepath is not present. Hope that's ok!

Apologies if my test didn't work for you. Anyway, I do quite like the way you did it so no problems there.

Could you just remove the use of .only from and add semicolons ; where they're missing in the test suite?

test/custom.spec.js Outdated Show resolved Hide resolved
@WickyNilliams WickyNilliams force-pushed the feature/pass-file-info-to-rules branch from 3165115 to a6b70c0 Compare November 8, 2021 14:43
Copy link
Contributor

@ericcornelissen ericcornelissen left a comment

Choose a reason for hiding this comment

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

This looks good to me now @WickyNilliams, thanks!

I'll leave this open for a few more days (at least until 2021-11-15) to give @birjolaxew a chance to review it as well.

@birjj
Copy link
Contributor

birjj commented Nov 10, 2021

Haven't had the chance to actually test, but the code looks good to me. I'll let @ericcornelissen merge.

@ericcornelissen ericcornelissen merged commit 8fd0e21 into simple-icons:master Nov 11, 2021
@github-actions
Copy link

🎉 This PR is included in version 1.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@WickyNilliams WickyNilliams deleted the feature/pass-file-info-to-rules branch November 11, 2021 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Access current file name/path in custom rule
3 participants