chore: Use ESLint overrides for config (#348)

This commit is contained in:
Nick Schonning 2020-12-08 00:17:14 -05:00 committed by GitHub
parent a9d25b04ac
commit 0c309c63c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 6 deletions

View file

@ -3,3 +3,4 @@ demo/markdownlint-browser.js
demo/markdownlint-browser.min.js
demo/markdownlint-rule-helpers-browser.js
example/typescript/type-check.js
lib-es3/

View file

@ -180,5 +180,36 @@
"unicorn/prevent-abbreviations": "off",
"unicorn/string-content": "error",
"unicorn/throw-new-error": "error"
}
},
"overrides": [
{
"files": [
"demo/*.js"
],
"env": {
"browser": true
},
"rules": {
"jsdoc/require-jsdoc": "off",
"unicorn/prefer-query-selector": "off",
"unicorn/prefer-add-event-listener": "off",
"no-console": "off",
"no-shadow": "off",
"no-var": "off"
}
},
{
"files": [
"example/*.js"
],
"rules": {
"node/no-missing-require": "off",
"node/no-extraneous-require": "off",
"no-console": "off",
"no-invalid-this": "off",
"no-shadow": "off",
"object-property-newline": "off"
}
}
]
}

View file

@ -1,7 +1,5 @@
"use strict";
/* eslint-disable jsdoc/require-jsdoc */
(function main() {
// DOM elements
var markdown = document.getElementById("markdown");
@ -166,7 +164,7 @@
// Show library version
document.getElementById("version").textContent =
"(v" + markdownlint.getVersion() + ")";
"(v" + window.markdownlint.getVersion() + ")";
// Add event listeners
document.body.addEventListener("dragover", onDragOver);
@ -208,7 +206,7 @@
// Update Markdown from hash (if present)
if (window.location.hash) {
try {
const decodedHash = decodeURIComponent(window.location.hash.substring(1));
var decodedHash = decodeURIComponent(window.location.hash.substring(1));
if (hashPrefix === decodedHash.substring(0, hashPrefix.length)) {
markdown.value = decodedHash.substring(hashPrefix.length);
}

View file

@ -17,7 +17,7 @@
"test-cover": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 tape test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js",
"test-declaration": "cd example/typescript && tsc && node type-check.js",
"test-extra": "node test/markdownlint-test-extra.js",
"lint": "eslint --max-warnings 0 lib helpers test schema && eslint --env browser --global markdownit --global markdownlint --rule \"no-unused-vars: 0, no-extend-native: 0, max-statements: 0, no-console: 0, no-var: 0, unicorn/prefer-add-event-listener: 0, unicorn/prefer-query-selector: 0, unicorn/prefer-replace-all: 0\" demo && eslint --rule \"no-console: 0, no-invalid-this: 0, no-shadow: 0, object-property-newline: 0, node/no-missing-require: 0, node/no-extraneous-require: 0\" example",
"lint": "eslint --max-warnings 0 .",
"ci": "npm run test-cover && npm run lint && npm run test-declaration",
"build-config-schema": "node schema/build-config-schema.js",
"build-declaration": "tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf 'lib/{c,md,r}*.d.ts' 'helpers/*.d.ts'",