Skip to content

Commit e4fa82f

Browse files
thedaviddiasChristopher Quadflieg
authored and
Christopher Quadflieg
committed
fix: add prettier and eslint (#388)
* add eslintrc * eslint and prettier all files * fix: replace by npm script * fix: prettify more files * fixes based on review
1 parent 3db3dcc commit e4fa82f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+566
-684
lines changed

.eslintrc.js

-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,4 @@ module.exports = {
1010
ecmaVersion: 6,
1111
sourceType: 'module',
1212
},
13-
rules: {
14-
'one-var': ['error', 'never'],
15-
},
1613
}

.prettierignore

-8
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,3 @@ package-lock.json
1414
npm-debug.log*
1515
.nyc_output
1616
test/html
17-
18-
# Ignore formatting of ***x*** to **_x_**
19-
.github/PULL_REQUEST_TEMPLATE.md
20-
21-
/website/playground
22-
/website/.docusaurus
23-
/website/plugins
24-
/website/static

CHANGELOG.md

-18
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
# [0.13.0](https://github.com/htmlhint/HTMLHint/compare/v0.12.2...v0.13.0) (2020-05-18)
2-
3-
4-
### Bug Fixes
5-
6-
* add prettier and eslint ([#388](https://github.com/htmlhint/HTMLHint/issues/388)) ([aba3249](https://github.com/htmlhint/HTMLHint/commit/aba3249652181055f5897e0b4367b243f83ede3f))
7-
* add semantic release test ([#399](https://github.com/htmlhint/HTMLHint/issues/399)) ([616f9cd](https://github.com/htmlhint/HTMLHint/commit/616f9cd74a9463e6596198f867f35aab24094110))
8-
* ignore PULL_REQUEST_TEMPLATE.md ([30b0af2](https://github.com/htmlhint/HTMLHint/commit/30b0af2f86a4daa7ef3bd07e91e8220b7d4b75f3))
9-
* use yml in semantic.yml ([86f6700](https://github.com/htmlhint/HTMLHint/commit/86f67007a32f5e978921507c05a2620edc1f9afc))
10-
11-
12-
### Features
13-
14-
* Add tags checking rule - allows specify rules for any tag and validate that ([#384](https://github.com/htmlhint/HTMLHint/issues/384)) ([475aaca](https://github.com/htmlhint/HTMLHint/commit/475aaca431fab90a0ead7b21af7a73d4f0324514))
15-
* added attr-no-unnecessary-whitespace rule ([#385](https://github.com/htmlhint/HTMLHint/issues/385)) ([03bfd4f](https://github.com/htmlhint/HTMLHint/commit/03bfd4f7f6b60543a4253cad74758c794fc8cd18))
16-
* new rule: input-requires-label - All inputs require a label ([#159](https://github.com/htmlhint/HTMLHint/issues/159)) ([5bd40fb](https://github.com/htmlhint/HTMLHint/commit/5bd40fbc06b0d178cff4b9665ca992232dcb1f43))
17-
* new website for htmlhint.com ([#395](https://github.com/htmlhint/HTMLHint/issues/395)) ([5d0d95f](https://github.com/htmlhint/HTMLHint/commit/5d0d95f39dddddf94a22d3c6294e4e50472fa0a0))
18-
191
# HTMLHint change log
202

213
## ver 0.9.14 (2016-5-2)

bin/formatter.js

-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ var options
1111
// load formatters
1212
mapFormatters = loadFormatters()
1313
arrSupportedFormatters = []
14-
1514
for (var formatterName in mapFormatters) {
1615
if (formatterName !== 'default') {
1716
arrSupportedFormatters.push(formatterName)
@@ -27,31 +26,25 @@ function loadFormatters() {
2726
strict: false,
2827
silent: true,
2928
})
30-
3129
var mapFormatters = {}
3230
arrFiles.forEach(function (file) {
3331
var fileInfo = path.parse(file)
3432
var formatterPath = path.resolve(__dirname, file)
3533
mapFormatters[fileInfo.name] = require(formatterPath)
3634
})
37-
3835
return mapFormatters
3936
}
4037

4138
var formatter = new events.EventEmitter()
42-
4339
formatter.getSupported = function () {
4440
return arrSupportedFormatters
4541
}
46-
4742
formatter.init = function (tmpHTMLHint, tmpOptions) {
4843
HTMLHint = tmpHTMLHint
4944
options = tmpOptions
5045
}
51-
5246
formatter.setFormat = function (format) {
5347
var formatHandel = mapFormatters[format]
54-
5548
if (formatHandel === undefined) {
5649
console.log(
5750
'No supported formatter, supported formatters: %s'.red,

bin/formatters/checkstyle.js

-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ var checkstyleFormatter = function (formatter) {
44
formatter.on('end', function (event) {
55
var arrFiles = []
66
var arrAllMessages = event.arrAllMessages
7-
87
arrAllMessages.forEach(function (fileInfo) {
98
var arrMessages = fileInfo.messages
109
var arrErrors = []
11-
1210
arrMessages.forEach(function (message) {
1311
arrErrors.push({
1412
error: {
@@ -22,7 +20,6 @@ var checkstyleFormatter = function (formatter) {
2220
},
2321
})
2422
})
25-
2623
arrFiles.push({
2724
file: [
2825
{
@@ -33,7 +30,6 @@ var checkstyleFormatter = function (formatter) {
3330
].concat(arrErrors),
3431
})
3532
})
36-
3733
var objXml = {
3834
checkstyle: [
3935
{
@@ -43,7 +39,6 @@ var checkstyleFormatter = function (formatter) {
4339
},
4440
].concat(arrFiles),
4541
}
46-
4742
console.log(
4843
xml(objXml, {
4944
declaration: true,
@@ -52,5 +47,4 @@ var checkstyleFormatter = function (formatter) {
5247
)
5348
})
5449
}
55-
5650
module.exports = checkstyleFormatter

bin/formatters/compact.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var compactFormatter = function (formatter, HTMLHint, options) {
22
var nocolor = options.nocolor
3-
43
formatter.on('file', function (event) {
54
event.messages.forEach(function (message) {
65
console.log(
@@ -14,7 +13,6 @@ var compactFormatter = function (formatter, HTMLHint, options) {
1413
)
1514
})
1615
})
17-
1816
formatter.on('end', function (event) {
1917
var allHintCount = event.allHintCount
2018
if (allHintCount > 0) {
@@ -24,5 +22,4 @@ var compactFormatter = function (formatter, HTMLHint, options) {
2422
}
2523
})
2624
}
27-
2825
module.exports = compactFormatter

bin/formatters/default.js

-8
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,30 @@
11
var defaultFormatter = function (formatter, HTMLHint, options) {
22
var nocolor = options.nocolor
3-
43
formatter.on('start', function () {
54
console.log('')
65
})
7-
86
formatter.on('config', function (event) {
97
var configPath = event.configPath
108
console.log(' Config loaded: %s', nocolor ? configPath : configPath.cyan)
119
console.log('')
1210
})
13-
1411
formatter.on('file', function (event) {
1512
console.log(' ' + event.file.white)
16-
1713
var arrLogs = HTMLHint.format(event.messages, {
1814
colors: nocolor ? false : true,
1915
indent: 6,
2016
})
21-
2217
arrLogs.forEach(function (str) {
2318
console.log(str)
2419
})
25-
2620
console.log('')
2721
})
28-
2922
formatter.on('end', function (event) {
3023
var allFileCount = event.allFileCount
3124
var allHintCount = event.allHintCount
3225
var allHintFileCount = event.allHintFileCount
3326
var time = event.time
3427
var message
35-
3628
if (allHintCount > 0) {
3729
message = 'Scanned %d files, found %d errors in %d files (%d ms)'
3830
console.log(

bin/formatters/html.js

-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ var htmlFormatter = function (formatter) {
1313
fileContent =
1414
fileContent +
1515
'<tr><th>Number#</th><th>File Name</th><th>Line Number</th><th>Message</th></tr>'
16-
1716
var arrAllMessages = event.arrAllMessages
1817
arrAllMessages.forEach(function (fileInfo) {
1918
var arrMessages = fileInfo.messages
@@ -31,7 +30,6 @@ var htmlFormatter = function (formatter) {
3130
'</td></tr>'
3231
})
3332
})
34-
3533
fileContent = fileContent.replace('</table></body></html>')
3634
console.log(fileContent)
3735
fs.writeFileSync('report.html', fileContent)

bin/formatters/json.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ var jsonFormatter = function (formatter) {
33
console.log(JSON.stringify(event.arrAllMessages))
44
})
55
}
6-
76
module.exports = jsonFormatter

bin/formatters/junit.js

-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ var junitFormatter = function (formatter, HTMLHint) {
44
formatter.on('end', function (event) {
55
var arrTestcase = []
66
var arrAllMessages = event.arrAllMessages
7-
87
arrAllMessages.forEach(function (fileInfo) {
98
var arrMessages = fileInfo.messages
109
var arrLogs = HTMLHint.format(arrMessages)
11-
1210
arrTestcase.push({
1311
testcase: [
1412
{
@@ -28,7 +26,6 @@ var junitFormatter = function (formatter, HTMLHint) {
2826
],
2927
})
3028
})
31-
3229
var objXml = {
3330
testsuites: [
3431
{
@@ -45,7 +42,6 @@ var junitFormatter = function (formatter, HTMLHint) {
4542
},
4643
],
4744
}
48-
4945
console.log(
5046
xml(objXml, {
5147
declaration: true,
@@ -54,5 +50,4 @@ var junitFormatter = function (formatter, HTMLHint) {
5450
)
5551
})
5652
}
57-
5853
module.exports = junitFormatter

bin/formatters/markdown.js

-7
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,37 @@
11
var markdownFormatter = function (formatter, HTMLHint) {
22
formatter.on('end', function (event) {
33
console.log('# TOC')
4-
54
var arrToc = []
65
var arrContents = []
76
var arrAllMessages = event.arrAllMessages
8-
97
arrAllMessages.forEach(function (fileInfo) {
108
var filePath = fileInfo.file
119
var arrMessages = fileInfo.messages
1210
var errorCount = 0
1311
var warningCount = 0
14-
1512
arrMessages.forEach(function (message) {
1613
if (message.type === 'error') {
1714
errorCount++
1815
} else {
1916
warningCount++
2017
}
2118
})
22-
2319
arrToc.push(' - [' + filePath + '](#' + filePath + ')')
2420
arrContents.push('<a name="' + filePath + '" />')
2521
arrContents.push('# ' + filePath)
2622
arrContents.push('')
2723
arrContents.push(
2824
'Found ' + errorCount + ' errors, ' + warningCount + ' warnings'
2925
)
30-
3126
var arrLogs = HTMLHint.format(arrMessages)
3227
arrContents.push('')
3328
arrLogs.forEach(function (log) {
3429
arrContents.push(' ' + log)
3530
})
3631
arrContents.push('')
3732
})
38-
3933
console.log(arrToc.join('\r\n') + '\r\n')
4034
console.log(arrContents.join('\r\n'))
4135
})
4236
}
43-
4437
module.exports = markdownFormatter

bin/formatters/unix.js

-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ var unixFormatter = function (formatter, HTMLHint, options) {
1818
)
1919
})
2020
})
21-
2221
formatter.on('end', function (event) {
2322
var allHintCount = event.allHintCount
2423
if (allHintCount > 0) {
@@ -28,5 +27,4 @@ var unixFormatter = function (formatter, HTMLHint, options) {
2827
}
2928
})
3029
}
31-
3230
module.exports = unixFormatter

0 commit comments

Comments
 (0)