diff --git a/.eslintrc.yml b/.eslintrc.yml index af2f1d8893846051d8d266b5424e2ec398444d0e..659ed2a0010699afa86cffb61bb1e8b3e03a85be 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -3,6 +3,7 @@ extends: - plugin:@gitlab/i18n - plugin:no-jquery/slim - plugin:no-jquery/deprecated-3.4 + - plugin:no-unsanitized/DOM - ./tooling/eslint-config/conditionally_ignore.js globals: __webpack_public_path__: true @@ -116,6 +117,14 @@ rules: vue/multi-word-component-names: off unicorn/prefer-dom-node-dataset: - error + no-unsanitized/method: + - error + - escape: + methods: 'sanitize' + no-unsanitized/property: + - error + - escape: + methods: 'sanitize' overrides: - files: - '{,ee/,jh/}spec/frontend*/**/*' @@ -134,6 +143,8 @@ overrides: message: 'Prefer explicit waitForPromises (or equivalent), or jest.runAllTimers (or equivalent) to vague setImmediate calls.' - selector: ImportSpecifier[imported.name='GlSkeletonLoading'] message: 'Migrate to GlSkeletonLoader, or import GlDeprecatedSkeletonLoading.' + no-unsanitized/method: off + no-unsanitized/property: off - files: - 'config/**/*' - 'scripts/**/*' diff --git a/package.json b/package.json index 91ccbab5f081eba543081a621e22714cc0a0301b..fd9818f267f436e968602b9b7cab92bc3cf84ab5 100644 --- a/package.json +++ b/package.json @@ -217,6 +217,7 @@ "eslint-import-resolver-jest": "3.0.2", "eslint-import-resolver-webpack": "0.13.2", "eslint-plugin-no-jquery": "2.7.0", + "eslint-plugin-no-unsanitized": "^4.0.1", "gettext-extractor": "^3.5.3", "gettext-extractor-vue": "^5.0.0", "glob": "^7.1.6", diff --git a/yarn.lock b/yarn.lock index 615031ba7144989b0434d63782a707b528b8ff81..2c8ce5086162b983e05f341b7a359fea49b5a2d6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5192,6 +5192,11 @@ eslint-plugin-no-jquery@2.7.0: resolved "https://registry.yarnpkg.com/eslint-plugin-no-jquery/-/eslint-plugin-no-jquery-2.7.0.tgz#855f5631cf5b8e25b930cf6f06e02dd81f132e72" integrity sha512-Aeg7dA6GTH1AcWLlBtWNzOU9efK5KpNi7b0EhBO0o0M+awyzguUUo8gF6hXGjQ9n5h8/uRtYv9zOqQkeC5CG0w== +eslint-plugin-no-unsanitized@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-4.0.1.tgz#e2343265467ba2270ade478cbe07bbafeaea412d" + integrity sha512-y/lAMWnPPC7RYuUdxlEL/XiCL8FehN9h9s3Kjqbp/Kv0i9NZs+IXSC2kS546Fa4Bumwy31HlVS/OdWX0Kxb5Xg== + eslint-plugin-promise@^4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz#845fd8b2260ad8f82564c1222fce44ad71d9418a"