Skip to content

Commit

Permalink
Enable the eslint-plugin-no-unsanitized ESLint plugin to disallow u…
Browse files Browse the repository at this point in the history
…nsafe usage of e.g. `innerHTML`

See https://github.com/mozilla/eslint-plugin-no-unsanitized

Since we've generally never allowed e.g. `innerHTML`, which is enforced during review, there's only one linting failure with this patch. (Which is white-listed, according to the existing comment and the fact that it's test-only code.)
  • Loading branch information
Snuffleupagus committed Jun 23, 2019
1 parent 1c9a69d commit 5bb5e77
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"plugins": [
"import",
"mozilla",
"no-unsanitized",
"unicorn",
],

Expand All @@ -28,6 +29,8 @@
"import/no-unresolved": "error",
"mozilla/avoid-removeChild": "error",
"mozilla/use-includes-instead-of-indexOf": "error",
"no-unsanitized/method": "error",
"no-unsanitized/property": "error",
"unicorn/no-array-instanceof": "error",

// Possible errors
Expand Down
1 change: 1 addition & 0 deletions src/core/operator_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable no-unsanitized/method */

import { assert, ImageKind, OPS } from '../shared/util';

Expand Down
1 change: 1 addition & 0 deletions test/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
// Using insertAdjacentHTML yields a large performance gain and
// reduces runtime significantly.
if (this.output.insertAdjacentHTML) {
// eslint-disable-next-line no-unsanitized/method
this.output.insertAdjacentHTML('BeforeEnd', message);
} else {
this.output.textContent += message;
Expand Down

0 comments on commit 5bb5e77

Please sign in to comment.