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

Enforce more eslint rules #681

Merged
merged 1 commit into from
Oct 9, 2016
Merged

Enforce more eslint rules #681

merged 1 commit into from
Oct 9, 2016

Conversation

xPaw
Copy link
Member

@xPaw xPaw commented Oct 9, 2016

More consistent style, and avoid potential bugs.

@xPaw xPaw added Type: Bug Issues that report and PRs that solve any defects that cause unexpected behaviors. Type: Feature Tickets that describe a desired feature or PRs that add them to the project. labels Oct 9, 2016
@xPaw xPaw added this to the 2.1.0 milestone Oct 9, 2016
@astorije
Copy link
Member

astorije commented Oct 9, 2016

Builds for this PR should pass after #684 is merged. I'll rebase this PR accordingly.

Copy link
Member

@astorije astorije left a comment

Choose a reason for hiding this comment

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

Good stuff overall, but a few minor changes and comments (@xPaw, if you are unable to make the changes yourself, feel free to comment and I'll apply the changes you want).

indent: [2, tab]
key-spacing: [2, {beforeColon: false, afterColon: true}]
keyword-spacing: [2, {before: true, after: true}]
linebreak-style: [2, unix]
no-console: 0
no-control-regex: 0
no-inner-declarations: 2
no-invalid-regexp: 2
no-irregular-whitespace: 2
Copy link
Member

Choose a reason for hiding this comment

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

Why removing these 3? It looks to me like we do want to keep checking on them, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

Theyre defaults in the recommended rules.

Copy link
Member

Choose a reason for hiding this comment

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

Argh, I forgot to check that...

no-trailing-spaces: 2
no-unexpected-multiline: 2
Copy link
Member

Choose a reason for hiding this comment

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

We might also want to keep this. From http://eslint.org/docs/rules/no-unexpected-multiline:

Note that the patterns considered problems are not flagged by the semi rule.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's default

no-trailing-spaces: 2
no-unexpected-multiline: 2
no-unreachable: 2
Copy link
Member

Choose a reason for hiding this comment

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

Was that removed on purpose? Why?

if (i === "userStyles") {
if (!/[\?&]nocss/.test(window.location.search)) {
$(document.head).find("#user-specified-css").html(options[i]);
(function SettingsScope() {
Copy link
Member

Choose a reason for hiding this comment

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

Settings with an upper case on purpose? Also, why wrapping these 70 lines?

Copy link
Member Author

Choose a reason for hiding this comment

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

I wrapped them to reduce the scope (especially the I variable which was being shadowed in other functions)

console.error(err);
fs.ensureDir(destDir, function(dirErr) {
if (dirErr) {
console.error(dirErr);
Copy link
Member

Choose a reason for hiding this comment

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

Why that change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Shadows same var name.

fonts.forEach(function (font) {
fs.copy(srcDir + font, destDir + font, function (err) {
fonts.forEach(function(font) {
fs.copy(srcDir + font, destDir + font, function(err) {
Copy link
Member

Choose a reason for hiding this comment

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

Urgh, I know this is to be consistent with the rest of our code, but this is painful to look at 😅. Sorry I missed this.
Also, I believe I should have used => functions there instead...

@@ -278,6 +278,10 @@ Client.prototype.updateToken = function(callback) {
var client = this;

crypto.randomBytes(48, function(err, buf) {
if (err) {
throw err;
}
Copy link
Member

Choose a reason for hiding this comment

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

Any unexpected consequences with this?

Copy link
Member Author

Choose a reason for hiding this comment

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

It should crash.

@astorije astorije merged commit 7e39ae0 into master Oct 9, 2016
@astorije astorije deleted the xpaw/more-eslint branch October 9, 2016 23:02
matburnham pushed a commit to matburnham/lounge that referenced this pull request Sep 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issues that report and PRs that solve any defects that cause unexpected behaviors. Type: Feature Tickets that describe a desired feature or PRs that add them to the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants