Skip to content

Commit 43fb368

Browse files
lobsterkatieonurtemizkan
authored andcommitted
ref(eslint): Update spaced-comment rule (#4235)
This makes two changes to the `spaced-comment` rule[1] in our global eslint config: - It allows comments to start with `///` in addition to `//`, in order to allow the use of triple-slash directives[2]. - In comments which start and end with `/*` and `*/`, respectively, the basic form of the rule enforces there being a space after the opening token. With this change, it also enforces there being a space before the closing token. The one exception is jsdoc-style block comments, which are allowed to start and end with an extra asterisk. [1] https://eslint.org/docs/rules/spaced-comment [2] https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html
1 parent 16bd4e5 commit 43fb368

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

packages/eslint-config-sdk/src/index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,22 @@ module.exports = {
215215
'max-lines': 'error',
216216

217217
// We should require a whitespace beginning a comment
218-
'spaced-comment': 'error',
218+
'spaced-comment': [
219+
'error',
220+
'always',
221+
{
222+
line: {
223+
// this lets us use triple-slash directives
224+
markers: ['/'],
225+
},
226+
block: {
227+
// comments of the form /* ..... */ should always have whitespace before the closing `*/` marker...
228+
balanced: true,
229+
// ... unless they're jsdoc-style block comments, which end with `**/`
230+
exceptions: ['*'],
231+
},
232+
},
233+
],
219234

220235
// Disallow usage of bitwise operators - this makes it an opt in operation
221236
'no-bitwise': 'error',

0 commit comments

Comments
 (0)