Merge pull request #10925 from Snuffleupagus/eslint_no-unsanitized

Enable the `eslint-plugin-no-unsanitized` ESLint plugin to disallow unsafe usage of e.g. `innerHTML`
This commit is contained in:
Tim van der Meij 2019-06-27 20:32:24 +02:00 committed by GitHub
commit f1867de492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 0 deletions

View File

@ -7,6 +7,7 @@
"plugins": [ "plugins": [
"import", "import",
"mozilla", "mozilla",
"no-unsanitized",
"unicorn", "unicorn",
], ],
@ -28,6 +29,8 @@
"import/no-unresolved": "error", "import/no-unresolved": "error",
"mozilla/avoid-removeChild": "error", "mozilla/avoid-removeChild": "error",
"mozilla/use-includes-instead-of-indexOf": "error", "mozilla/use-includes-instead-of-indexOf": "error",
"no-unsanitized/method": "error",
"no-unsanitized/property": "error",
"unicorn/no-array-instanceof": "error", "unicorn/no-array-instanceof": "error",
// Possible errors // Possible errors

View File

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-unsanitized/method */
import { assert, ImageKind, OPS } from '../shared/util'; import { assert, ImageKind, OPS } from '../shared/util';

View File

@ -627,6 +627,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
// Using insertAdjacentHTML yields a large performance gain and // Using insertAdjacentHTML yields a large performance gain and
// reduces runtime significantly. // reduces runtime significantly.
if (this.output.insertAdjacentHTML) { if (this.output.insertAdjacentHTML) {
// eslint-disable-next-line no-unsanitized/method
this.output.insertAdjacentHTML('BeforeEnd', message); this.output.insertAdjacentHTML('BeforeEnd', message);
} else { } else {
this.output.textContent += message; this.output.textContent += message;