Skip to content

Commit e1c0c18

Browse files
authored
chore: bump standard from 14.x to 17.0.0 (#106)
* chore: adjust code for update to linter * chore: bump standard from 14.x to 17.0.0
1 parent d54f34f commit e1c0c18

13 files changed

+64
-63
lines changed

lib/format-tap.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function lengthFail (context, m, validator, t) {
4444
at: {
4545
line: m.line || 0,
4646
column: m.column || 0,
47-
body: body
47+
body
4848
}
4949
})
5050
}

lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module.exports = class ValidateCommit extends EE {
5454

5555
setImmediate(() => {
5656
this.emit('commit', {
57-
commit: commit,
57+
commit,
5858
messages: this.messages.get(commit.sha) || []
5959
})
6060
})

lib/rules/co-authored-by-is-trailer.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const id = 'co-authored-by-is-trailer'
44

55
module.exports = {
6-
id: id,
6+
id,
77
meta: {
88
description: 'enforce that "Co-authored-by:" lines are trailers',
99
recommended: true
@@ -24,14 +24,14 @@ module.exports = {
2424
emptyLines.pop()[1] < firstCoauthor[1]
2525
if (isTrailer) {
2626
context.report({
27-
id: id,
27+
id,
2828
message: 'Co-authored-by is a trailer',
2929
string: '',
3030
level: 'pass'
3131
})
3232
} else {
3333
context.report({
34-
id: id,
34+
id,
3535
message: 'Co-authored-by must be a trailer',
3636
string: firstCoauthor[0],
3737
line: firstCoauthor[1],
@@ -41,7 +41,7 @@ module.exports = {
4141
}
4242
} else {
4343
context.report({
44-
id: id,
44+
id,
4545
message: 'no Co-authored-by metadata',
4646
string: '',
4747
level: 'pass'

lib/rules/fixes-url.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const github = new RegExp('^https://github\\.com/[\\w-]+/[\\w-]+/' +
66
)
77

88
module.exports = {
9-
id: id,
9+
id,
1010
meta: {
1111
description: 'enforce format of Fixes URLs',
1212
recommended: true
@@ -17,7 +17,7 @@ module.exports = {
1717
const parsed = context.toJSON()
1818
if (!Array.isArray(parsed.fixes) || !parsed.fixes.length) {
1919
context.report({
20-
id: id,
20+
id,
2121
message: 'skipping fixes-url',
2222
string: '',
2323
level: 'skip'
@@ -33,43 +33,43 @@ module.exports = {
3333
// for an example
3434
const { line, column } = findLineAndColumn(context.body, url)
3535
context.report({
36-
id: id,
36+
id,
3737
message: 'Fixes must be a URL, not an issue number.',
3838
string: url,
39-
line: line,
40-
column: column,
39+
line,
40+
column,
4141
level: 'fail'
4242
})
4343
} else if (match) {
4444
if (match[1] === 'pull' && match[2] === undefined) {
4545
const { line, column } = findLineAndColumn(context.body, url)
4646
context.report({
47-
id: id,
47+
id,
4848
message: 'Pull request URL must reference a comment or discussion.',
4949
string: url,
50-
line: line,
51-
column: column,
50+
line,
51+
column,
5252
level: 'fail'
5353
})
5454
} else {
5555
const { line, column } = findLineAndColumn(context.body, url)
5656
context.report({
57-
id: id,
57+
id,
5858
message: 'Valid fixes URL.',
5959
string: url,
60-
line: line,
61-
column: column,
60+
line,
61+
column,
6262
level: 'pass'
6363
})
6464
}
6565
} else {
6666
const { line, column } = findLineAndColumn(context.body, url)
6767
context.report({
68-
id: id,
68+
id,
6969
message: 'Fixes must be a GitHub URL.',
7070
string: url,
71-
line: line,
72-
column: column,
71+
line,
72+
column,
7373
level: 'fail'
7474
})
7575
}

lib/rules/line-after-title.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const id = 'line-after-title'
44

55
module.exports = {
6-
id: id,
6+
id,
77
meta: {
88
description: 'enforce a blank newline after the commit title',
99
recommended: true
@@ -14,7 +14,7 @@ module.exports = {
1414
// all commits should have a body and a blank line after the title
1515
if (context.body[0]) {
1616
context.report({
17-
id: id,
17+
id,
1818
message: 'blank line expected after title',
1919
string: context.body.length ? context.body[0] : '',
2020
line: 1,
@@ -25,7 +25,7 @@ module.exports = {
2525
}
2626

2727
context.report({
28-
id: id,
28+
id,
2929
message: 'blank line after title',
3030
string: '',
3131
level: 'pass'

lib/rules/line-length.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const id = 'line-length'
44

55
module.exports = {
6-
id: id,
6+
id,
77
meta: {
88
description: 'enforce max length of lines in commit body',
99
recommended: true
@@ -21,7 +21,7 @@ module.exports = {
2121
// in the commit message
2222
if (parsed.release) {
2323
context.report({
24-
id: id,
24+
id,
2525
message: 'skipping line-length for release commit',
2626
string: '',
2727
level: 'skip'
@@ -38,7 +38,7 @@ module.exports = {
3838
if (line.length > len) {
3939
failed = true
4040
context.report({
41-
id: id,
41+
id,
4242
message: `Line should be <= ${len} columns.`,
4343
string: line,
4444
maxLength: len,
@@ -51,7 +51,7 @@ module.exports = {
5151

5252
if (!failed) {
5353
context.report({
54-
id: id,
54+
id,
5555
message: 'line-lengths are valid',
5656
string: '',
5757
level: 'pass'

lib/rules/metadata-end.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const id = 'metadata-end'
44

55
module.exports = {
6-
id: id,
6+
id,
77
meta: {
88
description: 'enforce that metadata is at the end of commit messages',
99
recommended: true
@@ -26,7 +26,7 @@ module.exports = {
2626

2727
if (lineNum !== end + 1) {
2828
context.report({
29-
id: id,
29+
id,
3030
message: 'commit metadata at end of message',
3131
string: body[lineNum],
3232
line: lineNum,
@@ -38,7 +38,7 @@ module.exports = {
3838
}
3939

4040
context.report({
41-
id: id,
41+
id,
4242
message: 'metadata is at end of message',
4343
string: '',
4444
level: 'pass'

lib/rules/pr-url.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const id = 'pr-url'
44
const prUrl = /^https:\/\/github\.com\/[\w-]+\/[\w-]+\/pull\/\d+$/
55

66
module.exports = {
7-
id: id,
7+
id,
88
meta: {
99
description: 'enforce PR-URL',
1010
recommended: true
@@ -14,7 +14,7 @@ module.exports = {
1414
validate: (context, rule) => {
1515
if (!context.prUrl) {
1616
context.report({
17-
id: id,
17+
id,
1818
message: 'Commit must have a PR-URL.',
1919
string: context.prUrl,
2020
line: 0,
@@ -36,29 +36,29 @@ module.exports = {
3636
// see nodejs/node#7d3a7ea0d7df9b6f11df723dec370f49f4f87e99
3737
// for an example
3838
context.report({
39-
id: id,
39+
id,
4040
message: 'PR-URL must be a URL, not a pull request number.',
4141
string: context.prUrl,
42-
line: line,
43-
column: column,
42+
line,
43+
column,
4444
level: 'fail'
4545
})
4646
} else if (!prUrl.test(context.prUrl)) {
4747
context.report({
48-
id: id,
48+
id,
4949
message: 'PR-URL must be a GitHub pull request URL.',
5050
string: context.prUrl,
51-
line: line,
52-
column: column,
51+
line,
52+
column,
5353
level: 'fail'
5454
})
5555
} else {
5656
context.report({
57-
id: id,
57+
id,
5858
message: 'PR-URL is valid.',
5959
string: context.prUrl,
60-
line: line,
61-
column: column,
60+
line,
61+
column,
6262
level: 'pass'
6363
})
6464
}

lib/rules/reviewers.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const id = 'reviewers'
44

55
module.exports = {
6-
id: id,
6+
id,
77
meta: {
88
description: 'enforce having reviewers',
99
recommended: true
@@ -15,7 +15,7 @@ module.exports = {
1515
// release commits generally won't have any reviewers
1616
if (parsed.release) {
1717
context.report({
18-
id: id,
18+
id,
1919
message: 'skipping reviewers for release commit',
2020
string: '',
2121
level: 'skip'
@@ -27,7 +27,7 @@ module.exports = {
2727
// See nodejs/node#5aac4c42da104c30d8f701f1042d61c2f06b7e6c
2828
// for an example
2929
return context.report({
30-
id: id,
30+
id,
3131
message: 'Commit must have at least 1 reviewer.',
3232
string: null,
3333
line: 0,
@@ -42,7 +42,7 @@ module.exports = {
4242
// of strings
4343

4444
context.report({
45-
id: id,
45+
id,
4646
message: 'reviewers are valid',
4747
string: '',
4848
level: 'pass'

lib/rules/subsystem.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const validSubsystems = [
8181
]
8282

8383
module.exports = {
84-
id: id,
84+
id,
8585
meta: {
8686
description: 'enforce subsystem validity',
8787
recommended: true
@@ -99,7 +99,7 @@ module.exports = {
9999
if (!parsed.release && !parsed.working) {
100100
// Missing subsystem
101101
context.report({
102-
id: id,
102+
id,
103103
message: 'Missing subsystem.',
104104
string: parsed.title,
105105
line: 0,
@@ -109,7 +109,7 @@ module.exports = {
109109
})
110110
} else {
111111
context.report({
112-
id: id,
112+
id,
113113
message: 'Release commits do not have subsystems',
114114
string: '',
115115
level: 'skip'
@@ -123,11 +123,11 @@ module.exports = {
123123
// invalid subsystem
124124
const column = parsed.title.indexOf(sub)
125125
context.report({
126-
id: id,
126+
id,
127127
message: `Invalid subsystem: "${sub}"`,
128128
string: parsed.title,
129129
line: 0,
130-
column: column,
130+
column,
131131
level: 'fail',
132132
wanted: subs
133133
})
@@ -136,7 +136,7 @@ module.exports = {
136136

137137
if (!failed) {
138138
context.report({
139-
id: id,
139+
id,
140140
message: 'valid subsystems',
141141
string: parsed.subsystems.join(','),
142142
level: 'pass'

0 commit comments

Comments
 (0)