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

From ws_objects #7

Merged
merged 2 commits into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ module.exports = {
named: 'never',
asyncArrow: 'always',
}],
'quotes': ['error', 'single', 'avoid-escape'],
'lines-between-class-members': ['error', 'always', {
exceptAfterSingleLine: true,
}],
},
};
11 changes: 11 additions & 0 deletions tests/files/lines-between-class-members-bad.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Example {
constructor() {
console.log();
}
// there should be a line between class members
method() {
console.log();
}
}

console.log((new Example()).theAnswer);
16 changes: 16 additions & 0 deletions tests/files/lines-between-class-members-good.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Example {
constructor() {
console.log();
}

// no line between one-line class members is OK
get theAnswer() { return 42; }
get message() { return 'hi'; }

// method() is unused but sadly the linter doesn't catch it yet
method() {
console.log();
}
}

console.log((new Example()).theAnswer);
1 change: 1 addition & 0 deletions tests/files/quotes-1-bad.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("no double quotes unless there is an apostrophe there");
1 change: 1 addition & 0 deletions tests/files/quotes-2-bad.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log(`no backticks without parameters`);
4 changes: 4 additions & 0 deletions tests/files/quotes-good.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
console.log('single quotes OK');
console.log("double quotes OK only if there's an apostrophe in them");
console.log('backslash \' quoting allowed');
console.log(`backticks OK with at least ${1} parameters`);