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

[#4] Set up the standard linter on CI #5

Merged
merged 1 commit into from
Sep 2, 2017

Conversation

doug-wade
Copy link
Collaborator

This resolves #4

"webpack": "^1.12.2"
},
"standard": {
"env": [
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note that this applies the mocha env to all files being linted, including source (non-test) files. If we'd prefer, we can switch to using comments at the head of files

Copy link
Owner

Choose a reason for hiding this comment

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

I think it's ok, I doubt that describe, it, etc. would ever leak to the source code, so it's not a big deal.

@@ -26,24 +26,27 @@ describe('integration tests', function() {
publicPath: '/bundles'
}
})
compiler.run(function(err, stats) {
compiler.run(function (err, stats) {
if (err) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Standard style requires all errors be handled. I rethrow here, which will fail the tests, but I could instead call assert.fail if we prefer.

Copy link
Owner

Choose a reason for hiding this comment

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

I think that's enough 👍

"test-ci": "env NODE_ENV=test mocha --require ./test/power_assert_loader.js test/basic.js test/integration.js"
"lint": "standard",
"lint-fix": "standard --fix",
"test": "npm run lint && env NODE_ENV=test mocha --require ./test/power_assert_loader.js test/basic.js test/integration.js --watch",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This will only run the linter one time, and then watch the unit tests. If we'd prefer, I can set up chokidar to run both tasks when files change.

Copy link
Owner

Choose a reason for hiding this comment

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

Hm, maybe it's better to create separate lint-watch task? There is an amazing https://www.npmjs.com/package/eslint-watch that does this job well.

As a side note. I think that the previous task naming is unfortunate. If I (or let's say CI) run npm test I expect to run it in a single mode. Maybe we should move watch mode to npm run test-watch for consistency sake?

Copy link
Owner

@kossnocorp kossnocorp left a comment

Choose a reason for hiding this comment

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

Great stuff, thank you!

@@ -26,24 +26,27 @@ describe('integration tests', function() {
publicPath: '/bundles'
}
})
compiler.run(function(err, stats) {
compiler.run(function (err, stats) {
if (err) {
Copy link
Owner

Choose a reason for hiding this comment

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

I think that's enough 👍

"test-ci": "env NODE_ENV=test mocha --require ./test/power_assert_loader.js test/basic.js test/integration.js"
"lint": "standard",
"lint-fix": "standard --fix",
"test": "npm run lint && env NODE_ENV=test mocha --require ./test/power_assert_loader.js test/basic.js test/integration.js --watch",
Copy link
Owner

Choose a reason for hiding this comment

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

Hm, maybe it's better to create separate lint-watch task? There is an amazing https://www.npmjs.com/package/eslint-watch that does this job well.

As a side note. I think that the previous task naming is unfortunate. If I (or let's say CI) run npm test I expect to run it in a single mode. Maybe we should move watch mode to npm run test-watch for consistency sake?

"webpack": "^1.12.2"
},
"standard": {
"env": [
Copy link
Owner

Choose a reason for hiding this comment

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

I think it's ok, I doubt that describe, it, etc. would ever leak to the source code, so it's not a big deal.

@doug-wade doug-wade merged commit af54c47 into kossnocorp:master Sep 2, 2017
@doug-wade doug-wade mentioned this pull request Sep 2, 2017
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

Successfully merging this pull request may close these issues.

Use standard linter
2 participants